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.

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:
    924
    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.
     
  2. Onigiri

    Onigiri

    Joined:
    Aug 10, 2014
    Posts:
    388
    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:
    924
    Awesome! Where can I read more about this?
     
  4. Onigiri

    Onigiri

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

    hippocoder

    Digital Ape Moderator

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

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,761
    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:
    29,723
    It's in my breakdown on the FPS sample forum and Unity explained the rationale.
     
    MadeFromPolygons likes this.
  8. SunnySunshine

    SunnySunshine

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

    hippocoder

    Digital Ape Moderator

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

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    925
    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.
     
  11. tetto_green

    tetto_green

    Joined:
    Dec 22, 2015
    Posts:
    32
    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...
     
    burningmime and landonth like this.
  12. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    789
    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:
    32
    I see. I faced this problem using Unity 2019.1.12 and HDRP 5.x.x.
     
  14. JamesArndt

    JamesArndt

    Unity Technologies

    Joined:
    Dec 1, 2009
    Posts:
    2,892
    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:
    789
    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.
  16. Paris_iw

    Paris_iw

    Joined:
    Feb 10, 2020
    Posts:
    4
    Hi everyone,

    I am new to unity. I am an architect and I am using unity to conduct a research experiment. I need to evaluate the lighting level on a surface now that I have set up my scene. Does anyone have any idea how I can do that?
    I am not using HDRP but I realize it works with physical light values, should I switch to that?

    I need lux values or values that I can rely on to translate them into lux.
    I will be grateful if anyone could help me
     
  17. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    789
    Yes, you would have to switch. HDRP is the only renderer for Unity that uses physical light values.
    - Lux (for Directional Light/Sun/Moon)
    - Lux, Lumens, Candela, Ev 100 (for Point/Spot Lights)
    - Lumens, Ev 100, Nits (for Area Lights)

    Have a look at these guides

    Docs
    Physical Light Units and Intensities
    - https://docs.unity3d.com/Packages/c...finition@7.1/manual/Physical-Light-Units.html

    Blog Post
    How to set up Unity’s High Definition Render Pipeline for high-end visualizations -
    https://blogs.unity3d.com/2020/01/0...-render-pipeline-for-high-end-visualizations/
     
    Paris_iw likes this.
  18. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I also recommend URP if you want to target general mobile devices such as working in the field with an ipad or something.

    Both pipelines are PBR and backed up with shadergraph. HDRP is very high end presentation with raytracing support (new nvidia cards only) and URP will run on anything..

    Both happily support PBR and baked lighting though.
     
    Paris_iw likes this.
  19. Paris_iw

    Paris_iw

    Joined:
    Feb 10, 2020
    Posts:
    4
    Oh! Thanks a lot for your help and reply.
    Does it allow measuring the lighting intensity of a combination of lights in an area as well?
     
  20. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    925
    Hi,

    Not exactly, there is 2 debug mode in the Render Pipeline debug that is: Lux meter and luminance meter.

    upload_2020-2-12_17-56-58.png

    You can enable one or the other, then with the color picker mode you will be able to read the value on the screen for both of this mode. So it is per pixels and not per area.

    upload_2020-2-12_17-57-38.png
     
    Paris_iw, TerraUnity and fuzzy3d like this.
  21. zeropointblack

    zeropointblack

    Joined:
    Jun 8, 2020
    Posts:
    189
    so i recently upgraded from 2019 to 2020, and i noticed my Sun has a cool new preset slider. except anything above ALL THE WAY DOWN, is completely blown out white. im obviously assuming, for good reason, that my project has been corrupted. the only way i get good lighting previously, was just to eyeball the anything-but-lux settings myself and artistically choose what looks good.

    but this super cool, new and helpful (AKA completely worthless) slider has my attention. should i just ignore this like everything else? or USE IT? i need help. i cant figure out why a cloudy overcast setting has my scene completely WHITE, unless i ruin all of my exposure settings? is that DESIGNED to happen? or is my project BORKED.

    any help would be much appreciated. thank you.


    EDIT:
    ADDITIONAL QUESTION:

    in all honesty, what is with the weird CG world attempt of realistic settings like lux and kelvin. i never understood in decades ago when 3ds max tried implementing it. real numbers never match or look good, and just waste your time. give me an easy to use SLIDER from 0 to 100 or even 1000, and get out of my way. why am i fumbling with BS lux settings which have NO weight whatsoever in the CG world, and now trying to balance it out with exposure? is this a CAMERA? nope. its a screen and a CPU.

    so heres my question, is there any benefit from all of this? and i dont mean trying to cheat by copying light bulb settings, not sure why id need to do that anyway, im an artist after all. arent you? of course you are. why else would you be here.

    is there any REAL benefit? does cranking everything up, just to level it back out again make the highlights look better? or normal mapping? there has to be something. if not, why bother. just a waste of time. like this post.
     
    Last edited: Jan 12, 2021
  22. Hannibal_Leo

    Hannibal_Leo

    Joined:
    Nov 5, 2012
    Posts:
    551
    I am just so confused right now ... I have absolutely no idea how to set the values.
    Using the HDRI Sky seems to change everything because the sky itself has a multiplier, meaning the "default value" or the amount of lightning it should contribute to the scene is with a multiplier of 1.
    Turning up the Directional Light to ~100k lux and the exposure accordingly makes the HDRI sky just black (with a multiplier of 1)

    I adjusted the value of the HDRI sky, so it is visible but noticed some problems with the additional shaders that come with HDRP example files, such as LitDistrotion - this thing is just pure white with the high value setting (sun at 100k lux).

    Now reading this thread, which goes from "not possible, use wrong values" to "this works now" - I still feel like everything I set is just wrong.

    Downloaded some HDRP Model Assets recently and they use a directional light value of ~20 lux, after building some levels with the asset, I noticed that all emissive spots are completely missing, the only way to make them visible again, even in areas within shadow, is to reduce the exposure-scale of the emissive texture slot (in the hdrp lit material) to 0, so it is not affected by the very high exposure.

    All other lights do not match either, I googled up some light bulbs and set their values - they are just invisible with this HDRI Sky & Directional Light Setup. So something has to be really wrong here.

    Because we need the distrotion shader and because everyone else seems to use just wrong values and makes their assets like this, I think I will change the Sun to 20 and the HDRI back to a multiplier of 1, with auto exposure around -2 to 2.

    But if anyone has some advice on this, I'd be very happy.
    And please, unity, give us some hints on how to set the values, somewhere in the docs - a full setup of HDRI Sky, Exposure, Directional Light and some indoor area with artificial light sources on one page - or a proper example with these level-areas and lights (in one scene).
     
  23. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    9,016
    My $.02: Well, if you want to follow Unity's recommendation, just open up the new default scene. They have set up a complete scene where they showcase an open "room", a semi-open room and a completely closed room. You can study the lighting setup right in the editor and you can bring in your assets and you can test them how they look in an officially lit scene.
    https://blogs.unity3d.com/2021/01/07/explore-learn-and-create-with-the-new-hdrp-scene-template/

     
    fuzzy3d likes this.
  24. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    485


    If you have a lighting in video/photography background already then lighting in HDRP already comes pretty naturally.

    But for those who are transitioning or honestly new to how lights work then this unity in-depth has a great segment on exposure plus other quality fundamentals that are worth studying up on if it's not your particular field.

    It's worth noting too that it's perfectly fine to rely on another's skills and knowledge, Swiss army people in this industry are extremely rare.

    Keep it up all.
     
  25. Hannibal_Leo

    Hannibal_Leo

    Joined:
    Nov 5, 2012
    Posts:
    551
    I've watched the whole thing twice, first time when I installed HDRP and we got strange results.
    Second time after a few months, where I tried to do some lightmapping.
    Still have no idea, as the Shader "Shader Graphs/ParticleUnlitDistortion" (which comes as an additional package to HDRP, right in the PackageManager and was not modified by me) is just pure white.
    We need the effect for some cool heat & shockwave effects, so I tweaked the lightning, so the shader works.

    Also why would I use a HDRI Sky Multiplier of something else than 1 ? "One" seems like a default value for a multiplier?
    And if I set it to "One", the directional light to something around 10, the shader works perfectly, exposure is around 0 (which to someone not knowing anything about photography seems like the default value too - I know already it should be something like 12-14 or so) and it works.

    Personally, I don't care if real values are used, I just want to make a game, not any kind of real life simulation, so I'll stay with these low, unrealistic values. I can't even see any difference in the scene itself, to me, it looks exactly the same. oO
     
  26. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    9,016
    Then you don't need HDRP.
     
    fuzzy3d likes this.
  27. Hannibal_Leo

    Hannibal_Leo

    Joined:
    Nov 5, 2012
    Posts:
    551
    URP has quite a limited feature set - is SSAO even added at this point? What about contact shadows, micro shadows, Decals, SSR, ...
    Standard Pipeline has no shader graph and is missing a lot of other features too - when working on a game with an realistic artstyle, HDRP seems like the correct choice, even if it's not an architecture visualization or a car-advertisement demo.

    "Need" is subjective, no one really "needs" good graphics :p

    Also it was stated nowhere that HDRP can't or shouldn't be used for games - I'd just like to know if the shader ("Shader Graphs/ParticleUnlitDistortion") has issues or if these are actually the values that should be set, when using the HDRP for a game project.
    The shader itself is pretty basic, it just takes the scene color and moves the pixels around but when the scene color is pure white to a shader, idk ... it seems wrong to me.
     
  28. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Your choice of HDRP or URP has *nothing* to with realism. Both are capable of near-ground truth physically based shading.

    Instead your choice of pipeline is 100% only and ever only, to do with your target hardware if it is applicable. The fact is nobody is deploying HDRP games to switch or mobile or even VR if they have any sense, and a large amount will still pick URP for console games, purely because they want to PORT it without any issues.

    So you pick your pipeline based on where your product is intended to go, not based on the final pixel quality, since the fact is HDRP simply isn't going to go to a lot of places, while URP will.
     
    Lurking-Ninja and fuzzy3d like this.
  29. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    9,016
    Simple: the target hardware you intend to deploy on can handle HDRP AND you want to use the features HDRP offers: you use HDRP, if any or both of these aren't satisfied, you go back to the available choices and choose a more suitable one.
    I got the impression that you don't really care about HDRP feature set, so I advised you don't need it. You can create arbitrary good looking stuff in URP or in built-in renderers too. HDRP's most strength comes from the nature of the values you can set in them: they can be physically accurate initially (then you can make the artistic choice to change them, but that's another question). Up until the point of my answer you haven't mentioned a single HDRP feature you care about, you only told us that you don't care about physically based setup.

    There is no "correct choice" if you don't know what you're doing and what you're choosing and what you're choosing from.
     
  30. Hannibal_Leo

    Hannibal_Leo

    Joined:
    Nov 5, 2012
    Posts:
    551
    Right now it's far too late to think about this decision, the project started almost one year ago, somewhere end of April 2020, we have a big beautiful world with lots of details that shine thanks to micro shadows and other features.

    Yes, I didn't talk a lot about the feature set at all because, this post is not about choosing a render pipeline for a project but rather understanding why a shader that comes with the pipeline itself, simply doesn't work when using real life values. And why every asset developer seems to use low values too. And why the HDRI Sky multiplier of "1" is not a default value (when using exposure of ~13).

    As said, the shader works with a setup where the HDRI Sky multiplier is set to 1 and the light is tweaked accordingly (somewhere around 10).
    Thats quite strange and to me, it seems like this is the setup for anyone who wants to use these kind of particle shaders = to anyone who wants to make a game.

    Sorry if I was quite defensive or offensive? idk, wasn't ment to offend anyone ^^ I am grateful for every answer I get as theres always some valuable information. ^^
     
  31. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I actually think HDRP's strength is the fact it's all realtime and raytracing only adds to that.

    While on URP you can get an identical looking scene but it's all going to be baked right down.
     
    fuzzy3d likes this.
  32. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    485
    Hey thanks for getting back.

    Sorry that i dont have an answer to all of this, but the fundementals you mention at the end real value vs fake values = same results, it's just mostly to do with a baseline achor point for you and teams.

    it's not that you HAVE to use real values, it just makes it easier if you use more complex lights or decoupled systems ( like clouds for example).

    if you do set a baseline for realistic values then put your systems with lighting involved ( other lights clouds, FX, Bloom, volumetrics) you can use measured values to aid getting the look you're aiming for and actually know what those values are in many cases.
    When it comes to rendering and baking you'll know what to expect in return also and wont be surprised by something crazy going on.


    If you have an lighting art or film director ask you to drop a scene by 1 ev to match their reference ideas you wouldnt really know how at this point if you didnt already set a baseline.

    You could arguably also consider this very similar to how 'Units' are set in game. unity units are agnostic so its completely up to you how you set your units and then send you art team then info for Uvs texals and modling scalem unit = mm cm m km etc etc.

    This lighting concept would be the same. set your lighting baseline accordingly and send the " baseline unit" to your lighting team so they know the measurements they're working with. and if they have to convert said measurements, they can.


    In any instance as you're defining your project outlines and framework these are some good guidposts to help to decide and unify end render goals for you and your team.

    Hope that helps some
     
  33. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    1,969
    I chose HDRP because I needed volumetric light, and also I did not want to be surprised that I'm not able to have some feature later in production.
    I'm aiming at desktop/console.
     
  34. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    9,016
    I see, what you are saying, however it is still super-weird to me that you're ready to throw away your entire reference-system for one shader. Instead of finding out what's wrong with it. Not to mention that distortion is an effect, which can be recreated even in VFX Graph.

    I'm not big on shaders, especially not with particles, so probably won't be able to help too much. My advice is to try to get help here. @richardkettlewell is a great guy, friendly and helps forum-people very often. And if I'm not mistaken he wrote these shaders too, he may be able to find out what's wrong in your case.
     
    Last edited: Feb 11, 2021
  35. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,166
    Hey, I wrote this shader. I confess that I’m not an expert on HDRP’s lighting - my goal was to provide a simple way to use Particle Systems with HDRP, and the feature-set users from built-in were used to, eg the distortion effect you’ve found. So I might have done it incorrectly. I only tested a few basic scenarios.

    There is a lot of text in this thread and Ive tried to read to understand, but could you repeat your issue in a concise way so I can be confident I understand? Then I can try to help some more.
     
    HIBIKI_entertainment likes this.
  36. Hannibal_Leo

    Hannibal_Leo

    Joined:
    Nov 5, 2012
    Posts:
    551
    Well, I am confused, thats the issue xD

    Lets define what I mean when I say "real world lightning". This basically means a directional light set to a value of around 100.000 and the exposure set to ~13

    And unrealistic / low values / fake lightning means the directional light set to ~10, exposure around 0.

    1) HDRI Sky can be set to "multiplier" and I would assume that "1" is a default value for such a multiplier. Well, "1" as value makes the sky basically black when setting the scene to real world lightning.

    2) When I set the light to real world lightning values, the shader is pure white.

    3) Assets from AssetDevelopers on the store come with example scenes using unrealistic light values. Taking those assets and putting them in a scene, set to realistic lightning values, a lot of readjustment is needed. Adjusting Emissive Intensity in every material and adjusting every light thats inside a prefab of the asset.

    And all three of them work fine with low, unrealistic values for the lightning. Therefor my assumption: low unrealistic values are the go-to for GAME Projects, while real world lightning is meant for OTHER Projects, such as Film, ArchVis, Static Renderings, Car Advertisements, Render Demos, ...

    BUT this is not mentioned in the docs.
    Actually when reading the UnityBlog and some Threads on the forum - there are posts where Unity Devs say, that realistic values just don't work and some where they say that realistic values should be used because thats how the HDRP works and was designed for.

    And by the way, your shader is awesome! (when used with unrealistic lightning values) ^^
     
  37. Flow-Fire-Games

    Flow-Fire-Games

    Joined:
    Jun 11, 2015
    Posts:
    305
    Hey its not that bad
    It only took us around 6 months to be 70% sure about being correct on our light setup
     
  38. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    1,969
    So what is your secret ?
    Recently I again reached the lighting problem.
    To be more precise I wanted to dim the scene in linear fashion from lit to complete darkness.
    My directional light is 100000 lux it affects ambient light, but the ambient starts to get dimmer around 0.5 lux.
     
  39. jake1025

    jake1025

    Joined:
    Mar 1, 2018
    Posts:
    5
    Does anyone know if there's a way to read these values at runtime?