Home

Awesome

OpenFracture

OpenFracture GitHub Header

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

Import into Unity Project

Alternatively, you may download the code directly and add it to your Unity project.

Documentation

Here is a link to the documentation.

Features

Fracturing

Slicing

Unsupported Features / Limitations

These features are currently not supported. They may be added in a future release.


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.