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

Loading Objaverse GLB files with textures #2304

Open
preddy5 opened this issue Oct 18, 2024 · 1 comment
Open

Loading Objaverse GLB files with textures #2304

preddy5 opened this issue Oct 18, 2024 · 1 comment

Comments

@preddy5
Copy link

preddy5 commented Oct 18, 2024

Hi @mikedh,
Thank you for maintaining this amazing repository. Geometric processing research wouldn't be what it is today without trimesh.

I've downloaded a GLB scene from the Objaverse dataset on Sketchfab (link). However, I'm struggling to load the file with trimesh while preserving the textures. When I converted the GLB scene to an OBJ file using this online converter, I was able to load it successfully, but this process isn't scalable for the entire Objaverse dataset.

I also tried loading the GLB file in Blender and exporting it as an OBJ. Although the exported file contained the geometry, it didn’t include the texture information (even though the texture appears when rendering or UV editing in Blender).

I would really appreciate any guidance you could provide on how to load the GLB file as a trimesh mesh object while retaining the textures, so I can fully utilize trimesh functionalities. Thank you so much for your time and help!

Code:

mesh = trimesh.load(file_path, process=False, force='mesh')
if hasattr(mesh.visual, 'material') and mesh.visual.material.image is not None:
    print("Mesh has a texture")
    print(f"Texture size: {mesh.visual.material.image.size}")
else:
    print("Mesh does not have a texture")

returns "Mesh does not have a texture"

Regards,
Pradyumna.

@preddy5 preddy5 changed the title Loading Objaverse GLB with files with textures Loading Objaverse GLB files with textures Oct 21, 2024
@lionlai1989
Copy link

lionlai1989 commented Oct 24, 2024

I faced a similar issue when exporting a mesh with textures to a GLB file. "trimesh" sometimes creates a GLB with textures but sometimes doesn't.

The problem, in my case, was related to missing dependencies required by "trimesh", which can be solved by:

pip install "trimesh[easy]"

Hope this works for you!

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

2 participants