[SOLVED] Stencil buffer like in unity

The closest thing I can think of is something like this:

We’ve used something similar in a 360 panorama project to occlude scene objects using invisible walls.