2
\$\begingroup\$

My question is about a visual trick I would like to perform in Unity3D. I want the player to walk outside a door and see no walls of the room behind them, just the door. They should still be able to see inside the room as if it were a "projected box plane" but not the walls containing it. They won't be able to touch where the walls should be, so I'm not worried about any invisible walls.

I'm imagining it would be similar to a "projected box plane" but I couldn't find any resources on how to do that in Unity3D. Just point me in an area I could research if this problem is more complicated then I thought.

Thank you.

\$\endgroup\$
  • \$\begingroup\$ Are you looking for something like this? \$\endgroup\$ – DMGregory Mar 7 at 19:03
  • \$\begingroup\$ @DMGregory Kind of, but the more the opposite. I want a plane that hides geometry that actually exists, I plan on putting it on the opposite sides of the wall of the door. If you took the visual example from the link you sent but to have the plane be everything but the doorway. \$\endgroup\$ – moloy559 Mar 7 at 20:05
  • 1
    \$\begingroup\$ You can do that with the solution at the link. Render one set of geometry with camera A, render another set with camera B. Then you get to pick and choose which subset of each is displayed on the player's screen. \$\endgroup\$ – DMGregory Mar 7 at 20:09
1
\$\begingroup\$

If I understand correctly, I think I came across a Brackey's youtube tutorial awhile back demonstrating a similar technique. You can have two completely different environments, but see through the door as if it's a portal. Thus you could set up your skybox-like magic dr.strange room, and your normal room and use something like this demo.

https://www.youtube.com/watch?v=cuQao3hEKfs

If not, I'd imagine you can achieve something similar with render textures.

If still not, you can get more complicated with camera layers and the new physics worlds api. But i'd avoid that if something like the Brackeys video is good enough!

Edit:

In case the video becomes unavailable, the process is as follows:

  1. Set up two identical rooms that aren't visible to each other. You can do this by putting them on different layers, and modifying which layers the player camera can see.

  2. In the center of each room you put a door. The door has a render texture and a trigger in the doorway. Each room has it's own camera which renders the view from the doorway into the other room onto a render texture. In room A's door, put the render texture from the camera in room B's door, so the doorway in room A is showing a view of room B. Do the same but the other way around for room B. Move the cameras around so as the player moves relative to the door, the view also changes.

  3. When you hit the trigger of the doorway, teleport the player and it's camera to the corresponding spot in the door of the other room. You probably also want to temporarily ignore the trigger so the player isn't immediately teleported back.

This whole effect gives the illusion of a magic dr strange door.

\$\endgroup\$
  • \$\begingroup\$ Right now this is essentially a link only answer - please summarize some of the key points covered by the tutorial. This way, if the video becomes unavailable at some later date, your answer will still be useful to others with similar problems. \$\endgroup\$ – Pikalek Mar 19 at 2:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.