Impossible Box, antichamber style

Hey everyone! happy holidays :slight_smile:

Posting a project smaller in scope, prototyping an idea for my portfolio.
I was inspired to create a 3d cube similar to the game antichamber, where every side of the cube would display a different world entirely.
I began trying to accomplish this in by using a regular mesh with a CubeTexture overlapped over it.
The texture would be white entirely apart from a single side that would be transparent, this method would work with only a single pane since trying to overlay a bunch of boxes would result in Z-fighting.

The correct approach is created by using stencils, I admit I don’t understand stencils completely, (check this video explaining the approach)

In short, I created 6 different meshes each assigning with a stencilId, and 6 different portals each assigned to the pane of the cube, the result is a cube that viewing from each pane shows a different world!

It seems to also perform pretty well, I couldn’t figure out how to use InstancedMesh with stencilId’s, I also could have added a glass shader for each side of the cube, but I feel I accomplished what I set out to do.