Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Exposure and light in HDRP - how to manage unreasonably bright and dark areas.

Discussion in 'High Definition Render Pipeline' started by PutridEx, Dec 7, 2021.

  1. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    Let's start with pictures:
    (1):
    upload_2021-12-7_15-37-12.png

    (2):
    upload_2021-12-7_15-37-41.png

    Directional light is mixed, 4/5 bounces.

    That room should be completely lit, a small opening half the size of that in any room will make it look fairly bright.

    (1): Why is it so bright outside when looking from inside the room? (I understand it's exposure) When I look at a window in my room, even at peak sunlight with a dark room, it looks nowhere that bright. How do I solve it? Fixed exposure doesn't help since if you get the right value for the exterior, interior will be a mess.


    (2): It makes no sense that the interiors look this dark outside. It looks very off, now when your entering with automatic exposure it slowly shows light magically appearing even though it looks pitch black a second ago. I understand it's because of exposure, but this doesn't feel realistic. There's a massive hole, the whole room should be lit to the moon.

    I used a reflection probe otherwise the ambient light acts as if there's no obstructions.
    How do you deal with this? Are reflection probes the only answer?
    I for example might not want this crazy exposure effect, i want it to be subtle or not there at all. In Built-in/URP for example, when you look outside of a room, it looks fine -- same with outside looking in.

    I understand it's caused by the physical lighting, but i must be missing something since this isn't realistic (hence hoping someone helps me out here).
    I understand the benefits of exposure and realistic lighting, but this has been really haunting me and I want to know how to go around it.
     
    Last edited: Dec 7, 2021
  2. LumaPxxx

    LumaPxxx

    Joined:
    Oct 3, 2010
    Posts:
    340
    You need to adjust your lighting setup.
    the default setting in HDRP is for an extremely clear sky which is very unusual in real life.

    to me,this is more like real life:
    lower down your sun intensity from default 100000 to 30000-50000,
    increase the exposure value of your physically based sky from 1.0 to 1.3-1.7
    lower your exposure high value from default "13" to 12-12.5.
     
  3. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    Thanks, although the problem is still the same.
    Pitch black from outside looking in
    upload_2021-12-7_17-8-19.png

    and exterior is extremely bright inside when not focused at the exit
    upload_2021-12-7_17-8-52.png

    I understand it's caused by exposure but how do you get correct lighting while getting rid of these two problems/effects.
     
  4. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    233
    What you see is how a camera captures light, not a human.
    This is the whole concept of HDRP, it simulates a camera.

    Humans perceive light intensity in a logarithmic scale (cameras do it linearly), so in order to simulate human vision you have to create a custom post process which manipulates the final color output based on each pixels luminance.
     
  5. LumaPxxx

    LumaPxxx

    Joined:
    Oct 3, 2010
    Posts:
    340
    Well,this looks normal to me...
    the walls of your "room" are all dark colored,so you won't get too much light bounces in your room.
    the light entry for bounces is a bit too small and too flat,only a small part of ground could do some light bounces for your room and the part received the first light bounce is the ceiling with dark color.
    and you are expecting the side walls and floors to get those light bounces...

    SebLazyWizard is right,the light intensity in human eyes and cameras are very different,all you can do is adding some artistic tweak for lighting.
    there are some ways i can suggest right now:
    1.increase the light bounce intensity in baking setting.
    2.stop to use only pure light bounce for your room.
    3.open some windows for your room.
    4.change to some brighter color for your room, especially for the ceiling.

    and if you could:increase the exposure low value from default "-1" to 8-10 could be a bit helpful.
     
    Last edited: Dec 7, 2021
  6. Kadae

    Kadae

    Joined:
    Dec 7, 2013
    Posts:
    52
    You need to use 2 volumes for each area.
    1 Global Volume for the outside area and 1 local volume with Proxy Volume.

    I'm a noob in Unity, but it's all I know about this problem.
     
  7. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    233
    What tonemapper are you using?
    Note that ACES furthermore darkens low illuminated areas, so try to stick to the Neutral tonemapper if that helps.

    A quick hack to fake light sensitivity of the human eye is to bring all your light source intensities down to a logarithmic scale, so light_intensity = log2(real_light_intensity).
    130000 lux of the sun then reduces to 11.775 lux, this hack however wont result in physically correct lighting, but it's way simpler than writing a custom pass/post effect ofc.

    That won't help anything in this case, since you need to properly simulate indoor and outdoor scenarios at the same time.
    Different volumes can be only really used in fully encapsulated areas, which isn't the case here.
     
    PutridEx likes this.
  8. Lex4art

    Lex4art

    Joined:
    Nov 17, 2012
    Posts:
    445
    Seems that auto exposure adaptation range set too wide for desired result - if you can provide its settings screenshot it will be easier to tell, but in general it's about making "Limit min" and "Limit max" parameters closer to each other.
     
  9. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    Hey, I wouldn't really recommend any of these solutions when trying to stick to physically based lighting: the light intensity or the assets themselves shouldn't be hacked to fit the lighting, that's not good practice and it doesn't scale. Otherwise, one might just stick to unphysical intensities, with ~10 lux for the sun at an exposure of 0 EV. This way they'll have a much easier time dealing with lighting thanks to the tiny range between various types of light sources. Again, no one is forced to use 100,000+ lux for the sun, though it's recommended for many (especially non-artists) to achieve more photorealistic results.

    Also, doing exposure adjustments is going to affect the whole image regardless, so it's not a great solution either. Exposure should be set with intent, and not as a fix to poor lighting setups. What is actually needed instead to reduce blown-out highlights and hard contrast are "post" adjustments that don't interfere with the "raw" footage. The way this should be handled is by grading the image, with custom tonemapping and/or other overrides, like "Lift Gamma Gain". This is exactly what your smartphone camera does automatically for instance and any grading artist manually with footage captured in a LOG format (pretty much any recent mid/pro digital photo/video cameras). Even some smartphones can do RAW these days, that is how you can manually extract way more details from shadows and highlights in post, compared to 8bit JPEGs for instance.

    Here are 3 examples from the HDRP Scene Template, comparing
    • ACES (blown-out highlights in the other room, high contrast, default filmic look)
    • Lift Gamma Gain with Neutral tonemapping curve (restored highlights in the othe room, but flatter)
    • Custom tonemapping curve (idem)
    upload_2021-12-7_16-25-38.png upload_2021-12-7_16-25-42.png upload_2021-12-7_16-25-45.png

    There is no right or wrong way, just whatever looks good for your needs. One can mix and match any technique above. One can also make their own custom LUT. Just don't start doing too many cross adjustments in too many places, you don't want to make your life too complicated...

    Also, careful what one wishes for: the visual cortex of the brain (eyes actually don't "see" anything) interprets light in a flatter and lower contrast way than film, and this might not be what you're after artistically. So why are filmic looks (and they are many types, based on manufacturers, development process, etc.) the default for most rendering pipelines? because of a century of cinematographic tradition, film research, artistic taste, the predominance of ACES in recent times, and of course the expectation from any professional artist and even the audience as a result. If one doesn't like these looks though, they are free to do whatever they please with HDRP: we let users have custom tonemapping and grading depending on their stylistic requirements.

    Saying "it's blown out because it simulates a real camera" is not quite correct. HDRP has a very large dynamic range to play with: the look of the final image on an SDR display will all depend on the tonemapping being used. If you stick to the default ACES tonemapping curve and call it a day, yes it will simulate an old-school film camera and you will indeed get these harsher contrasted results. Again, you can alter this behavior very easily, without having to actually modify the lighting or the assets receiving it.

    Lastly, one needs to really consider if using physically-based lighting intensities is really the right way to go for their project. If one wants to make a competitive multiplayer game, where people in dark rooms need to see other people perfectly in full sunlight (and vice versa) for gameplay reasons, it's probably NOT a good idea (doable, but it will be harder for sure). Look at CSGO, Overwatch, and Valorant: they have either a fixed exposure or an extremely narrow band of exposure. Then, if one is working on a slow-paced photoreal 3rd person adventure game or an arch viz project, then most likely YES, it's recommended. (and I'm not even talking about dynamic times of day, which add another layer of maintenance on top)

    In the end, what matters is that one understands what's happening to the image pipeline, and how one can alter that image. After that, it's just a purely artistic choice based on how their project is supposed to look/play/feel like. These choices will greatly affect visibility in different lighting conditions.

    Quite a long answer. :)

    PS: exposure and tonemapping are not interchangeable terms. It's like trying to compare gain and compression in audio.
     
    Last edited: Dec 7, 2021
  10. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    233
    Yeah custom tonemapping really does the job, too bad I haven't touched it much yet.
    "Shoulder Length" is key to handle huge lighting differences, 8 seems to be a good value (anything above 10 seem to produce color banding).
    I also recommend to set Toe Strength and Length to 0, so darker areas don't get additionally darkened.

    Exposure settings need to be adjusted too ofc.
     
  11. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    Thanks for the replies, a lot of helpful information :D
    I was using aces before, switched to custom and tried a few different settings.
    Also tried out 0 exposure and unrealistic lighting values.

    0 exposure, low sun value:
    upload_2021-12-8_1-44-19.png

    It helps, but the interiors are now pretty dark. I suppose one way to fix it would be to manually place volumes around these rooms that overrides the exposure value to something around -2.5. When set to that, it looks fairly bright inside (as it should)

    But then we're back to the same issue (1) of looking outside.
    upload_2021-12-8_1-46-28.png
    As you can see it's insanely bright outside now because I had to lower exposure to get the interiors to light up correctly.


    The issue of pitch black (or close to) interiors when looking from outside is still here, I've tried a ton of post processing settings and different bakes, but no luck.

    upload_2021-12-8_1-48-15.png

    the HDRP template isn't connected with the world outside of it's few rooms, it only has a small opening in the roof for some light. Exposure values are pretty low.

    But if you're coming from outside into an interior, exposure will be high, the sun is very bright. I still can't figure i tout.
    It looks far too dark outside, and there's issues for when your inside. You can't fix one of them without messing up the other.




    Switched to wood material.
     
  12. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136

    Showing some footage of how the transition is outside > interior.
    I can't really lower the exposure max value otherwise outside will be wrong and extremely bright.
    I could lower the sun value and than do it, but it'll be the same issue still.





    Honestly i'm not sure there's a way to do this correctly in HDRP. There's a popular game using HDRP called
    Car Mechanics Simulator and what I noticed they do, or don't do, they seem to have given up on real transitions from the world outside to rooms and interiors, probably due to this same issue.

    You just click a door and a second later you're in, the interior is always loaded, they just put a door to (maybe) get rid of this mess.
     
  13. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    233
    The indoor illumination looks way too low, due to the fact that you have to set the exposure to -3 (even moonlight would result in higher illumination with this exposure).
    It could be that your Global Illumination setup is not correct... so how did you set it up?
     
    PutridEx likes this.
  14. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    What do you mean GI not correct, as in settings and what not?
    The reason it was set to -3 as said in my post is that the interiors were too dark without the change, the room has a big gap and there's a ton of sunlight coming in, it doesn't make sense for it to be that dark

    When I set it to -3, the interiors look more correct, but when looking outside from the interior, it looked extremely bright.
    How do I balance these three?
    1. Need to get good, correct lighting in interiors which is lit by sunlight coming from outside.
    2. When looking at the interior from outside, it needs to look correct and not pitch black
    3. Exterior doesn't look extremely bright when looking from the inside/interior

    Download scene: https://easyupload.io/uquvrf
    If you have (or anyone else) have the time, test it out and see if you can get correct lighting with while meeting the 3 points above

    In the download scene, exposure is set to 0 and light at low values. I was testing unrealistic light values to see if i can get it correct, no luck. The interior looks too dark, it should be more bright when looking from outside, I can't increase the sun light any further as it's already extremely bright and any more will blow out the exterior.

    If you have problems in the scene, delete baked light and re-bake
     
  15. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    That image doesn't shock me, because that interior has no artificial lighting and only relies on a tiny amount of sun light hitting a very small portion of a dark floor (probably under 2 sqm). That's really not much, regardless of the number of gi bounces you set and the large size of the interior.

    And if you want to kill the highlights while inside, then use the lift gamma gain override with a local volume to do so when inside, like shown in my message above.

    There's no miracle: if you don't want to have visible exposure difference, stick to a fix exposure, but then light your interior properly to make sure you reduce the lighting contrast, like any "old school" games out there. With a very low sun value, you're already halfway there, but you still got to fill that interior (a dark wooden cave basically) with some actual light GameObjects, because the GI still produces dark results regardless.
     
    PutridEx likes this.
  16. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    I see, that makes sense. But isn't that a large amount of light? Excuse my ignorance here but i can't know if i don't ask,
    the sun (which seems to be making the exterior look very bright), it's light is going directly inside the interior. It feels like the light should be a lot stronger inside.

    I could place some lights inside, to fake it -- that'd probably work as you suggested, but it feels like the directional light and ambient light should easily be able to light it up.
     
  17. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    233
    So I tested the scene, set the sun back to 130k lux and the PBSky exposure back to 1 (no idea why it was at 1.4), I also lifted the ground tint a bit to a 0.25 grey (was too dark). The auto exposure got altered to 0 - 11 to adjust for the custom tonemapping (well it doesn't really go below 9 even inside, so don't mind the 0).

    It looks as expected.
    test1.JPG test2.JPG
    The room is still quite dark for sure, but there's little surface where the sunlight can bounce off with just a small opening and the current sun angle.
    Overall it looks correct.
     
    Last edited: Dec 8, 2021
    burningmime and PutridEx like this.
  18. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    First, interior surfaces in the real world (apart from floorings for practicality) should preferably have fairly high albedo values, as close a possible to white, to maximise bounce lighting, to make use of the "free" natural light. By using this dark wood material everywhere, you're already shooting yourself in the foot. Even going from a light taupe or magnolia wall paint to a white one can make a big difference perceptually. If on top of this there are zero artificial light in such a space, like in the room you built, it'll look non optimal, to say the least.

    Yes, the sun is a very strong light, however, if it comes through a fairly small opening like in your scene and hits a surface 40-70% darker than white, it isn't going to contribute much at all, as it'll need 2 or 3 bounces to reach the opposite part of the room covered in a dark material. Don't forget about the quadratic falloff of the light: if you double the distance the light must travel, it's intensity is divided by 4 for exemple. So, after each bounce, if 70% of the light is absorbed, you won't be left with much lighting at all.

    As a test, you can play with the HDRP scene template and assign a similar dark wood material to every non-white walls and ceilings. You'll most likely have a hard time in the 2nd room with the sky light to get any good looking lighting, as that material will literally suck all the light (you'll need to lower exposure further, but the overall contrast will be poor regardless, and it'll increase the overexposure when looking out even further).

    And regarding the issue with the interior looking too dark: to convice yourself (or update your expectations), look for instance for photos of garage doors semi opened that are hit by sunlight (must be sunny to already start with a high exposure). You'll have a hard time seeing anything in there:




    But again, if you're not after photorealism and/or you want full manual control on the light both indoor and outdoor without any large exposure difference, you'll need to go the non physical way somehow, otherwise you can't really bend the laws of physics I'm afraid. Like I said, many competitive games, especially shooters, will not follow all these rules because of gameplay (player visibility). A good example of poor player visibility is in Bf2042 (at least in the open beta), where in stormy conditions the ennemies are indiscernable from allies: this shows the limits of going photoreal, with everyone becoming a dark silhouette that almost disappear in the shadow (and if you add an aggressive tone mapping/grading on top, it's even worse).
     
    Last edited: Dec 8, 2021
    andywatts, Kasperrr, C-T-Y and 3 others like this.
  19. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    It was due to a suggestion above I forgot to change back :D
    i remade the scene close to your settings and it is indeed better
    Thanks for the help, much appreciated


    Thanks a ton for the great explanation, helped me a lot understand lighting and exposure better.

    ---
    I'm sure future readers will find this thread very helpful and informative :D
     
    SebLazyWizard likes this.
  20. impheris

    impheris

    Joined:
    Dec 30, 2009
    Posts:
    1,622
    Yes, that is the point, very good tips
     
  21. Matjio

    Matjio

    Unity Technologies

    Joined:
    Dec 1, 2014
    Posts:
    108
    By the way, maybe stupid question, but just in case, did you bake your lighting? (Sun to mixed, and all geometries to contribute GI and lit by light maps in your case)