pyrender icon indicating copy to clipboard operation
pyrender copied to clipboard

Fix MASK alpha mode rendering issues

Open brooke-ec opened this issue 2 years ago • 0 comments

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!

brooke-ec avatar Oct 22 '22 15:10 brooke-ec