Merging shapes
Hello!
I'm looking for a way in Shapes to merge shapes, especially circles (discs), so that only the outer part of circles when a few of them overlap. Is there a way to do this with Shapes, or would I have to mess with shaders & more to do so?
The idea would be that only circles with the same color merge between each other, or to give an identifier to each disc and that only discs with the same identifier merge together.
I've looked in the documentation for something like this but couldn't find anything that suited me, maybe I missed it ? 😅
If it's not there, would you have any advice on where to start for me to add such feature?
Kind regards,
Louve
the only way I can think of in Shapes is to use the stencil buffer for this, where you draw two discs for each ring:
First, a disc on the inner radius, that writes a value to the stencil buffer, and is otherwise invisible (set it to additive and make it black, but with alpha = 1)
Second, a disc for the outer radius, with the color you want, with a stencil buffer set to only render when that value is *not* present
inner invisible stencil disc:
outer disc:
looks like this:
note that this will break GPU instancing, so it's not super performant in component mode (though it can be in immediate mode if carefully set up), the more performant solutions are outside the scope of Shapes