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

Large objects in the distance

Discussion in 'General Graphics' started by Comafly, May 16, 2017.

  1. Comafly

    Comafly

    Joined:
    May 30, 2014
    Posts:
    87
    Hi all. I am wondering what the best practice is for having large background objects off in the distance - such as mountains or planets, that won't change in perspective from the view of the player.

    I'm constructing a space scene, and I'd like to have a massive planet in the background. Right now I just have an enormous sphere way off in the distance, but it's not so far that the player can't see a change in perspective - which doesn't really sell the size. I feel like that is probably not the best way to achieve the effect.

    Here is an example from a recent game Prey



    I'd really appreciate any input/recommendations. Cheers!
     
  2. Comafly

    Comafly

    Joined:
    May 30, 2014
    Posts:
    87
    Well I just had a crack at this myself after a bit of thinking it over and came up with a solution!

    I created an extra camera in the scene and attached it to my player. So now I have:
    - 1 camera that renders the planets and skybox, set to a depth of -1
    - 1 camera that renders everything else, set to a depth of 0

    This way I can have the planet object super close to the camera, but it will always render behind everything else. Then I use a script to set the planets position to transform.position + the distance between the player and the planet. This gives the illusion of the planet not moving at all.

    And that's it! Super simple and works perfectly.
     
    Last edited: May 16, 2017
  3. Lost-in-the-Garden

    Lost-in-the-Garden

    Joined:
    Nov 18, 2015
    Posts:
    176
    Why not use a skybox directly? You can use a reflection probe in the editor to render a cubemap texture that you can then use as a skybox. Unless you go super highres with the cubemap resolution will not be what it is compared to rendering geometry directly, but the benefit is that you only have to render it once, and can even render it in the editor.
     
  4. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,469
    Or a skybox and many floating textures (just quad), you can even fake small rotation with a displacement shader ... That's how it is done up until you are close enough to land.