Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

window into another dimension?!

Discussion in 'iOS and tvOS' started by Kloper, Oct 1, 2014.

  1. Kloper

    Kloper

    Joined:
    Jan 28, 2014
    Posts:
    93
    Hi,
    I hope somebody can point me into the right direction with this problem.

    I wanna use an object as a window into another reality that is completly independent. Like a picture frame hanging in the middle of the room, you can move around the frame, you can move around in the room.. simple, but the picture inside the frame shows a completely different room. If you know Portal the game, you will know what I mean. its like having 2 different 3d envirements but you can see the otherone only thru the frame. Any idea how to accomplish that? is it even possible on a iOS device?

    Any little information will be helpfull,
    thanks!!!
     
  2. mbowen89

    mbowen89

    Joined:
    Jan 21, 2013
    Posts:
    639
    One way would be to have a second camera that captures an image of what you would see in the other dimension, and then apply that image to the window, like a picture frame actually.
     
  3. Kloper

    Kloper

    Joined:
    Jan 28, 2014
    Posts:
    93
    hmmm... sounds actually brilliant!!
    Ill give it a try.. Thanks!!!
     
  4. mbowen89

    mbowen89

    Joined:
    Jan 21, 2013
    Posts:
    639
    Let me know how it works! :)
     
  5. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,623
  6. Kloper

    Kloper

    Joined:
    Jan 28, 2014
    Posts:
    93
    perfect!!! :) Render Texture does exactly what I want!!
     
  7. mbowen89

    mbowen89

    Joined:
    Jan 21, 2013
    Posts:
    639
    So you just made another camera cull everything except another room that has it's own layer I'm guessing? Do you make the camera see that exact same perspective of the first then?
     
  8. Kloper

    Kloper

    Joined:
    Jan 28, 2014
    Posts:
    93
    My english is not very good and even tho I translated the word "cull" im not exactly sure what you mean. I didnt go too far, just made a test with 2 cameras and 2 objects. I applied the render texture to camera B and an object that the camera A is looking at, and you basically get a texture that shows what ever the camera B looks at. The only problem is that the texture is flat and you dont have the feeling of depth//space in it, but this can be fixed easily by just checking the player angel to the object and rotating the camera B (this changes the texture depending on players position), so the player has the feeling of depth and can look around a corner for example.

    I have nothing to show yet.. just playing around with a few ideas, but as soon as I have something Ill post it here.

    Btw. this is a Pro only feature, I dont know if there is a solution for this in unity free!
     
  9. mbowen89

    mbowen89

    Joined:
    Jan 21, 2013
    Posts:
    639
    Each camera has its own culling mask, meaning, you can select what layers the camera would actually see. I would put two camera scripts on the same camera, and have Cam1 show layer1, and Cam2 show layer2. That way your perspective is identical, but Cam2 is actually going to the rendertexture instead of the screen.

    When you have your scene setup, I'd have two different root objects, layer1 and layer2. Then its easy to disable one to work on the others setup in the world. Then enable both when playing, and each cam will only see the respective objects with their respective layers set.