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

GLB is not rendered correctly #2097

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

GLB is not rendered correctly #2097

dmikushin opened this issue Dec 19, 2023 · 4 comments

Comments

@dmikushin
Copy link

Hi @mikedh ,

I apologize for first posting this question to pyrender, however it more likely belongs to trimesh.

I've been desperately trying to render the GBL model of an eye correctly. I've tried everything, including your notes in #135. Unfortunately, the texture is still on the opposite side, and the iris is placed incorrectly. Needless to say, that on the other hand the rendering is perfectly correct with other JS-based renderers. What am I missing?

green-eye.zip

@mikedh
Copy link
Owner

mikedh commented Dec 19, 2023

Neat model! It looks like a lot of that is bad support for alpha in trimesh, I did notice when you scale the sclera down it does line up with the iris texture.

import numpy as np
import trimesh

if __name__ == "__main__":

    fn = 'models/featuretype.STL'

    trimesh.util.attach_to_log()

    m = trimesh.load('~/Downloads/g1.glb')

    m.geometry['Sclera'].apply_scale(9/10)

    # looks a lot better than showing the whole scene                                               
    e.show()

    m.show()
image

@dmikushin
Copy link
Author

@mikedh , thanks! I think you identified the issue. Indeed, by scaling down the sclera a bit, we can see that it is not as transparent as it is supposed to be. I'm attaching the render from another engine for comparison:

Screenshot from 2023-12-19 09-02-32

@dmikushin
Copy link
Author

Your example also points out that there is another issue in pyrender, because in pyrender I could not get even what you can get in trimesh:

Screenshot from 2023-12-19 09-08-20

In pyrender Sclera is much larger than the inner geometry, by some reason.

@dmikushin
Copy link
Author

dmikushin commented Dec 19, 2023

As it turns out, the trimesh rendering issue is likely due to the absence of KHR_materials_specular, KHR_materials_ior and KHR_materials_transmission support in the backend (pyglet?).

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