@panicq said:
@TwistedTwigleg Sorry but I've been reading your tutorial and I still don't see how I could have this done with intersecting objects here is what I've done:
- Camera is rendering only the sphere (btw to create a mask I had no choice other than overriding the environment of the camera and setting a color background to white)
You'll need to have the Camera also render the intersecting objects, but in the background color. So in your case, you'll need the sphere to be black, and the intersecting cube to be white.
It does require every object to be duplicated in the scene though. However, if you have the duplicated objects use a simple unshaded material with a solid color, the rendering cost of making the bit mask should be fairly minimal.
I'll try to quickly whip up a simple example later that illustrates how this could be done.
What would be great is if I could use something like Unity's replacement shaders. In a frame: replace the targeted object by an unshaded shader, render the viewport for the mask and then putting the original shader back.
I had a discussion with a user who managed to, more or less, figure out how to do this in Godot. I'll see if I can find it, and if I can, I will link it here.