trimesh
trimesh copied to clipboard
Fix inconsistent face orientations
Hi everyone, I am doing vision research in mujoco. Therefore I want to import ShapeNet meshes into mujoco. Unfortunately this error appears:
Error: faces have inconsistent orientation
So what I would like to do is the following:
- Import an .obj with trimesh
- Concatinate all subgroups of meshes into one group
- Fix the face orientations
- Export the mesh to a new .obj
Simply import the .obj (1), concat the subgroups with this thread (2) and export the mesh to a new .obj (4) does not help to fix the error massage.
Do you guys have any idea, what I could do? Thanks in advance!
Currently my code looks like this:
import trimesh
mesh = trimesh.load(PATH+FILE)
print(type(mesh))
trimesh.scene.scene.Scene
dump = mesh.dump()
concat = dump.sum()
print(type(concat))
trimesh.base.Trimesh
resolver = trimesh.resolvers.FilePathResolver(PATH)
output = trimesh.exchange.obj.export_obj(concat, resolver=resolver)
file = open(PATH + 'test.obj', 'w')
file.write(output)
file.close()