dgreenheck/OpenFracture

Regarding the self-intersecting mesh limitation

Modeuser opened this issue · 5 comments

Would anyone happen to know what kind of error message unity would display if I tried to slice a mesh with a self-intersecting/non-closed mesh? Just wanted to check if an issue I've been having is due to this limitation.

There won’t be any error. The triangulation algorithm which fills in the new faces will simply produce unexpected results. Can you post a screenshot of the issue? It’s also worth checking over your model in a 3D modeling app like Blender to verify there isn’t any problematic geometry. Unfortunately, I don’t know of a way to automatically detect if a mesh has self-intersecting or open geometry.

The 3D printing addon for blender is good for checking these kinds of mesh properties. It can automatically select degenerate or overlapping faces, and check whether the mesh is manifold.

To detect an open mesh:

  • merge all duplicate verts
  • ensure every edge is used by exactly 2 faces

I'm not sure of a performant way to find self intersecting meshes though.

@Modeuser FYI, here is a paper for triangulation of self-intersecting polygons: FIST: Fast Industrial Strength Triangulation of Polygons. It also appears to be faster than Sloan's algorithm (the algorithm used in OpenFracture) for most scenarios.

I initially used this paper but had issues extending it to handle polygons with holes. It's a much more complex algorithm with multiple phases and recovery modes. I ended up pivoting and switching to Sloan's algorithm I did because it does not need to handle special edge cases which I felt was a better approach to keep things more robust. I figured most meshes are closed and can easily be modified to avoid self-intersecting geometry.

@dgreenheck Here's the error message I'm getting:

fragment error with obj file

Some context:

I adapted your script for the new input system and various XR interactions, so far it's working great with most of my mesh files (.fbx).

But when I tried to slice a recently added .obj file, nothing happens and this error message gets reported in the Unity debugger.

@Modeuser Set a breakpoint on that line. Your mesh is likely missing UVs.