+1 vote

I'm using custom drawing to draw semi-transparent circles around objects. But, because they are semi-transparent, when circles overlap their transparency is added together, making the ugly overlap in the picture, below. Is there any way to turn off this additive blending in custom drawing? I want the circles to merge seemlessly so that every point in the circle has the same transparency level.
Thanks!

Example Image

Godot version 3.3stable
in Engine by (48 points)

1 Answer

+1 vote
Best answer

In other words you need to combine silhouettes and have resulting shape a uniform transparency?

If so, I'd suggest first draw merged circles with opaque colors to texture (like ViewportTexture), then draw that texture with transparency. Don't know if this will impact performance significantly though.

Another approach is to use shaders and maybe depth-buffer.

by (1,646 points)
selected by

Thanks for the suggestion! I'm having a little trouble figuring out the drawing to ViewportTexture, and I can't seem to find the correct tutorial anywhere. Could you give me a little guidance on the process, or point me in the right direction? Thanks again!

Nevermind, I finally figured it out. I ended up needing to use a separate scene to draw the circles, then instancing that scene within a viewport node and mirror the texture of that viewport node onto a sprite, and then changing the transparency of that sprite. irritating, but functional :)

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.