trimesh
trimesh copied to clipboard
Creating a new mesh from indices changes the number of vertices in an unnexpected way.
mesh = trimesh.load(obj_filename)
print(mesh)
new_mesh = trimesh.Trimesh(vertices=mesh.vertices, faces=mesh.faces)
print(new_mesh)
Output:
Notice how the vertices go from 555 to 505.
<trimesh.Trimesh(vertices.shape=(555, 3), faces.shape=(968, 3), name=`suzanne.obj`)>
<trimesh.Trimesh(vertices.shape=(505, 3), faces.shape=(968, 3))>
Hey, I think you probably want process=False to turn off vertex merging, which is on by default mostly so STL files don't show up as a triangle soup:
mesh = trimesh.load(obj_filename, process=False)
print(mesh)
new_mesh = trimesh.Trimesh(vertices=mesh.vertices, faces=mesh.faces, process=False)
print(new_mesh)
but why is vertex merging off by default in the load but on when creating the object? Seems it should be consistent
It's actually on for loading too, probably what's happening is since OBJ has explicit vertex normals it will only merge vertices if they have the same position AND normal, where in the second case it's only getting position passed in.