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

Fix MASK alpha mode rendering issues #242

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

brooke-ec
Copy link

I was experiencing issues rendering textures with the MASK alpha mode. Some faces would render through the transparent sections and some simply wouldn't. I tracked this down to being caused by the depth buffer treating the transparent sections as opaque.

Here is an example of the depth buffer for a masked texture using the current version of pyrender:
current
And the same texture after my changes:
fixed

I have added a check in mesh.frag to discard the fragment if the alpha is less than the material's alpha cutoff. I have also added a new define IS_MASK_ALPHA_MODE specifying if the alpha mode is set to MASK.

Thank you for taking the time to read, let me know if you have any suggestions!

• Updated get_trimesh_props to copy alphaMode for PBRMaterial
• Updated mesh.frag to discard fragments with alpha <= alphaThreshold
• Added new define: IS_MASK_ALPHA_MODE
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

Successfully merging this pull request may close these issues.

2 participants