mikedh / trimesh

Python library for loading and using triangular meshes.
https://trimesh.org
MIT License
3k stars 581 forks source link

some vertices are missing when importing an OBJ file #2078

Closed Norwaycoconutjuice closed 11 months ago

Norwaycoconutjuice commented 11 months ago

Hello Mike. Thanks in advance for your help. I am encountering an issue where vertices are missing when importing an OBJ file. The corresponding OBJ file "dragon.obj" has been uploaded. when I load the OBJ file with trimesh and openmesh, There are some vertices missing in the mesh loaded with trimesh.The actual vertex count of this OBJ file is 151,486.However, the TriMesh class loaded only contains 151,471 vertices. I am confused about this issue for some days, so I want ask you for guidance. dragon.zip

The code is shown below. import trimesh import openmesh as om dragon_tri = trimesh.load_mesh("dragon.obj") dragon_om = om.read_trimesh("dragon.obj") print(dragon_tri.vertices.shape) # (151471,3) print(dragon_om.points().shape) # (151486,3)

Kiord commented 11 months ago

You need to disable the automatic mesh processing of with trimesh.load (otherwise some vertices may be merged)

import trimesh as tm
mesh_processed = tm.load('dragon.obj')
mesh = tm.load('dragon.obj', process=False)
print(mesh_processed)
#<trimesh.Trimesh(vertices.shape=(151471, 3), faces.shape=(302938, 3))>
print(mesh)
#<trimesh.Trimesh(vertices.shape=(151486, 3), faces.shape=(302938, 3))>
Norwaycoconutjuice commented 11 months ago

You need to disable the automatic mesh processing of with trimesh.load (otherwise some vertices may be merged)

import trimesh as tm
mesh_processed = tm.load('dragon.obj')
mesh = tm.load('dragon.obj', process=False)
print(mesh_processed)
#<trimesh.Trimesh(vertices.shape=(151471, 3), faces.shape=(302938, 3))>
print(mesh)
#<trimesh.Trimesh(vertices.shape=(151486, 3), faces.shape=(302938, 3))>

You've really helped me a lot. Thank you!