Semi-transparent polygons
c42f opened this issue · comments
Crude support for semi-transparent polygons would be quite useful CC @Ross-Batten .
In general, there's no nice way to do this in standard OpenGL, since OpenGL doesn't support order independent transparency; without special CPU-side handling, rendering artifacts are guaranteed. As far as I'm aware, the usual solution to this is:
- Render all opaque geometry as usual
- Ensure transparent primitives cannot intersect using high level logic ("game logic")
- Sort transparent primitives by depth
- Render primitives in the sorted order, back to front, with alpha compositing enabled.
We could potentially implement the above in a crude way, by just ignoring step 2 which can't be fixed without heroic efforts. The idea would be:
- Add transparency flag to
Geometry
instances. - Separate transparent
Geometry
instances into a separate list, sort, and render front to back.
Depth Peeling is a potential approach, depending on the number of layers.
Fairly GPU intensive. https://en.wikipedia.org/wiki/Depth_peeling
http://doc.jzy3d.org/depthpeeling/DualDepthPeeling.pdf
Thanks, this is interesting - particularly the single pass approximation - displaz is not aiming for realism but utility, so using an approximation would be fine as long as it's not distracting.
Probably something could be done in the QT3D framegraph.