Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Question about light intensity in HDRP

Discussion in 'Graphics Experimental Previews' started by SunnySunshine, Nov 6, 2018.

  1. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    676
    In HDRP, the unit of light intensity for a directional light is "lux". According to Wikipedia, lux is defined as "one lumen per square metre". Examples measurements of lux in different circumstances:



    When creating a new scene in Unity in HDRP, the directional light intensity is set to PI (3.141593), which according to this table equals something like civil twilight.

    The sample scene in HDRP has a directional light with an intensity of 10, which is something between civil twilight and "public areas with dark surroundings".

    The FPS sample project has a directional light source of 1,000 lux, which equals an overcast day/TV studio lighting. The entire scene is actually completely white unless a strong auto exposure is used.

    None of these are even close to the true lux of sunlight. When trying to use a realistic value, the scene becomes so bright that even with maxed out auto exposure settings, it's essentially just white.

    My questions is this:
    Why these intensity values?

    All these values (3.14, 10, 1000) are not physically accurate and seem rather arbitrary. If just taken out of thin air, why 1000 and auto exposure settings for that value rather than 10 and auto exposure settings for it? Is there any guide or best practices regarding lighting in HDRP? It all seems so confusing and arbitrary from the examples I've seen.
     
    zhuchun, florianhanke and TerraUnity like this.
  2. Onigiri

    Onigiri

    Joined:
    Aug 10, 2014
    Posts:
    88
    Wait for the upcoming HD Postprocessing which will implement physical camera properties. You will be able to use proper lux values with proper exposure settings.
     
  3. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    676
    Awesome! Where can I read more about this?
     
  4. Onigiri

    Onigiri

    Joined:
    Aug 10, 2014
    Posts:
    88
    hippocoder and SunnySunshine like this.
  5. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,844
    They had to use workarounds for FPS sample so you're not alone in wanting this :)
     
  6. GameDevCouple_I

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    2,153
    Wow I didnt realise that and had been scratching my head a bit on this, thanks!
     
  7. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,844
    It's in my breakdown on the FPS sample forum and Unity explained the rationale.
     
    GameDevCouple_I likes this.
  8. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    676
  9. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,844
    Oops sorry forgot link (thank you).
     
  10. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    462
    Hi,

    Regarding learning about physical light unit I recommend this talk form lighting in mirror edge 2 (based on frostbite and first game to really use our physical light unit). It explain why using correct value for sun is hard.
    https://www.gdcvault.com/play/1023284/Lighting-the-City-of-Glass

    if you want more detail there is also this document: https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf (section 2 about lighting)

    The main issue we have currently in Unity is that we miss pre-exposure and a correct auto-exposure that can span the range of real dynamic range. This is what is coming with Postprocess stack V3 and the result is that currently we must use wrong value that make no sense so users don't open a scene that is fully white...

    So the default of PI is due to this. Ideally we would like to default to 100 000 lux but we can't, and in practice we rather use 20 000 (see mirror edge talk).

    Why PI ? Because we use explicit Lambert formula (albedo / PI) instead of implicit (albedo) of builtin unity.

    And PI is of course not a right value but as we are sit on top of Unity, and as Unity was defaulting to 1, we are a bit in a trap and need to follow that path. The template of HDRP is at 10 for the reasons explain above, currently we can't use correct value or we will be fully white.

    Hope it make sense.
     
    Johannski, Mauri and SunnySunshine like this.
  11. tetto_green

    tetto_green

    Joined:
    Dec 22, 2015
    Posts:
    20
    Hi @seb
    Hello!

    Ehm... Why don't you hide this Lux drop-down then? Or show a warning or something? This feels carelessly right now...
     
  12. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    572
    This isn't a problem. Everything is setup properly now since 2019.1 and HDRP 5.x.x
    Everything above was an issue late 2018
     
  13. tetto_green

    tetto_green

    Joined:
    Dec 22, 2015
    Posts:
    20
    I see. I faced this problem using Unity 2019.1.12 and HDRP 5.x.x.
     
  14. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,679
    I've faced this issue by default in 2019.2.2f1 and HDRP 6.9.1. Completely blown out white scene by default. What is the proper way to make sure everything is balanced as it should be, setting the light intensity far lower than lux values?
     
  15. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    572
    Quick way - Not physically accurate but works
    - Set the Sky Exposure to 1
    - Set the "Scene" Exposure to 1 as well
    - Lights will have to be adjusted accordingly
    Everything should render as you are used to in the Builtin Render Pipeline or LWRP. Note using it this way you are in charge of calculating your own light intensities instead of using physical values.
    upload_2019-8-25_23-21-25.png

    Physically Correct or In that General Space
    - Open the Render Pipeline Wizzard and let it set up the defaults for you. Window -> Analysis -> Render Pipeline Wizzard in 2019.3 and HDRP 7.x.x This is in Window -> HD Render Pipeline Wizzard Select Fix All
    - Create a new scene and you should get a default scene with a lighting setup (The Lighting there isn't physically accurate but it gets you setup)
    - Change the values to whatever needed depending on the scene.


    Useful Links
    HDRP Docs on Physical Light Intensities
    https://docs.unity3d.com/Packages/c...finition@6.9/manual/Physical-Light-Units.html

    For the Sun/Directional light
    https://en.wikipedia.org/wiki/Daylight

    For the HDRI Sky or Physical Sky
    https://en.wikipedia.org/wiki/Exposure_value (Scroll down to the Chart Labeled Lighting Condition)

    For the Exposure/Scene Exposure
    - If you set it to Fixed then use the same value as the Sky EV/Exposure Value
    - If it's set to Automatic then set the Limit Max to the Sky EV and the Limit min to the brightest you want the darkest area in your scene to be. (If you aren't sure yet leave it at default)

    With all that done you have fairly physically accurate lighting.
     
    zhuchun, eizenhorn and konsic like this.