Page 1 of 1

Overlapping Alphas with out additive effect

Posted: 16 Feb 2018, 22:40
by Gsand
Trying to learn how to have lets say 2 circles partially overlap and apply a 50% alpha to them but not get the effect of the 2 semitransparent parts adding together
Did some searching on the forum and it looks like you could do this in v4 using a rendertarget but we are building in v5 and that does not seam to be available anymore.

Thanks for any help
Greg

Re: Overlapping Alphas with out additive effect

Posted: 16 Feb 2018, 22:51
by lerou
hi,

depends on the use case really. You could put the two circles into another layer. Use solid color and then apply a blending on layer level. A layer is am implizit render target.

you could also use the stencil test. If your circles have a solid color, just draw them to the stencil buffer and then draw a large rectangle in the correct color.

There are many different approaches.

cheers,
rou

Re: Overlapping Alphas with out additive effect

Posted: 16 Feb 2018, 23:45
by Gsand
Thank you, I had thought about the Layer option but really want to keep this in the 3D layer with all the other elements.
For this particular use case it is gridlines for a table that are over lapping and as a whole they would like to be an 8% alpha, but the overlapping points are of coarse are standing out due to the additive effect.

Re: Overlapping Alphas with out additive effect

Posted: 17 Feb 2018, 13:44
by Naggar
Here is how you can use it with stencil set and test:

https://youtu.be/q8cggF3H0I8

Re: Overlapping Alphas with out additive effect

Posted: 20 Feb 2018, 11:08
by Götz_B
Hi guys,

I also got 2 ideas. Scenes attached. Both use the depth.

Scene alphagrid2D just uses the Z-Testing set to 'NotEqual' - so the latest drawn element is only drawn where no other element ( depth-wise ) is located

Scene alphagrid3D is cheating a bit by using a cube instead of rectangles and makes use of the Improve Transparency Alpha Flag.

Might be a bit more lightweight than Layers or Render Targets.

Regards,

Götz