I’m working on a stencil effect where a portion of an object can be “cut out” using another object as reference.
To do this I have the floor set up as a translucent material which tests the stencil value in the CustomStencil scene texture to determine it’s opacity.
The stencil buffer looks like this:
My current goal is to get this to work with a non-translucent material.
I can’t do this right now because non-translucent materials don’t have access to the custom depth buffer / stencil values.
Basically what I’d like to do is render all of the “Portals” (in this case a cube) to the stencil buffer (value = 1).
Then in the next pass render all of the “Blockers” (in this case the floor) the the stencil buffer (value = 2).
Then render the “Blockers” in the main pass while obeying the rule value == 2.
Then render the rest of the main pass.
I’m not sure where to start with this approach, any ideas?