Good Morning Everybody!

I’m not sure why, but impossibilities and mind-bending puzzles have always intrigued me. Ever since I can remember, I’ve always been seriously interested in the “impossible” and achieving it. From teleportation and time travel to impossible geometries, I’ve wanted to somehow “solve” the impossible. That being said, this update is going to be a  relatively in-depth explanation of one of the most interestingly simple, visual tricks that I’ve come across in Unity so far. On top of that, I’m going to also explain how it ties into Constricted VR.

Since a few Unity releases ago, utilization of the Stencil Buffer has been available for Unity Personal licenses – which is a fantastic tool for Indie developers. The Unity stencil buffer works like the stencil buffer does in OpenGL or other engines, and allows developers to do some pretty unique tricks. From hiding objects to completely masking them, it is just a really awesome tool. I’m not going to go in-depth with how it works, but essentially the stencil buffer works almost the same as a shader does – it manipulates per-pixel data to allow control over what gets rendered and displayed. The stencil buffer works similarly to how depth buffers work as well, and can be used for many other visual effects such as outlines and adding shadows. So now you’re probably thinking “That sounds cool, but how does it apply to an escape-room game?!?”. Continue reading…

So let’s put this into perspective. We have the ability to hide objects that get rendered when the stencil buffer masks said objects. What if we dropped a stencil-buffer shader on top of a plane? Well, that means that anything behind the plane would be affected by it (Whether that means hiding or showing an object). By using two or more “depths”, we are able to perform some pretty awesome optical illusions! Click here to watch a short video testing out some neat illusions that can be achieved using stencil buffer manipulation.

As seen in the video, there is a small “window” that allows players to see the impossible – objects in 3D space that aren’t really “there”. While the meshes themselves exist in 3D space, they are masked by the stencil buffer, until they are visible by the shader that unmasks them. The second cool trick is with the chess pieces in the cube. From one angle, the cube looks entirely hollow and empty. From another, you see a rook floating in the middle of it. From a third angle, there are numerous bishops within the square and outside of its’ boundaries with a green background! While a simple illusion, it is an extremely powerful and fun one!

In the next room, the use of stencil buffer tricks is definitely going to be found. Each room in Constricted VR will have a distinct purpose and overarching feeling. Laboratory Escape, the first room, was meant to introduce players to the controls, as well as give them a time limit on escaping the room. While the room was simple, the puzzles were moderately difficult to solve. The second room, Impossible Hallway (Name still tbd…) is going to be much more focused on pushing the players’ minds to the limit and force them to think outside of the box. It isn’t going to necessarily be a very difficult escape room puzzle-wise, but it is going to be one that leaves players feeling mind-melded and urging for more through a comfortable combination of mechanics and puzzles. One of the greatest things about game development in virtual reality is developers are able to achieve the impossible in the most realistic way.

Imagine sitting at your computer monitor looking at a picture of an apple, and you are physically able to reach through it and physically grab that apple. Obviously we cannot do that right now (for scientific reasons, of course) but in virtual reality it is possible. In the video above, you see me grab an object that is seemingly not existent from one angle, and grab another from a different side of the cube. Another awesome feature is that you can grab different objects depending on which stencil buffer is rendering to the screen! Along with this, another exciting mechanic that I’ve been dying to present to you all is time manipulation!

In this room, there is going to be an amazing ability for the player to see into the past in certain parts of the escape room. This may allow players to see events happen that give them the combination for a lock in present-reality, or maybe I have some other ideas up my sleeve! The handheld mirror/window object that is seen in the beginning of the video is basically going to represent how players see into the “past”. All of this would be done through the stencil buffer and some nifty shader tricks! Another neat idea I have for using the window/mirror tool is for deciphering hidden passages. Similar to how red-filter decipher tools work in the real world, this would basically show a group of red words or letters that present the combination for a puzzle! So many ideas, and I can’t wait to implement them all after various testing!

I hope you enjoyed this lengthy wall of text! In my next blog post, I’m going to explain more about non-euclidean geometry and how it ties in with Constricted VR’s next room. Thank you again for visiting my blog and supporting Constricted VR!

-Brandon