obj file loaded as Scene object instead of Trimesh object
See original GitHub issueHi,
I’m trying to load a mesh from an .obj file (from ShapeNet dataset) using Trimesh, and then use the repair. fix_winding(mesh)
function.
But when I load the mesh, via trimesh.load('/path/to/file.obj')
or trimesh.load_mesh('/path/to/file.obj')
, the object class returned is Scene, which is incompatible with repair. fix_winding(mesh)
, only Trimesh object are accepted.
How can I force it to load and return a Trimesh object or parse the Scene object to Trimesh object?
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (6 by maintainers)
Top Results From Across the Web
obj file loaded as Scene object instead of Trimesh object
With the current trimesh version (3.9.42), you need to use trimesh.load with force='mesh' : trimesh.load('/path/to/file.obj', force='mesh').
Read more >trimesh.exchange.obj — trimesh 3.17.1 documentation
Load a Wavefront OBJ file into kwargs for a trimesh.Scene object. Parameters. file_obj (file like object) – Contains OBJ data.
Read more >Python Examples of trimesh.load - ProgramCreek.com
GFile object or a string specifying the mesh file path. file_type: A string ... be passed to trimesh.load(). Returns: A trimesh.Trimesh or trimesh.Scene....
Read more >Example Usage — meshrender 0.0.1 documentation
Everything in the meshrender model revolves around the Scene object, ... Begin by loading meshes cube_mesh = trimesh.load_mesh('cube.obj') sphere_mesh ...
Read more >trimesh/Lobby - Gitter
Does anyone know whether the collision manager considers an object fully ... _ = trimesh.collision.scene_to_collision(scene) # Sliding box collider box ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
My understanding is that some
.obj
files specify different sub-meshes. trimesh attempts to recreate this as faithfully as possible. You can always concatenate the meshes together, though not all aspect have concatenation which is supported. If all you care about is the vertices/faces, you can use something like the following:Yeah the material concatenation is pretty expensive, we could add Yet Another Keyword Argument™️ to the OBJ loader haha. It still complains about concatenation because it’s still loading UV coordinates, but speeds it up by an order of magnitude:
Happy to include in the next release if that’s useful.