Shader layers instead of mixing colors

I have three circles in this example

I want to set it up so that the circles are “layered” based on the color
The blending obviously blends between the blue and the red so how can I render the blue and the red and white but as the color it was defined and not blended.

I played with the scene blend mode but did not get the result I am looking for.
I am a bit at a loss as to what I should be doing here.

Any suggestions or examples would be greatly appreciated.

Could try mixing the colors with the Lerp block instead of adding them. :slight_smile:

2 Likes

Thanks Blake really appreciate your help.
Do you by any chance know of any documentation that can explain that too me so I might understand why that works?

Here’s the reference page to explain how mix works, which is the function that the Lerp block corresponds to.
https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/mix.xhtml

so the add node is a normal “blend” between two values, in this case colors.
where the lerp is like normal linear interpellation.
So the alpha provides the interrelation between black and white so that the visible part is fully the end color and the smooth step parts provide you the mix between source and destination.

Or something like that.

It begs the question why the lerp node was not just called mix from the start?

In this case I think of starting with the bottom layer and mixing in the needed amount of the top layer, which was computed in its frame. And the smooth step here is making the outer edge of the circle more smooth, which can help clear up distortion present at certain camera angles…

Hmm IDK about the naming but I guess Lerp is more generic sounding and Mix sounds more specific to colors? E.G. usually people talk about LERP’ing between positions, not about mixing them… :slight_smile:

1 Like

Thanks for the time of explaining this too me Blake