google / google/filament

Order Independent Transparency?

Open
#2,838 17 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
20.5k
Forks
2.3k
Avg merge
2d 16h
Merged PRs (30d)
74

Description

Does Filament support depth sorting of transparent fragments or any order independent handling of transparency?

**Is your feature request related to a problem? Please describe.**
I have a reasonably complex scene in terms of transparency, with up to a few dozen layers of transparent surfaces (separate thin triangle mesh entities, not volumes) at some pixels, including concave self-occluding surfaces, a mix of opaque and transparent renderables/materials, and transparency controlled by a texture map (so that each mesh can have transparent and opaque areas). **Depth sorting at object (or even triangle) level is generally not sufficient.**

If I get lucky, Filament produces a very nice render. But my luck rate is about 50% and from the users perspective the behavior seems non-deterministic.

**Describe the solution you'd like**
1. Depth sorting of transparent fragments, implemented in the shader, if possible.
2. Any order-independent transparency implementation (correctness is more important than speed).
3. Triangle-level sorting might be an acceptable poor-men's alternative?

**Describe alternatives you've considered**
Disabling depthCulling or depthWriting "fixes" the trivial two-intersecting-triangles case, but disabling them is not acceptable in the real scene. And the "twoPassesTwoSides" mode is no more effective than the "default". "Fade" blending produces best results when objects are rendered in the correct order.

**OS and backend**
Windows 10, OpenGL, desktop, NVidia GPU.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.