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.

Alternative for 3D Skybox in HDRP

Discussion in 'High Definition Render Pipeline' started by wildspaceace, Jan 7, 2022.

  1. wildspaceace

    wildspaceace

    Joined:
    Jan 25, 2017
    Posts:
    5
    Does anyone know of an alternative to camera stacking when using a 3D skybox as a backdrop for scenes in HDRP? For example, an alternative to creating a small planet and moon next to a "background" camera to use as the backdrop to a main camera which is viewing the main scene with ships, stations, etc, thus creating the look of a very large scale planet as the backdrop to the scene.

    This is easy to do in Built-in and URP using camera stacking. But what about HDRP? (Considering the graphics compositor is not recommended for games)?
     
  2. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
    I couldn't figure out an optimized way to do it with multiple cameras/compositor/etc. I just ended up using one camera and huuuuuge planets moved far far away at the visual size I wanted, and then set the camera's far clip plane past that. In built-in, this would've caused shadow imprecision problems, but in HDRP it's not an issue, possibly due to camera-relative rendering.

    I also keep a fixed distance between the planet and the camera whenever the camera moves. I thought that translating the planets so far away from the origin should introduce floating point imprecision, but interestingly it's actually not noticeable at all.

    Not sure, but perhaps there's a way to do it with Custom Passes if you don't want to go through this route.

    Btw, check out this thread for more techniques:
    https://forum.unity.com/threads/render-far-objects-without-increasing-the-clipping-plane.929103/
     
    Last edited: Jan 9, 2022
  3. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    464
    Another solution could be to use your directional lights as they also share a cookie atlas for mapping.

    So long as you turn off the shadows for all but one of them, you can add circular shapes that fit in the Celestial Body > Surface Texture slot.
    Your Texture atlas will fill fast so be cautious of the pre-computed memory cost

    You can then set the angular diameter higher to show a larger planet in the sky and set the LUX depending on how you want to emulate distance and light contribution ( for a night scene for example.)

    Depending on your project you could even bake this down into an HDRI for more performance gains
     

    Attached Files:

    Matjio likes this.
  4. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    562
    Another solution would be to create your own custom sky starting from the documentation.
    You could have your planets as texture inputs and then place and blend them into the sky... etc