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

Question How can we change the Environment Lighting Volume profile on HDRP from a script?

Discussion in 'High Definition Render Pipeline' started by magehuntz, Aug 3, 2022.

  1. magehuntz

    magehuntz

    Joined:
    Mar 24, 2017
    Posts:
    23
    Hello. I am trying to change the environment volume profile (as in, the static lighting sky which will shine ambient lighting upon the scene) from code to create a LookDev tool for our artists. The thing is, I can't find anywhere in the docs how that could be accomplished.

    The closest I got to an answer was finding the class StaticLightingSky, which was apparently used as a regular component in older versions of HDRP (I'm using 10.6), but is currently unused or hidden.

    Since we are using a GradientSky with 3 colors, I thought using RenderSettings.ambientGroundColor, RenderSettings.ambientEquatorColor and RenderSettings.ambientSkyColor could achieve the same results, but they just get overriden by whichever volume is set inside the Lighting>Environment Window.

    Is there any way to set the Environment Volume Profile through code?

    Thanks for your attention.

     
  2. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    635
  3. magehuntz

    magehuntz

    Joined:
    Mar 24, 2017
    Posts:
    23
    I see, thanks for the reply. The thing is, our use case would be very specific to see how objects interact with one another, including shadows and post processing, so the ambient lighting would be but a small part of the final look. It's fine though, we can do a workaround, just wanted to make sure it's not there.
     
  4. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    635
    A word-around would be to directly change values/components in the volume profile that is assigned.