Search Unity

Light/Exposure Adjusting Automatically - SOLVED

Discussion in 'High Definition Render Pipeline' started by urzathran, Mar 7, 2021.

  1. urzathran

    urzathran

    Joined:
    Sep 9, 2018
    Posts:
    7
    I've searched all over, but haven't been able to figure out what's going on. Possibly because I don't have the right terminology. Depending on where the camera is focused, the light level or contrast or saturation or I don't know what else changes dramatically. I'd like that to stop.

    I'm using HDRP in Unity 2019.3.9f1. I've been hesitant to update versions because so often there's a lot of recoding and retexturing when you do that.

    video of the problem: https://drive.google.com/file/d/1JBdrtpoTn8w5hxpOexZ2JuSScR-LLfyE/view?usp=sharing

    (if there's a way to imbed videos, let me know and I'll clean this up).
     
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,724
    Change exposure to fixed on your effects volume (or in HDRP Default settings) upload_2021-3-7_3-33-44.png
     
  3. urzathran

    urzathran

    Joined:
    Sep 9, 2018
    Posts:
    7
    It makes sense that it would be that. I don't think I've got any scene-specific post-processing, so I searched up the HDRP settings in my assets, and adjusted the default to fixed with no visible effect. In fact, I went through every post processing effect in that folder and turned them off, also without visible effect, which suggests to me I might not be hitting the ones affecting the scene. Am I in the wrong place? Is there a way I could tell for sure?

    upload_2021-3-6_19-7-10.png
     
  4. Deleted User

    Deleted User

    Guest

    Make sure you have a global volume in your scene with that settings asset applied. Also, exposure is set to automatic in screenshot. (I know it's irrelevant, but if you use HDRP maybe DO update to latest editor? 8} )
     
    urzathran likes this.
  5. urzathran

    urzathran

    Joined:
    Sep 9, 2018
    Posts:
    7
    Yeah, this is after I put the settings back, I was just checking that it's the right place. Exposure in Global Volume is definitely the right feature, props jmancoder. "Fixed" made it all white and (so far) my experiments with different values haven't changed that, but by changing the adaptation speeds on automatic, I can easily tell that this is the feature that's triggering. I'd certainly take some advice on any preset ideas, but now that I know what I'm dealing with I can also experiment.
     
  6. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    Adjusting the exposure of the HDRP is very difficult
    I spent a lot of time finding the right settings:
    2020.2 HDRP 10.x is better than 2019 HDRP 7.x
    Untitled.jpg


    Value limits:
    Limit Min : use between -6 to 0
    Limit Max
    : use between -2 to 1

    Color Grading Effects:
    Post Exposure
    : use between 0 to 3

    Notes:
    Limit Min
    is when you are looking the dark area
    Limit Max is when you are looking the bright area

    If your scene is completely white, try to disable reflection probes
    Also check the sky exposure

    For now try the Min -4 and the Max -2
     
    Last edited: Mar 7, 2021
    urzathran likes this.
  7. urzathran

    urzathran

    Joined:
    Sep 9, 2018
    Posts:
    7
    Nice! Thanks. For now, I ended up switching to "Physical Camera" exposure mode, which seems to be giving me what I want, but I'll keep this in mind if I find I end up needing to adjust exposure.
     
  8. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    I had a lot of headaches with the exposure in HDRP
     
  9. urzathran

    urzathran

    Joined:
    Sep 9, 2018
    Posts:
    7
    Yeah, it seems like something that needs a dedicated team member (at least) to do right. If I had any kind of budget and project timeline, I'd consider just hiring you, but this is a passion project. Trying to get a customizable 3d environment for tabletop RPGs.
     
  10. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    Hey guys, to learn more about how exposure actually works, you might want to look into this segment about exposure in this video tutorial about HDRP.


    I would really not recommend the settings given by @UnityLighting above, as these are very low exposure values (for very dark lighting scenarios). And I'd really stay away from using up to 3 stops of exposure compensation with a post-processing override: using that much compensation already indicates an incorrect exposure setup to begin with.

    Exposure is not that hard to understand, especially if you start with a Fixed exposure, as suggested by @AcidArrow in the first reply. For the video that @urzathran shared, a Fixed exposure seems to be perfectly acceptable (tabletop game, with fixed lighting intensity). I see you switched to the Physical Camera exposure: that's fine too, as the behavior will be the same as the Fixed mode in the end. But make sure you understand how aperture/shutter speed/iso work, otherwise you might shoot yourself in the foot if later you want to use physical-camera-based depth of field for instance. ;)

    If you use the correct intensity for your sun, it becomes very simple, especially in HDRP 10, since we added iconography and presets to make the process a lot simpler. See also this page, for how to use proper values based on the lighting scenario you're trying to simulate: https://docs.unity3d.com/Packages/c...inition@10.3/manual/Physical-Light-Units.html
     
    Last edited: Mar 9, 2021
    hippocoder, koirat and UnityLighting like this.
  11. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    Thank you for your video. This is most complete guide to HDRP lighting
    But i have a question
    In the real world, we have only a simple sky light (ambient) and a simple sun light
    What is the reason for all these hard settings in HDRP?:(
    We can achieve a realistic result with a simple ambient color and sun color in the Built-in pipeline and other software

    Finding a simple adjustment of exposure in HDRP causes headaches

    In VRay you can easily achieve the best and most realistic result by choosing the color of the sky light and the time of day.
    I advise you to focus on simplifying unity, not complicating it
    Currently, users get the best result in Unreal and Cry with the default settings

    The only reason users use UE4 is because of its simplicity of lighting
    You must prepare the default Unity settings for novice users
    But apparently the current HDRP settings are for physics and mathematics engineers

    The creators of Unreal and V-Ray are among the best engineers in mathematics and physics, but their users only see one skylight and one sunlight and one time of the day settings
     
    Last edited: Mar 9, 2021
  12. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    @UnityLighting You mentioned Unreal, and it has the exact same exposure concepts (ev100), like HDRP. There is nothing really new to the way HDRP handles physical units: it's already been the standard for several in-house engines for years. So I'm not quite sure why you'd think HDRP is special in that regard or more complicated. The volume system in HDRP shares some similarities with the post-processing volumes in Unreal (and many other in-house game engines relying on camera-based overriding systems). The same goes for the lighting intensities: you can just stick to EV for the local lights if you want a more "unitless" workflow, and not having to type in big scary numbers. And same for the sky: you just need to use the PBR Sky, and it'll be lit automagically by your sun. If you use "New Scene > Basic Outdoors (HDRP)", there is little to no setup required to get a sky and a sun. ;)

    If you have some precise advice on how we can make it easier for people to understand physical units, besides the existing documentation and what was already done in HDRP 10 with the iconography for exposure and intensity values, please shoot, we're here to listen.


    Some more precise context about physical units

    Nothing forces one to use physical values in HDRP (or Unreal, or Vray, or whatever modern engine that supports physical units), as long as one understands the concept of lighting contrast. For instance, I could set my sun at 42.5 lux, my exposure at -3/0.5 EV and use the PBR sky or an HDRI sky with an eye-balled exposure, and I could pretend all is well, and it'll look fairly close to the HDRP scene template actually which uses much higher, physically-based values.
    upload_2021-3-10_22-49-7.png

    But when it's time to balance the lighting with indoor/outdoor/cutscene lighting props from in/outsourcing providers, and to work in a large team of artists that need consistent lighting, you must adopt a standardized workflow for setting up your lights/camera/exposure. Otherwise, you end up with this kind of atrocities in the image below, where correctly tuned artificial lights are mixed with the very weak sun and sky from the example above.
    upload_2021-3-10_22-50-34.png

    Obviously, that image above is an exaggeration (though it's something I see frequently, with projects that don't necessarily understand how exposure and lighting work in real-life). But it shows that if you want to work in a larger team, you'll need to follow strict lighting conventions, and again, this is where physical light units can help. And it's just a matter of looking at a table of light and exposure values or googling the intensity of light bulbs: anyone can do that, you don't need to be an artist (we do provide extensive info about it in the doc and a practical cheat sheet with common lighting values); whereas carefully balancing the lighting with random values is not something easy and require some artistic sense and a lot more time.

    Having given workshops for beginners in lighting, I observe it's a lot easier for them to look up values in a table for intensity and exposure, rather than having them fiddling with a ton of different settings they might not understand. They can reach photoreal results in seconds in HDRP with just a correct light intensity and a matching exposure.

    But of course, if one is developing alone or in a very small team, I can certainly understand there is some overhead to force oneself to switch one mindset, but it usually pays out, in the long run, to adopt these workflows, especially if one deals with a wide range of lighting scenarios and want consistency across the board for natural and artificial lights.
     

    Attached Files:

    hippocoder, koirat and UnityLighting like this.
  13. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    Thank you for clean reply
    so i need to work a bit more on HDRP settings to find a proper way to use it
     
  14. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    You might want to upgrade to 2020.2 (HDRP 10) btw, you'll get the "New Scene > Basic Outdoor" scene template. It will already put you in the right ballpark, to begin with, with a PBS Sky, the sun at 130.000 lux, and a rough exposure range, so that you won't have to create these volumes manually and figure out which sun intensity to use.

    Also, I would really advise you to look at this table, as already mentioned above, from the documentation:




    It's nice to see you are experimenting with directional light/exposure in these 2 videos, but you seem to want to make your life much harder by not using physically-based values, It really doesn't have to be so complicated. :D
    Also, trying to expose for bright grey materials is not really representative of a common scene with much darker albedo. Point a camera in real life or in many game engines at a bright gray plane in full sunlight, and you'll often get odd results if you don't apply some compensation or clamp the exposure manually (that's why the limit min/max exposure settings are so important).

    For instance, in your first video, you're using an incredibly low exposure (-8.81) for no reason I can think of. That's the kind of exposure you need to create this kind of scene below (e.g. transforming a night scene into a day-light-looking one). If you look at the table above, -2 EV already is sufficient for a dark night. So, with -8.81, you'll make your entire scene overexposed (white) during daylight, and then I see you need to reduce the sun intensity as a result and doing some odd things to the indirect lighting. Are you really sure you watched this explanation about exposure and light intensities later in the video?
    upload_2021-3-11_12-20-47.png

    If you want to use the physically-based sky, stick to 130.000 lux for the sun and leave it there, as indicated in the table above. Otherwise, you'll just be constantly altering the way the sky reacts to the sunlight, and indeed you'll be fighting against yourself and have to constantly input odd exposures. And in HDRP 10, using "New Scene > Basic Outdoor" will do all of this for you automatically.

    One thing though: if you want to make a time of day (something HDRP doesn't support out of the box), you'll need to blend between volumes to handle the exposure nicely for different time of days, OR you'll need to use the curve mapping mode for the exposure (but that's quite advanced, I wouldn't touch it if I didn't understand how exposure work). Often in games with a dynamic time of day, there will be several fixed time slots/presets for the lighting/exposure/indirect, and as time passes, they will be blended between each other. That's very roughly how games like GTA5/RDR2/Horizon handle time of day for instance.

    So again, please don't input totally random values and expect the system to work perfectly. ;)
    You can still have a much lower sun intensity if you want, and you'll then have a tiny exposure range that might be easier for you to control if you have difficulty understanding how exposure works or if you simply don't want to have such a large exposure range for gameplay reasons for example (a big range is not always recommended for certain types of game where visibility is super important, like Overwatch/Valorant for instance).
     
    hippocoder and PutridEx like this.
  15. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    Thanks for this very detailed explanation
    I got better results working with HDRP 10
    Another problem I encountered was the value 0 in HDRI sky exposure, which causes the sky to disappear when activated. The default value must be 1


    I also have another question, why does Bloom not behave properly in HDRP? Like all other Bloom effects in Built-In or other engines
     
  16. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    Another question. My other problem was using :
    Code (CSharp):
    1.             GetComponent<Light>().intensity = intensity;
    o control to change light intensity in my Day Night cycle script.
    But now I realize that is wrong and I have to use this:
    Code (CSharp):
    1.             GetComponent<HDAdditionalLightData>().intensity = intensity;
    2.  
    What is the difference between the two?
    I know the second one is correct. But what happens when using the first code?
     
  17. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    HDRP piggybacks on the light component from Built-in, that's why this HDAdditionalLightData is needed.

    There is no good or bad exposure value. A sunlight sky should actually be at 13-14 EV for instance. 0 could be a night sky. Again, the lighting and exposure cheat sheet I posted above is there to help you. There are no "good" or "bad" default exposure values: it all depends on what you want to do. ;)

    Can you define "properly"? It's still based on a bloom buffer like every other system out there, and it works in a physical manner too. The bloom will work well when you deal with a correctly tuned scene though, that is, with a proper exposure and an emissivity that fits accordingly. If you expect a light bulb to glow massively in daylight, for instance, it's not going to work out very well, except if you push its emissivity beyond reasonable.
     
  18. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    I understood 90% of the work and now I can adjust the exposure of the scene based on the physical settings in HDRP without any problems. Thank you

    I will post tutorials soon to better teach new users

    About Bloom:
    Bloom just make the scene blurry when increasing intensity. Also does not works on emissive materials
    Watch this video:
     
  19. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    595
    Your continued input on this and work on this @pierred_unity honestly amazes me. firstly well done. :D

    Secondly, i can't help but feel that a lot of users that have never dealt with physical properties; cameras, lighting etc tend to not correlate between unity lighting steps and what you mentioned here.

    indirect lighting process/baking vs Realtime especially, seem to confuse many, even with somewhat ignoring important words almost Post-process and the difference between a directional light and an HDRI and what each effects, mostly because they're eye balling several different processses over direct/indirect and pp, hence your mention of doing more than you need to.

    Coming from a film and lighting background, i've personally found it difficult to not use a physcially based process, prior Pipelines and RPs of unity would go way over my head when translating my base lighting knowlegde, so there may be this discrepency with previous version users as well but in an opposite manner.

    Your words here and the unity video are just so useful for people and have immense learning value i still feel there is a moment waiting to happen for them to litterally ping a light bulb above their head.

    That being said, i feel like a small but full A-Z lighting proceess video would help people move in a more production thought process when it comes to lighting in HDRP ( or anything that uses physically based properties), the new demo scene would be perfect for this, as it's center focuses most certainly include the volume framework exposure for indoor/out

    -- the whys--
    lighting PBS HDRI
    Exposure
    Direct / Indirect
    RT vs Baked ( probes)
    post process and when
    -- and the the creative options, like you dont have to follow these as rules, BUT be aware of them--

    I feel like that Would full circle reinforce your words here and the high fidelity lighting video that covers just so much as well, would aid to cover where shadows and the rest of the detailed expsoure explination would go.

    It would probably brings many things upto date as far as an intuitave single place to get a high fidelity breakdown for what will be a very similar process for some time in unity editor flow too.

    i know it sounds silly to A-Z it since it's not always the case, but it's the only thing i can personally see when people aren't graspong the process as easily.
    i feel i can almost here your worlds saying " why are people not grasping this yet ?!"

    I do hope that helps some.
    all the best and keep up the fantastic efforts.
     
  20. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    @UnityLighting Again, it's because you haven't tuned them correctly. 13.47 nits like you have in your scene is very, very low. For comparison, a decent HDR TV for instance produces at least 1000 nits nowadays. Btw, you can also use EV instead as a unit, again following the same principles as exposure (see lighting cheat sheet).

    When you see a unit, like Lux, or EV, or Nits, it's always a good idea to figure out what it means and where to find the data you need.

    To make an analogy: It's a bit like if you had a car weighing 1651 kg. But let's pretend you don't know what a kg is, and you don't want to move the slider beyond 16 kg for some reason. Then all the physics systems in your game won't react properly. It's exactly the same principle for lighting: units have a meaning. ;)

    The bloom in HDRP is physically correct: if you don't have a strong emissive source and the local exposure in the image is low "contrast", nothing particular will bloom and the whole image will become bloomy/blurry as a result. Again, this works as expected, in a very similar fashion to a physical camera. But we sill offer a threshold, which can cut some of the bloom in dimmer part of the image.
     
    Last edited: Mar 11, 2021
  21. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    I realized
    HDRP is completely physical and no personal settings can be used;)
    In Built in everything worked in the range of 0-1
    And in HDRP, each part has its own settings based on physical range
     
  22. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    595
    /

    Hey @UnityLighting
    sorry to continue to jump in here but
    one super important thing mentioned above


    ignoring the bloom post process for a second, your emission is set to ~6nits
    this is 6 LUX m2

    in the scene that you have, you're very unlikely to see emissions in that kind of out door light.
    a modern phone outside in daylight probably around 700 nits at it's absolute best so firstly set your emissions occordinaly to what the object is too.
    You're in the shade so that should also apply that the 700nits would take some effect if you were for example making a phone screen glow.

    onto bloom post process
    the value have always reactive that way

    Threshold being tied to the law of conservation of energy which is a physics and chemestry law. ( mentioned in tooltip)
    this filters pixels under darker than it's bright point
    Itensity, this is essentially a full screen blur.
    imagine you breathing on a camera lens and then taking a photo, similar effect.

    this has a physical baseline to create and simulate an effect found in lens', but it is also still a post effect, a creative touch if you like.

    Hope that helps some.

    EDIT: i realised you both wrote back before i even finished.
     
    UnityLighting likes this.
  23. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    Thank you, much appreciated!

    I'm planning on doing another video of the same type for HDRP 10 (or 12), and I'll go into more details for the whole dependency between light sources and exposure.

    Teaching is an important part of our role as tech artists, so it's no worry. I've given several workshops to ultra beginners with no lighting experience, and they had no problem understanding these concepts and look up a value in a table. It's usually people who have a long experience with "fantasy units" workflow that have a bit more trouble adapting to these industry standards (at least in the AAA game industry). ;)
     
  24. Gokcan

    Gokcan

    Joined:
    Aug 15, 2013
    Posts:
    289
    @pierred_unity
    I really enjoy reading your posts. Please keep going teaching us:) I wonder your next video
     
  25. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    233
    I never really accomplished satisfying day/night cycles in combination with the PBSky, regardless how I mix and match different volumes and exposures. It leads back to an exposue/luminosity issue in the PBS implementation itself, which becomes obviously visible at dawn/dusk when the sun is a few degrees below the horizon.
    An example for the said issue can be found here; https://forum.unity.com/threads/physically-based-sky-issues.1048391/#post-6782045

    Is there any attempt to fix it in the near future?
    Otherwise it's impossible to implement a proper time of day system, unless you roll out your own sky renderer or use a third party one.
     
    HIBIKI_entertainment likes this.
  26. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    Hey, yes, we're aware of the issue around twilight (the strong yellow tint on the horizon). It can be mitigated with reducing the sun intensity around that time of day, but indeed it's not optimal. There will be improvements in the future, but I cannot give you a precise ETA or HDRP version.
     
  27. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    595
    @SebLazyWizard i've seen your input elsewhere in pbs, really impressive inputs.

    At this current time trying to simulate dusk/dawn blue hour, has been are hardest challenge too.
    more often than not if you're taking stills of this you'll be doing long exposures for the most part ( especially at blue hour).

    This is probably the main area that i may use exposure compensation to fine tune or limit the directional, just like when taking photos of scenes like this, i would be using expsoure compensation and exposure bracketing, to keep control of this.

    now this is obviously not a still so i've let a few things be flexible there as you could compare video/timelapse/photo all day in this and get a vastly different experience from them all.

    im guessing from your other post that your screen shot was roughly -12 <> -4 for the sun horizon position?
     
  28. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    233
    It's fine to about -6 degrees, after that the bright "blob" around the sun starts to appear and finally disappears at about -14. This all depends on the camera elevation too ofc.
     
    HIBIKI_entertainment likes this.
  29. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    595
    Yeah that is certainly as Pierred had mentioned.
    Nautical twilight period.
    If I remember, when PBS first came out it treated < 0° axis a lot differently, I'm guessing this was with the idea that a night sky would replace a day sky differently, maybe hemispherical rather than 360 for whatever technical limit might have been in place there.

    I'd certainly feather just beyond your sun rise/set volumes a little more than physically at this point just to compensate.

    Again back to photography, it's super common to use longer exposure times here anyway, to be more creative and impactful on what essentially is just too much dynamic range for a camera.

    Blob orange it is! Heh.
     
  30. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    Could you please share the settings for this scene, would love to create something like this, when I try this I'm not really sure about how low the light intensity and what the exposure of the sky emission should be?:oops:
     
  31. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    I recorded a short video about how to quickly set up exposure settings for HDRP scenes.
    This video is the result of the above discussion, which helps you adjust the exposure settings in HDRP without any hassle:

    The used asset free
    Amazing free hdri sky box

    The logic:
    You must add 4 components to the volume and balance them for every scene :
    - Visual Environment
    - HDRI Sky
    - Indirect Lighting Controller
    - Exposure

    In the future i will upload another video to show you how to use other components in HDRP (volumetric Fog, Color grading settings)
    Untitled.jpg
     
    Last edited: Apr 22, 2021
  32. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    Isn't that HDRI exposure and indirect diffuse light multiplier a bit high?o_O
     
  33. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    The settings on the above image is during tutorial
    The correct values are:
    Sky exposure: 10~14
    Indirect 1~5
    1.jpg
    2.jpg
     
    Deleted User likes this.
  34. Plazmeer

    Plazmeer

    Joined:
    Feb 23, 2022
    Posts:
    1
    This fixed my problem thanks!