non-additive blending?

hey,
is there a way to achive this with unity shaders : ) ?

the 2 circle are representing seperated meshes,
the square represents an object in the background.
http://s14.directupload.net/images/131206/fbvqtsaq.png

i need the circles to keep their color where they are overlapping (like on the right side).

The blending hardware blends every final fragment output by the shader with the existing background, which is what causes the overlap. It seems you want transparency for the circles at the same time as preventing them from affecting each other. That’s going to be difficult. Without them being transparent, you could use the destination alpha channel and a 2-pass shader, in the first pass draw the circles to the dest alpha with a straight replace/solid output and not output anything to the rgb channels, then in the second pass only draw solid circles multiplied by the value in the destination alpha channel, something like Blend OneMinusDstAlpha,Zero. But this doesn’t account for transparency. Transparency requires both parts of the blend equasion to be available, to do Blend SrcAlpha,OneMinusSrcAlpha so there is no way to do that at the same time as reacting to the destination alpha channel. So it’s not possible.

Another option is to draw your circle first solidly and then draw the rectangle afterwards with some other blend mode that mimics the appearance of transparency.

Hey,
thank you for your very detailed answer, it gave me an excellent insight into the problem.

this task seems to be a bit over my current skill-level : )

Other option is to draw the circles into a render target without transparency and then draw the render target to the screen with transparency.