# OpenFracture
![OpenFracture GitHub Header](https://user-images.githubusercontent.com/3814912/148176407-a0c49ba0-c704-4b60-89a3-cea47175b6c2.gif)
OpenFracture is an open source Unity package for fracturing & slicing meshes. This package supports both convex and non-convex meshes as well as meshes with holes. This means any arbitrary geometry can be fractured/sliced (as long as the geometry is closed and non-intersecting).
## Installing
### Unity Package Manager
OpenFracture can be imported using Unity’s built-in Package Manager. Follow the instructions [here](https://docs.unity3d.com/Manual/upm-ui-giturl.html)
### Import into Unity Project
Alternatively, you may download the code directly and add it to your Unity project.
## Documentation
Here is a [link](/Documentation~/GettingStarted.md) to the documentation.
## Features
### Fracturing
- **Runtime and Editor Support** - Fracture meshes either run-time or pre-fracture in the editor for optimal performance.
- **Arbitary Mesh Geometry** - Support for convex and non-convex meshes as well as meshes with multiple holes. **Note: Meshes must be closed and cannot have self-intersecting geometry**
- **2D/3D Fracturing** - Ability to specify which planes the mesh will be fractured in. This is useful when a mesh is effectively 2D (e.g. glass) and only needs to be fractured on two planes.
- **UV Remapping** - Texture coordinates are preserved along edges where mesh is fractured/sliced.
- **Custom Inside Material** - Use custom material for inside faces. Supports textures with options for UV scaling & offset.
- **Recursive Fracturing** - Fragments can be broken down into smaller fragments.
- **Multiple Trigger Types** - Trigger fractures using triggers, collisions or pressing a key. Additonal trigger types can be added easily.
- **Tunable Fragment Count** - Directly specify the number of fragments to easily tune performance for different platforms.
- **Asynchronous** - Support for asynchronous runtime fracturing (single-threaded)
- **Detect Floating Fragments** - Detects if multiple, isolated fragments are created when fracturing non-convex meshes and treats each fragment as a separate mesh.
- **OnCompletion Callback** - Trigger any behavior after the fracturing is complete, such as playing an AudioSource or executing other in-game logic.
### Slicing
- **Runtime Slicing** - Slice objects at runtime
- **Recursive Slicing** - Slice objects multiple times and slice the fragments into smaller pieces
- **Detect Floating Fragments** - Detects if multiple, isolated fragments are created when slicing non-convex meshes and treats each fragment as a separate mesh.
- **UV Remapping** - Texture coordinates are preserved along edges where mesh is fractured/sliced.
- **Custom Inside Material** - Use custom material for inside faces. Supports textures with options for UV scaling & offset.
- **OnCompletion Callback** - Trigger any behavior after the slicing is complete, such as playing an AudioSource or executing other in-game logic.
## Unsupported Features / Limitations
These features are currently **not supported**. They may be added in a future release.
- **Open and/or Self-Intersecting Geometry** - The algorithm which re-triangulates the cut faces requires a closed polygon that does not self-intersect. This means meshes that aren’t completely closed or have self-intersecting geometry will not fracture properly. To fracture meshes that consist of multiple sets of geometry which intersect each other, you can either A) split the geometry into separate meshes or B) remove the self-intersecting geometry in the mesh. This is a hard limitation due to the triangulation algorithm used.
- **Multiple Submeshes** - The new faces generated when slicing/fracturing a mesh use a custom material and must be placed on a separate submesh. Currently, only meshes with one submesh are supported since the new geometry is stored in `submesh[1]`.
- **Skinned Meshes**
- **Physics Joint Transferring** - Any Physics joints are destroyed upon fracturing/slicing and are not transferred to the fragments.
- **Custom Prefabs for Fragments** - Fragments are instantiated from a default template. If you want to have custom components on the fragments generated from the fracturing/slicing, this is currently not supported.
- **Localized Fracturing** - Fracturing currently is performed uniformly without taking into consideration the point of impact.
- **Slicing in Editor** - Currently slicing is only supported during runtime. The main reason for this is that slicing is extremely fast so this feature was not a top priority.
---
# Appendices
## Appendix A: Algorithm Overview
### Slicing
#### Spliting Mesh In Two
The first step in slicing is splitting the existing mesh data into two separate halves, one above the slice plane and the other below. This data will later be used to create two new meshes for each half.
1. Define the normal and origin of the slice plane
2. Instantiate two data structures, one to store mesh data above the slice plane and another to store mesh data below the slice plane.
3. For each vertex in the mesh, determine if it lies above or below the slice plane
4. For each triangle in the mesh, determine if all vertices of the triangle lie above or below the plane. If true, store in the appropriate data structure. Else, mark triangles that are intersected by the slice plane for later processing.
5. For each triangle intersected by the slice plane, slice the triangle in two and store the new vertex/triangle data in the appropriate data structure. The intersection of a triangle and the slice plane is a line. These lines are stored in a separate data structure for use in the next phase of filling the new face.
#### Filling in the Cut Face
Now that the original mesh data has been divided in two and the geometry intersected by the slice plane has been properly handled, the polygon produced by the intersection of the cut plane and the mesh must be filled in. The total set of lines produced by Step 5 of the previous phase define the border constraints for the new face. These constraints and the vertices of the polygon are fed into a constrained Delauney triangulation algorithm (see Reference [1] for more details).
### Fracturing
Fracturing is performed by recursively slicing a mesh until the target fragment count has been reached. For each slice, the origin of the geometry is calculated and used as the origin for the slice plane. The normal of the slice plane is randomly chosen.
## Appendix B: Running the Unit Tests
Many of the core functions have unit tests written. These can be helpful if you ever decide to start manipulating some of the core fracturing/slicing code. While the testing coverage isn't comprehensive, some tests are better than none!
1. In the menu bar, go to _Window -> General -> Test Runner_
2. On the _Test Runner_ window, click _Run All_ to run the suite of unit tests.
3. Verify all tests execute successfully
# References
[1] Sloan, Scott W. "A fast algorithm for generating constrained Delaunay triangulations." Computers & Structures 47.3 (1993): 441-450.
[2] Lawson, Charles L. "Software for C1 surface interpolation." Mathematical software. Academic Press, 1977. 161-194.
[3] Cline, A. K., and R. L. Renka. "A storage-efficient method for construction of a Thiessen triangulation." The Rocky Mountain Journal of Mathematics (1984): 119-139.
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
在Unity中使用OpenFracture,开发者可以创建更真实的物理环境,比如模拟玩家击碎玻璃、车辆碰撞产生的碎片效果等,从而增强游戏的沉浸感和真实感。同时,OpenFracture也可以应用于电影和电视特效制作中,使场景更加生动逼真。 精确控制破碎效果:OpenFracture采用数据驱动的方法,通过定义“损伤场”和“裂纹扩展规则”,可以精确地控制物体在受到力作用时如何破碎。这种算法允许用户创建出逼真的破碎效果,无论是精细的玻璃碎片还是粗犷的岩石崩塌。 支持多种图形接口和优化性能:OpenFracture支持OpenGL和Vulkan两种图形接口,并利用CUDA进行并行计算优化,确保在大规模模拟中的高性能表现。 提供Python API:项目还提供了Python API,使得与外部应用集成变得简单,例如在Unity游戏引擎中直接调用OpenFracture的功能。
资源推荐
资源详情
资源评论
收起资源包目录
Unity中的OpenFracture(模型破碎) (226个子文件)
OpenFracture.Tests.asmdef 529B
OpenFracture.Editor.asmdef 427B
OpenFracture.Runtime.asmdef 348B
ConstrainedTriangulator.cs 28KB
Triangulator.cs 23KB
MeshSlicer.cs 16KB
SlicedMeshDataTests.cs 13KB
Fragmenter.cs 12KB
FragmentData.cs 11KB
Fracture.cs 10KB
MathUtilsTests.cs 9KB
MeshUtils.cs 9KB
MathUtils.cs 5KB
Prefracture.cs 5KB
Slice.cs 5KB
BinSortTests.cs 5KB
ConstrainedTriangulatorTests.cs 4KB
TriangulatorTests.cs 3KB
BinSort.cs 3KB
PrefractureOptionsPropertyDrawer.cs 3KB
UnfreezeFragment.cs 3KB
CameraController.cs 2KB
TriggerOptionsPropertyDrawer.cs 2KB
PlaneSlicer.cs 2KB
EdgeConstraint.cs 2KB
FractureOptionsPropertyDrawer.cs 2KB
EdgeTests.cs 2KB
FractureOptions.cs 2KB
RefractureOptionsPropertyDrawer.cs 1KB
TriggerOptions.cs 1KB
Quad.cs 1KB
MeshVertex.cs 1KB
SliceOptions.cs 1KB
Vector3Tests.cs 1KB
TriangulationPoint.cs 1KB
CallbackOptionsPropertyDrawer.cs 895B
RefractureOptions.cs 812B
Projectile.cs 781B
QuadTests.cs 769B
PrefractureOptions.cs 763B
Vector3Extensions.cs 744B
MeshVertexTests.cs 663B
UniqueMaterial.cs 490B
TriangulationPointTests.cs 449B
ToggleText.cs 332B
CallbackOptions.cs 315B
UnfreezeFragmentEditor.cs 209B
PrefractureEditor.cs 199B
FractureEditor.cs 193B
SliceEditor.cs 187B
AssemblyInfo.cs 145B
.gitignore 1020B
settings.json 1KB
launch.json 1KB
package.json 1KB
RoughStone.mat 4KB
LionStatue.mat 4KB
HighlightSlice.mat 4KB
Glass.mat 3KB
GlassEdge.mat 3KB
Text.mat 3KB
Floor.mat 3KB
Inside.mat 3KB
README.md 7KB
Prefracture.md 5KB
Fracture.md 5KB
Slice.md 2KB
GettingStarted.md 2KB
LICENSE.md 1KB
CHANGELOG.md 23B
LionStatue.obj.meta 3KB
LionStatue.obj.meta 3KB
GlassPanel.obj.meta 3KB
LetterN.obj.meta 3KB
LetterE.obj.meta 3KB
LetterC.obj.meta 3KB
LetterR.obj.meta 3KB
LetterO.obj.meta 3KB
LetterA.obj.meta 3KB
LetterT.obj.meta 3KB
GlassPanel.obj.meta 3KB
LetterP.obj.meta 3KB
LetterF.obj.meta 3KB
LetterU.obj.meta 3KB
Rock003_1K_Roughness.png.meta 2KB
Rock003_1K_NormalDX.png.meta 2KB
Rock003_1K_AmbientOcclusion.png.meta 2KB
LionStatue_Normal.png.meta 2KB
Rock003_1K_NormalGL.png.meta 2KB
Rock003_1K_Color.png.meta 2KB
LionStatue_BaseColor.png.meta 2KB
Rock003_1K_Displacement.png.meta 2KB
GlassBreaking.mp3.meta 458B
StoneBreaking.mp3.meta 458B
Slicing.mp3.meta 458B
HighlightSlice.shadergraph.meta 285B
MeshVertex.cs.meta 243B
Triangulator.cs.meta 243B
EdgeConstraint.cs.meta 243B
Fragmenter.cs.meta 243B
共 226 条
- 1
- 2
- 3
资源评论
Forever-淡墨
- 粉丝: 29
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- chrome安装包linux版本
- 基于卷积神经网络的农作物病虫害图像识别(.html
- 易舟云:让中小企业财务管理变得触手可及.docx
- html5-event-calendar-open-source-php.20231120.zip
- Captura-v9.0.0.rar (windows 免费录屏工具,制作GIF动图)
- html5-event-calendar-open-source-asp.net-core.20231120.zip
- image_download_1718113345098.jpg
- Wandoujia_4124438_wap_seo_360_binded.apk
- anaconda配置pytorch环境.md
- anaconda配置pytorch环境.md
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功