Open nepfaff opened 1 day ago
Hey, it looks like what's happening here is that file has a ton of n-gon's that have to be triangulated, which trimesh does as a triangle fan:
usemtl Material
f 14/1/1 7/2/1 3/3/1 1/4/1 40/5/1 33/6/1 37/7/1 36/8/1 34/9/1 35/10/1 39/11/1 32/12/1 38/1\
3/1 29/14/1 30/15/1 28/16/1 31/17/1 26/18/1 27/19/1 25/20/1
f 40/5/1 1/4/1 5/21/1 7/2/1 14/1/1 12/22/1 15/23/1 11/24/1 9/25/1 10/26/1 16/27/1 13/28/1 \
24/29/1 19/30/1 18/31/1 17/32/1 23/33/1 20/34/1 22/35/1 21/36/1
f 4/37/2 3/3/2 7/38/2 8/39/2
It looks like three.js behaves the same as trimesh. Meshlab also appears to use the identical triangulation algorithm as trimesh. What viewer/generator are these meshes being created in? Do they load in meshlab or blender?
I see. That makes sense then. Thank you for the quick reply! No Bug but a mesh issue in this case :blush:
The mesh was generated using Blender, and the visualization is from Meshlab. I'm guessing this means that these use some way of detecting this issue and handling it differently?
This is the Blender visualization:
Oh yeah in the meshlab source:
This function is intended as a trivial fallback when glutessellator is not available. it assumes just ONE outline
We could call trimesh.creation.triangulate_polygon
on this loop too, however it's quite a bit more work since we'd have to fit the plane, transform the vertices into 2D, triangulate, transform back to 3D, rather than just looking at the topology like the fan tessellation.
I have this mesh:
I load it with trimesh and save it again using the following code:
Trimesh then produces this mesh:
Note that the mesh has the big hole filled in and contains non manifold edges. This corresponds to the trimesh visualization with
mesh.show()
and thus must have something to do with the way that the mesh is loaded.Trimesh version:
trimesh-4.5.2