Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to properly merge the Scenes from multiple trimeshes? #274

Open
dmikushin opened this issue Dec 19, 2023 · 0 comments
Open

How to properly merge the Scenes from multiple trimeshes? #274

dmikushin opened this issue Dec 19, 2023 · 0 comments

Comments

@dmikushin
Copy link

dmikushin commented Dec 19, 2023

I apologize for a possible misunderstanding, the code is very difficult for me to follow.

I've figured out that a trimesh may already return a Scene, if an input file contains multiple meshes.

The Viewer needs a single scene to be viewed, therefore all scenes somehow must be squeezed into one Scene for viewing.

Scene is a Graph containing the hierarchy of geometries.

As far as I can see, the library does not provide an explicit API for merging scenes, however intuitively it should exist.

The example shows that something along these lines is possible:

desk = trimesh.load('./models/desk.obj')
for trimesh in desk.geometry.values():
    mesh = Mesh.from_trimesh(trimesh)
    scene.add(mesh)

But this approach clearly does not preserve the graphs coming for the individual trimeshes, all of them are added flattened to the final scene. If this can be correct, what was the point to initially have a graph inside each Scene? If it's not correct, kindly what is the proper way? Unfortunately, it is not clear from the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant