adrien-ben/gltf-viewer-rs

Transparency is broken

adrien-ben opened this issue · 3 comments

I need some sort of sorting ...

The worst occurrences are related to some models whose materials are BLEND but actual alpha value is 1.0.
When it occurs opaque geometry is renderer during the transparent pass durng which we don't write the depth buffer for obvious reasons.

24972d8 fixes that edge case by adding a pass where we render transparent primitives as opaque BUT discard fragments with an alpha < 1.0. Then during the transparent pass we now discard fragments whose alpha is = 1.0.

All examples that were completely broken seem fine now. It's still not perfect and implementing some sort of order independent transparency algorithm would help improve things further.

Before
Screenshot 2024-05-04 190818

After
Screenshot 2024-05-04 190627