Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question [HDRP] How to access exposure value via script

Discussion in 'High Definition Render Pipeline' started by sebk99, Oct 11, 2023.

  1. sebk99

    sebk99

    Joined:
    Apr 15, 2020
    Posts:
    11
    Hi,
    I need to access the exposure value.

    I tried:

    Code (CSharp):
    1. Exposure exposure;
    2. if (volume.profile.TryGet<Exposure>(out exposure))
    3. {
    4.     float value = exposure.fixedExposure.value;
    5. }
    But this only works if the exposure is set to fixed. It will not change if the exposure mode is automatic for example.
    I need to access the value if the exposure mode is automatic or any other mode.

    I am using HDRP 14.0.8. Is there anything in this version or in a more recent version ?
    Thanks
     
  2. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    690
    The volume framework will interpolate the settings for the exposure, and if you work with fixed exposure the value that it returns is the one used for rendering.
    But if you use automatic exposure, you need to hook up in the render pipeline (with a custom pass for example) and read the exposure value that is on the GPU.
     
  3. sebk99

    sebk99

    Joined:
    Apr 15, 2020
    Posts:
    11
    Thank you for the answer.