Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

"Infinite" Camera View using 2 cameras trick

Discussion in 'General Graphics' started by JP-Games, Jul 6, 2018.

  1. JP-Games

    JP-Games

    Joined:
    Feb 13, 2016
    Posts:
    3
    Hello, I'm searching a way to render far planes with the camera. I searched a while and I come with this post that help me a lot, but I have a problem.
    Using the same settings as the post, I get that the secondary camera (the far one) renders over the primary camera (the close one).
    Here is an Image:



    As you can see, the Secondary Camera cuts the interior of my Aircraft, that's because the near clipping is so high (1000). But if I disable the Secondary Camera leaving the Primary alone, I can't see the water far away (that is because the primary camera is between 0.01 and 1000).

    Here is my Hierarchy and my Secondary Camera:


    Thanks for the help
     
  2. hjohnsen

    hjohnsen

    Joined:
    Feb 4, 2018
    Posts:
    67
    Don't you have a problem with your rendering order of cameras ? Try to change the 'Depth' value from 1 to -2 for example so that it is drawn before your cockpit, your cockpit is probably the last thing you want to render.
     
  3. JP-Games

    JP-Games

    Joined:
    Feb 13, 2016
    Posts:
    3
    Thanks for your reply.
    Sadly I tried that before. If I do that, the Secondary Camera will not render at all, so if I go very high, the water Will not be visible as the primary camera will only go until 1000.
     
  4. hjohnsen

    hjohnsen

    Joined:
    Feb 4, 2018
    Posts:
    67
    Your cockpit camera should only be displaying (with the cull mask) the cockpit object and have like 0.01 to 10 for near and far planes. This one should be rendered in second.
    Your out of window camera shoud only render (with the cull mask) the terrain/water and could use like 10 to 100000 for near and far planes. This one should be rendered first.
    Your cameras should share the same position / orientation.
     
  5. JP-Games

    JP-Games

    Joined:
    Feb 13, 2016
    Posts:
    3
    Sorry for the late update.
    Finally I managed how to set my cameras:

    The primary camera (Cockpit view) has Depth Only and a Clipping of 0.01 to 1
    The Secondary Camera (Near View) has also Depth Only and a Clipping of 1 to 1000
    And the Third Camera (Far View) has Skybox and a Clipping of 1000 to 1000000

    With this I can see the Cockpit, the plane and the water without any problem.
    Also I had to modify the Water Script from Standard Assets to render only with the Third Camera (that one with the skybox), otherwise the water could render multiple times making a sickness effect.

    Anyway, Thanks you so much for the help!