- Home /
Object shader that hides objects inside it?
Ok so I have a pretty strange request but bear with me. I'm trying to make shader that when applied to, say, a box, the box becomes invisible and everything inside the box is no longer rendered either. So if I were to make a sphere and slowly put it in the box, parts of the sphere would disappear. And if I were to duplicate the sphere and drag that out of the box, the new sphere would be visible from behind the box.
The idea is for this to be done using some sort of shader to allow it to act dynamically, so just turning off the mesh won't work.
I've investigated doing this with shaders, including render queues, stencil and depth masks, but my knowledge on all of these is too limited. If anyone has any ideas as to how I could make a shader like this, it would be greatly appreciated! Even just a thought of how I could go about it would help a lot! Thanks!