Search Unity

Question Interior / Exterior Lighting

Discussion in 'High Definition Render Pipeline' started by Sisyphus-Studios, Oct 13, 2021.

  1. Sisyphus-Studios

    Sisyphus-Studios

    Joined:
    May 10, 2018
    Posts:
    22
    I'm currently on version 2021.2.0b15

    The game involves a split between interior and exterior with plenty of movement between the two on an air ship, the problem is that when inside, looking outside is like standing in front of the sun, here is what it looks like to take a peek through a door/window. Note that this is only when looking at an illuminated object, not at the skybox.

    upload_2021-10-12_16-52-21.png

    Now for the setup, currently it is as follows
    Directional Light @ 100000 lux with shadowmap on
    Box Volume Around Ship Setting HDRI Sky Exposure to 0

    upload_2021-10-12_16-57-22.png

    Removing the exposure setting to 0 causes outside to look normal but causes the interior lighting to be totally washed out

    I've additionally tried the exposure not overridden to 0, using the default center weighted global exposure with the indirect lighting multiplier set to 0, this causes the skybox to bloom in excess

    upload_2021-10-12_16-59-8.png

    I have a large ceiling built out of a regular box to ensure none of the issues are caused by light leaks, all my interior lights are set to lumens based on one of the sample HDRP scenes that I am trying to emulate I cannot figure out why the HDRP example scene works and mine does not, I spent a solid 3 hours in the sample scene adding and deleting 1 object at a time and tweaking 1 setting at a time trying to figure out what is causing my issue or how to fix it.

    It's been a few months since I really dealt with this issue but I believe the only lead I got that might have been something was found on this page https://docs.unity3d.com/Packages/c...finition@7.1/manual/Environment-Lighting.html

    HDRP uses the ambient Light Probe as the final fallback for indirect diffuse lighting. It affects:


    • All Mesh Renderers if there is no Global Illumination computed for the Scene (this applies when Unity has not computed any lightmaps or Light Probes for the Scene)
    • Mesh Renderers that have their Light Probe Mode set to Off
    • Volumetric fog if the Global Light Probe dimmer is set to a value above 0
    I assume the source of my suffering is due to setting exposure to 0, and that I need to have exposure set automatically and I need to NOT have the ambient light probe affecting my interior meshes. The issue is that I do not have global illumination or lightmaps currently because my ships are all procedurally generated, my ships are also all full time rigidbody dynamics that are always moving. I am currently utilizing static batching to assist with performance on the high poly rigidbody ship.

    One solution I thought of was looking into serialized lightmaps (assuming my hypothesis is correct with the ambient light probe) so that I can bake lightmaps onto my ships ahead of time which isn't ideal (will require combining lightmaps of ships that are potentially generated via multiple sections requiring lightmaps to be seamed together).

    Any assistance on what options I have to solve this would be much appreciated.
     
    Last edited: Oct 14, 2021
  2. Sisyphus-Studios

    Sisyphus-Studios

    Joined:
    May 10, 2018
    Posts:
    22
    I have tried adding baked, realtime, and both lightmapping to my ship, here is what looking outside looks like with baked lightmaps

    upload_2021-10-12_17-59-35.png

    With lightmapping and HDRI sky exposure set to 0

    upload_2021-10-12_18-4-9.png

    I'm back to square 1 nothing seems to work

    The only other solution I thought of was inside, sky exposure set to 0, directional light set to 100 lux looks like what I would expect the scene to look like not including lack of realtime indirect lighting that I'm not worried about right now. This fix seems not correct and also there is no way I can determine to gather box volume data to properly blend the directional light intensity

    upload_2021-10-12_18-7-9.png
     
  3. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    Hey, for this kind of scenario with a huge lighting range, you most likely want to use the "automatic" exposure mode, and let the system adjust automatically between the "limit min" (= the exposure value for the interior, probably somewhere between 1 and 3) and "limit max" (= the exposure value for the outdoor area to look correct, more than 13 if it's bright daylight outside).

    You can also reduce the Bloom intensity via the volume system, if it's the main culprit.

    Now, you also mentioned the issue is mostly related to that "illuminated object" outside the ship. The question is how is it illuminated? I see you set your sun at 100,000 lux, but then you set your HDRI at 0 EV. This means you simulate a daylight sun (100,000 lux), but with a night sky more or less (0 EV). That's not really going to work well, because the objects lit by the sun will be extremely bright in front of your dark sky, and the bloom will kick in massively. Your HDRI sky should be at around 14 EV if you want to simulate a daylight sky.


    Have a look at the doc, and the cheat sheet for exposure/light intensities:
    https://docs.unity3d.com/Packages/c...inition@12.0/manual/Physical-Light-Units.html

    tldr: Sun intensity at 100,000 lux, and Sky exposure at around 14EV for bright daylight:

     
  4. Sisyphus-Studios

    Sisyphus-Studios

    Joined:
    May 10, 2018
    Posts:
    22
    I've removed the sky exposure override and adjusted exposure as the following

    upload_2021-10-13_13-28-58.png

    Here's the result of looking at a object floating with a random texture from the HDRP spaceship scene

    upload_2021-10-13_13-32-2.png

    The issue is the interior is overly lit I want to retain the lighting as seen in the last picture of my 2nd post

    Here is what it looks like if I bake lightmaps, lighting is correct but the exterior lighting issue is back

    upload_2021-10-13_13-36-4.png

    @pierred_unity can you comment on the ambient light probe issue, it seems like lightmaps are in fact fixing the issue and the overly lit interior in the 2nd picture seems to be due to ambient light probe on lightmap missing meshes. Is there really no need for any game developer to have the power to disable the ambient light probe entirely? How are you supposed to manage a game that is procedurally generated and lacks lightmaps and also doesn't want the ambient light probe?

    Additionally it seems like a pretty big issue that you cant have a game that's split between interior and exterior without staring into the sun. If I turn on a light in my house right now at 2 PM on an overcast day my ceiling light greatly illuminates my desk yet I am still able to look outside my house without being blinded.

    Turning off bloom yields the following result

    upload_2021-10-13_13-46-56.png


    Is this really not an achievable goal to be able to look out of a window?
     
  5. Sisyphus-Studios

    Sisyphus-Studios

    Joined:
    May 10, 2018
    Posts:
    22
    Note that this is the effect I am trying to achieve. The settings for this are

    Directional Light 100 Lux
    HDRI Sky Exposure 0

    However this is not a good solution because of the issues of correctly transitioning the directional light upon exiting the ship as well as potential complications with multiplayer (1 player inside 1 player outside) and potentially other things such as exterior ship cameras or whatever else

    upload_2021-10-13_14-3-28.png
     
  6. Sisyphus-Studios

    Sisyphus-Studios

    Joined:
    May 10, 2018
    Posts:
    22
    Well I guess I found the best workaround I'm going to find

    Settings:
    PBR Sky @ Exposure 2
    Indirect Diffuse Lighting On
    No Lightmaps

    Directional Light @ 50 lux

    Exposure Automatic Histogram Min Limit 0 Max Limit 2.5

    This lets my interior lighting work with the ability to look out a window at about the brightness I would expect.
    In the first picture you can see that outside looking in works decently in that it is very dim while being decently bright.


    upload_2021-10-13_14-42-16.png
    upload_2021-10-13_14-42-35.png

    I'll probably need to do some tweaking of the directional light and exposure limits but it seems like the solution is to throw the useless lighting & exposure cheat sheet out the window and keep your min and max exposure limits very close with a dim directional light.

    The lower limit exposure cap lets you simulate as if the directional light was much brighter than it is without causing it to be relatively too bright while your exposure is low when you are inside. If you place it at the recommended 14, you would need the directional light to be relatively as high. Here are some roughly equivalent exterior lighting scenarios in terms of outside lighting

    Here is lighting looking inward

    upload_2021-10-13_14-50-0.png

    And lighting looking outward

    upload_2021-10-13_14-52-2.png

    I don't fully understand why this has to be like this, given that I am something of a photographer I do understand the nature of how exposure works but I do not understand why the camera is set up in a way that you cannot look out a window from a dark room without being blinded. I also do not understand why while under sunlight in a room that is being lit by the sun that lights do not have any effect

    Regardless, hopefully this helps someone else who has a game with a strong interior/exterior split
     
  7. DEEnvironment

    DEEnvironment

    Joined:
    Dec 30, 2018
    Posts:
    437
    hello
    do you use custom shaders or Unity ?
    suggest checking the metallic or AO by turning it off / all the way down in material to see if its related to this blow out of lighting
     
  8. Sisyphus-Studios

    Sisyphus-Studios

    Joined:
    May 10, 2018
    Posts:
    22
    Is there anywhere I can request the feature to disable the ambient light probe be added in HDRP?
     
  9. Sisyphus-Studios

    Sisyphus-Studios

    Joined:
    May 10, 2018
    Posts:
    22
    Steps to recreate

    1. Create new outdoor scene using basic outdoors template
    2. Make a sealed box out of boxes like so
    upload_2021-10-13_19-13-17.png

    3. add a material and bake lightmaps OR disable indirect diffuse multiplier by setting it to 0 on the global volume
    4. open up the sealed box
    upload_2021-10-13_19-14-10.png

    If you can fix this while maintaining physically based light values I'll venmo you 20 bucks


     
  10. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    I'm not surprised you see so much bloom if you absolutely want to have a totally black box, set the exposure for that black box, and then shine an incredibly strong light into it; especially if you potentially use a material with metalness that will also give you a very strong specular reflection from the sun.

    For this particular scenario, you first need to simulate the light bounce in the room once the light affects it. Either using real-time GI with Enlighten or by animating some lights to fake the bounce lighting. This will already considerably reduce the lighting range as the room won't be as dark anymore. This will help you handle the exposure more easily.

    You mentioned you tried the HDRP scene template and it worked fine. That's because the template correctly captures the indirect lighting. If you disable all the indirect lighting contributions, you end up with something like this (image on the right below). So you can see how important the indirect contribution is. There is no way a camera would be able to expose the right scene properly.

    upload_2021-10-14_10-17-3.png

    Then you can use the lift/gamma/gain postfx to kill the highlights. If you're a photographer this should be an easy step. In the end, this kind of extreme situation often comes down to getting the exposure right, and then tonemapping/grading to restore the highlights.

    I also understand it might not be possible for your project to use Enlighten or fake light bounces with punctual lights, if you have a more "procedural game design". So, if you can't precompute the indirect lighting for the scene, then using physically-based light intensities won't be recommended, because the indirect lighting will be hard to modulate locally, because Unity doesn't have a truly real-time GI solution (Enlighten is real-time, but it does require pre-computation to offer real-time updates). It is not uncommon for games to clamp the sunlight at 10,000 lux or under to avoid all these issues with the sun and the complex handling of exposure in dynamic scenarios (Mirror's Edge 2 for instance).

    BTW, HDRP already lets you control the indirect light intensity in the scene per camera, it is a volume component called "Indirect light controller". You can use them with the light layers too, which might be exactly what you're after, as it will offer you a way to dim only the indirect on specific meshes. In the example below, I can control the amount of indirect lighting influencing the cube (either 0x, or 100x). It is not the ultimate solution though, as we don't offer yet a dedicated multiplier for each light layer.

    upload_2021-10-14_10-22-30.png upload_2021-10-14_10-22-34.png

    Not sure I deserve your 20 bucks though. ;)
     
    mikeohc, valarnur and Ruchir like this.
  11. Sisyphus-Studios

    Sisyphus-Studios

    Joined:
    May 10, 2018
    Posts:
    22
    I think removing the indirect lighting is ultimately not a variable that matters for this large light range it seems like everything can be maintained exactly as it would be in any normal situation as long as you reduce the sky exposure, directional light, and max exposure to reduce the dynamic range of exposure.

    I'm glad you responded because I had set indirect to 0 and your post made me go toy with it some more

    It turns out that with the settings
    Directional Light @ 75Lux
    Exposure Min .5 Max 3
    PB Sky @ Exposure 1
    (These settings can all be tweaked to within a couple points depending on how dark/light you want interior/exterior)

    You can actually maintain the indirect lighting without getting the crazy highlights / bloom

    This is with Indirect Lighting 0

    upload_2021-10-17_9-48-29.png

    And Indirect Lighting 1

    upload_2021-10-17_9-48-7.png


    I also definitely didn't pay attention to the ability to control indirect lighting on light layers which may end up being helpful.

    Thanks for all your replies