Overlapping Alphas with out additive effect

Q and A about functionality and how to solve a special task for your application.

Moderator: Support

Post Reply
User avatar
Gsand
Posts: 28
Joined: 24 Oct 2016, 18:00
Location: Los Angeles, California

Overlapping Alphas with out additive effect

Post by Gsand » 16 Feb 2018, 22:40

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

User avatar
lerou
Posts: 334
Joined: 06 Sep 2013, 07:14
Location: Hamburg, Germany

Re: Overlapping Alphas with out additive effect

Post by lerou » 16 Feb 2018, 22:51

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

User avatar
Gsand
Posts: 28
Joined: 24 Oct 2016, 18:00
Location: Los Angeles, California

Re: Overlapping Alphas with out additive effect

Post by Gsand » 16 Feb 2018, 23:45

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.

User avatar
Naggar
Posts: 138
Joined: 22 Dec 2016, 14:02
Location: Dubai, United Arab Emirates

Re: Overlapping Alphas with out additive effect

Post by Naggar » 17 Feb 2018, 13:44

Here is how you can use it with stencil set and test:

https://youtu.be/q8cggF3H0I8

User avatar
Götz_B
Posts: 180
Joined: 21 May 2013, 13:01

Re: Overlapping Alphas with out additive effect

Post by Götz_B » 20 Feb 2018, 11:08

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
Attachments
alphagrid2D.vzs
(15.32 KiB) Downloaded 121 times
alphagrid3D.vzs
(13.75 KiB) Downloaded 107 times

Post Reply