- Home /
Layering Transparent Objects
Basically, I have 2 objects (2D quads) that I want to be transparent with each other, but not blend their color with the background object (2D quad).
For example, one object is blue and the other is green. When overlapping, they blend to make a cyan color, due to their transparency. I then place these objects on a solid opaque orange background and now, due to the 2 top objects transparency, they blend with the background making the colors off. As expected, but not desired.
Would there be some method I could use to allow the 2 transparent top objects to keep blending with each other, but not blend with the background somehow?
Can this be done within a shader? I feel like some kind of masking technique might be able to do it, but unfortunately I don't understand shader techniques and language syntax enough...
Any other techniques? I tried camera layers and render textures, but couldn't get the result that way that I know of... Any other ideas? Other than procedurally generating a shape that represents the overlapping area of the 2 top objects (and making them all opaque)... which sounds difficult.
I'm sure there should be a simple way to achieve this... I found this image that shows a decent example. Where if you imagine the overlapping triangles are my transparent objects that blend with each other, but notice how they do not blend with the 2 solid colors on the background. Imagine I could move the triangles around to choose which are being overlapped/blended. How could I set this up?
Your answer
Follow this Question
Related Questions
URP – Order Independent Transparency 0 Answers
Unity 4.6 and Grabpass fails 1 Answer
Shader Question about Alpha 0 Answers