Fake crystal using render textures

Hello.

For some time I have been looking for a way to achieve something similar than the “Fake crystal” thing that can be found in Prey.

You can notice this effect in the following video around the minute 15:45 (SPOILER ALERT)

1

I have tested a few things but can not achieve the same effect.
I have a render texture acting as a window and a camera in other room, but I find so difficult to get the sensation of depth when moving and looking around.
I am probably failing with the maths when moving the camera with the character in an attempt of making this work.

  • Please forgive my english, English is not my first language.

I am not very familiar with Unity’s rendering setup, so I can’t give you exact instructions, but here is the way I would do it:

Let’s assume that you have a glass wall with a hole in it. Scene A is the nice appartment + nice view. Scene B is all the stuff behind the hole (machinery and stuff.

You need only 1 camera for this, which is your main view camera and you don’t really need render targets. Here are the steps:

  1. Render Scene A
  2. Render the glass wall into the stencil buffer, so that only what is in the hole gets drawn
  3. Render Scene B using the stencil buffer

As I said, I don’t know the exact steps to do it with Unity, but I think it should be relatively easy to replicate.