The current approach to alpha compositing is fairly simple. While it works for now, it won't once other entities are added:
- In the world render pass, objects are rendered in order of their material index (pre-sorted back-to-front)
- This currently works because terrain is rendered first, then water planes, and debug meshes don't interact with either
- UI elements are blended on top of the resulting scene, with compositing enabled - this is fine and won't need to change
This will break as soon as other alpha-blended elements have to be rendered: 3D props, 2D sprites, effects, or even decals.
A better solution would be order-independent transparency. Can probably check BJS or other rendering engines for inspiration?
The current approach to alpha compositing is fairly simple. While it works for now, it won't once other entities are added:
This will break as soon as other alpha-blended elements have to be rendered: 3D props, 2D sprites, effects, or even decals.
A better solution would be order-independent transparency. Can probably check BJS or other rendering engines for inspiration?