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 Unity! Transition exterior daylight/Interior dark cave lit with torch is terrible :/

Discussion in 'High Definition Render Pipeline' started by Marou1, Mar 18, 2023.

  1. Marou1

    Marou1

    Joined:
    Dec 13, 2021
    Posts:
    161
    Hi,

    It is a very common situation in real life, however really tedious to achieve in Unity.

    I have a scene with real time lights, a global volume for the exterior and a local volume for the cave.

    Since 2 volumes must have the same visual environment to blend, the one of the global volume affects the local volume.

    So I am using an indirect lighting controller in the local volume.

    Yes, it affects the whole environment. So I changed the cave entrance to make a curved circuit so the player cannot see the outside when they get closer to the local volume and the indirect lightning is lowered.
    Ok, its get dark in the cave, but the effect is:
    From far, you see clearly everything in the dark cave but then you get closer and you cannot see anything anymore. The cave became dark but only when you get in it, which feels pretty weird.

    Ok let's put a reflection probe, disable all light sources and bake it.
    It gets a little darker but not much.

    Increasing/lowering the multiplier in render settings makes no difference.

    I have no idea why it not replacing the sky reflection as mentioned in the documentation.
    Well, this is the first issue I cannot solve, but then things get worse.

    I need to be able to light my cave with a point light, but the point light won't light anything since the local volume is not overriding the exposure of the global volume.

    Let's add exposure to the local volume and lower it, we are indeed in a dark environment.
    Yay we see the point light!

    upload_2023-3-17_23-56-30.png

    However, it seems that the exposure of the local volume blends with that of the global volume with a "speed" that is different from the indirect lighting blending speed. the result is this (yes terrible):

    Outside is bright:
    upload_2023-3-18_0-0-40.png

    Inside the cave is even brighter (this is with the reflection probe):
    upload_2023-3-18_0-1-19.png

    And finally, it gets dark when the indirect light is lowered:
    upload_2023-3-18_0-2-33.png

    I must mention that the player is able to explore the cave with a torch. Without the torch, the cave must be pitch black.
    And it is part of the gameplay to prevent to player from getting inside without acquiring a torch. So this is important, and not just a visual effect.

    Any idea?

    Thanks!
     

    Attached Files:

  2. akent99

    akent99

    Joined:
    Jan 14, 2018
    Posts:
    588
    Two suggestions:
    • Make sure you set ground tint to black in the "Physically Based Sky" volume extension (the ground glows otherwise)
    • Make sure you are not using automatic exposure, or else it will normalize everything
    I then just added a point light (torch) with a low-ish range and it would light up around the character, but you cannot see far into the distance. I did not use local volumes. I did not adjust exposure. I just adjusted the light strength and range.

    upload_2023-3-17_22-47-2.png

    upload_2023-3-17_22-49-11.png

    But I am sure it could get fiddly for a large scene with different lighting requirements. But that is why I suggest checking anyway.
     
  3. Marou1

    Marou1

    Joined:
    Dec 13, 2021
    Posts:
    161
    Hi, thanks for the suggestions!
    I tried without the local volume, I switched to automatic exposure and put the tint to black, but no luck:
    upload_2023-3-18_8-55-17.png
    I am not sure how you achieved the black cave. Even if it is not affected by the direction light, it should not be black, since the shadows are not black in HDRP and everything reflects the sky.
    Did you bake the lightmaps?
     
  4. akent99

    akent99

    Joined:
    Jan 14, 2018
    Posts:
    588
    The default is automatic exposure, so I switched *from* automatic exposure to "fixed" using volumes. I used 100% realtime lighting (no baking). In my case (creating little animations) I like to move the sun around in a scene to adjust the fall of shadows per shot, so baking does not work well for me.

    I set ground tint to black, but it was not needed for a dark cave in this case (I tried pruning things back to the minimum). What helped the most was setting the indirect lighting multiplier to zero and making sure it was not automatic exposure. If you like automatic exposure normally, that might be what you use the local volume for - adjust the darkness from the exposure level, but I have not tried this - no idea how well blending between exposures would work as the local volume kicks in.

    upload_2023-3-18_9-14-15.png

    And the the light in the cave was just a point light with radius 10 so only the nearby area gets lit up. I used intensity scale EV100 with a value of 20, but its really up to you. If a real torch I assume you would want a yellow tinge with flickering somehow.

    upload_2023-3-18_9-20-16.png

    The directional light had shadow map enabled so it casts shadows. Otherwise it shines inside the cave (through the walls).

    upload_2023-3-18_9-19-13.png

    I tried the cave with automatic exposure on, and could not get a good result. If you look at something very dark, you can still see enough to move around
     
  5. Marou1

    Marou1

    Joined:
    Dec 13, 2021
    Posts:
    161
    I am using fixed exposure, I don't like the automatic exposure that is reproducing the behaviour of the camera, instead of that of the eye.
    Actually, with a high exposure, you have to have a high intensity otherwise the point light is not visible.

    There is still something that I don't understand in your scene, you have a high exposure (12.17). This affect the camera and you only have a global volume, so all your rocks should look bright due ti the global illumination, but this not the case... How come? Could you send a screenshot of all the overrides of your volume and a screenshot of HDRP global settings in Project settings?

    Also, could you take a screenshot of the interior of the cave but taken from the exterior?

    Thanks!
     
  6. akent99

    akent99

    Joined:
    Jan 14, 2018
    Posts:
    588
    I will try at a computer later, but there are SOO many settings in the HDRP profile. What I might try is a default project and note which settings I change. Just not sure when I will get the time.

    The cave was a pile of rocks I scaled up from the HDRP demo scene. I just kept duplicating and piling them up until I filled all the gaps. So from the outside it looks like a big pile of rocks with sun shining on it.

    Global illumination as I understand it means something *can* contribute to other things the scene if it has emissions. As my rocks have no emission (and probably have "contribute to GI off" since they have no emissions) they would not glow. I set the "Indirect Light Multiplier" to zero (as above), so it stops ground light reflection onto the rocks. With that at 1 (default) you can see all the rocks. I also set Ground Tint to black to stop the ground shining upwards, but in this case it did not matter so I left it out.

    Oh, I have a blog on lighting if any help. More notes from what I have discovered, but might contain something useful https://extra-ordinary.tv/2022/09/25/lighting-tricks-in-unity-hdrp-for-cinematic-effect/ - I was going to add more to it on dark caves once this thread sorts itself out! ;-)