Dealing with overlapping transparent materials

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Mudley
:warning: Old Version Published before Godot 3 was released.

How to make so that transparent materials blend together when overlapping (like in the second example)?

enter image description here

In 2D or 3D space?

timoschwarzer | 2017-07-12 23:44

3D, but would be nice to know for 2D too, if I am not asking much.

Mudley | 2017-07-13 00:29

To do that in 3D you would need something similar to a Z-buffer so that only the closest transparent pixels are shown, not those behind (which could create issues). I don’t know how feasible this is…
You could also do that at geometry level but it would be slower.

In 2D, same story. If there is no Z-buffer, you need a buffer at some point to accumulate those objects in an “unshaded” manner and draw them afterwards using transparency on the whole.

Zylann | 2017-07-13 14:17