pyrender
pyrender copied to clipboard
Fix MASK alpha mode rendering issues
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:
And the same texture after my changes:
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!