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

Skybox darkening with HDRP?

Discussion in 'General Graphics' started by coder_58, Jun 20, 2022.

  1. coder_58

    coder_58

    Joined:
    Mar 29, 2020
    Posts:
    31
    Hi,

    So I have this script attached to my camera in my scene:

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class ChangeSky : MonoBehaviour
    6. {
    7.     [Range(0, 1)]
    8.     private float AtmosphereThickness;
    9.  
    10.     // Start is called before the first frame update
    11.  
    12.     void Awake()
    13.     {
    14.         AtmosphereThickness = 1f;
    15.         RenderSettings.skybox.SetFloat("_AtmosphereThickness", 1f);
    16.     }
    17.     void Start()
    18.     {
    19.        
    20.     }
    21.  
    22.     // Update is called once per frame
    23.     void Update()
    24.     {
    25.      
    26.  
    27.         if (AtmosphereThickness >= 0.05f && InitialLaunch.highAltitude)
    28.         {
    29.             AtmosphereThickness -= 0.0005f;
    30.             RenderSettings.skybox.SetFloat("_AtmosphereThickness", AtmosphereThickness);
    31.             DynamicGI.UpdateEnvironment();
    32.         }
    33.  
    34.     }
    35.  
    36.  
    37. }
    38.  
    Basically, I put a skybox material in the environment tab in the lighting settings and it darkens over time after the player reaches some altitude. All of this is working just fine.

    However, I want to add volumetric clouds to my scene and I'm aware I'll need HDRP for that. I'm wondering how I'd be able to accomplish the sky darkening behavior with HDRP because afaik there's no option to simply drag and drop my skybox in the lighting settings but instead I'll need HDRI sky or something. I'm a bit confused here, so thanks for any help!