Search Unity

Question Gradient Sky affects interior even though I baked Light.

Discussion in 'High Definition Render Pipeline' started by KYL3R, Mar 30, 2022.

  1. KYL3R

    KYL3R

    Joined:
    Nov 16, 2012
    Posts:
    135
    + I have 1 directional light, it cannot reach the inside (The bounced light is not coming this far)
    + I baked lights, the ShadowMask is black in this area.

    - When I change the Tint of the Directional Light to something brigher than full black, you can see the Directional Light reflecting on the inside/interior walls.
    - When I enable Gradient Sky as Visual Enviroment (Global PostProcessing Volume) it reflects on the inside/interior walls.

    I can work against this using Reflection Probes. Creating and Baking these "fixes" the unwanted reflections. But do I really need to place reflection probes everywhere on my interiors and make sure the influence box doesn't overlap with the outside walls (because that looks weird)? This feels wrong - did I miss something? Why isn't the ShadowMask masking these effects on the inside?

    I am using HDRP on 2021.2.9f1

    Images:
    Bright ares are not covered by reflection probes but brightened by the Visual Enviroment/Gradient Sky. Looks weird for interior.



    Using full black (top) and dark-gray (bottom) for the one/single realtime Directional Light. The Interior walls are affected by the directional (realtime) light when it's not 100% black tinted. That feels wrong.


    Am I missing something?
     
    Last edited: Apr 6, 2022
  2. KYL3R

    KYL3R

    Joined:
    Nov 16, 2012
    Posts:
    135
    Anyone?
     
  3. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,795
    Yes.
     
  4. KYL3R

    KYL3R

    Joined:
    Nov 16, 2012
    Posts:
    135
    Oof. Well okay, I figures, because the HDRP demo scene requires refleciton probes as well...
     
  5. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,795
    I don’t quite remember if it’s possible in HDRP but I think you can manually assign some meshes to specific reflection probes so you don’t have to lose your mind with the influence box (so you can split the exterior and interior part of the wall into two different meshes and assign them the different reflection probes manually)
     
    newguy123 likes this.
  6. Win3xploder

    Win3xploder

    Joined:
    Dec 5, 2014
    Posts:
    161
    Reflection probes have a "normal influence" parameter that allows you to exclude surfaces that point away from the probe. this is great to exclude the exterior walls for interior scenes like this.
     
  7. KYL3R

    KYL3R

    Joined:
    Nov 16, 2012
    Posts:
    135
    Thanks, that actually helps on the wall, but sadly not on the floor.


    As you can see, the floor is still bleeding light from the Reflection Probe that is outside.
    The only way to go seems to be: placing the Probes correctly.

    But even that seems very hard, the blending distance doesn't help much either:



    Here is another comparison, I didn't use Light Probes here, so the boxes could be brighter if I did.







    Here is the baked lightmap:

    Directionality Map:



    As all the walls are static, it feels wrong to place the Reflection probes this carefully, manually. The walls aren't even metallic in any way, so I don't need actual reflections here.
     
  8. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    868
    I had kind of same issues, was only able to solve it by turning of the directional light during baking of Reflection Probes.
     
  9. Win3xploder

    Win3xploder

    Joined:
    Dec 5, 2014
    Posts:
    161
    Reflection Probes need to be placed accurate to the geometry if you want to avoid wrong energy reflections. I am afraid there is no other way.

    However what you can do to prevent leaks between probes is to envelop larger areas with low priority probes and then layer higher priority, more detailed probes on top.
     
  10. KYL3R

    KYL3R

    Joined:
    Nov 16, 2012
    Posts:
    135
    Hmm. If you create some square rooms like ArchVizPRO, you can probably place 15-30 probes and be fine.

    For outside scenes with just some trees and a lake, you use giant probes and overlap them I guess.

    For me (currently solo dev), this isn't a viable option, as it involves way too much manual work.

    I now decoupled the "visible" Visual Enviroment" from the "light affecting" visual Enviroment:

    https://docs.unity3d.com/Packages/c...nment-Lighting.html#DecoupleVisualEnvironment

    So now I can render the gradient sky (and clouds) and control the light affection separately.

    To avoid that indirect areas are too dark (because of the missing ambient lighting) I added an Indirect Lighting controller and increased the Indirect Lighting Multiplier. That seems to look ok for now, considering I used 0 Reflection Probes.




    Still, I don't see why the visual enviroment would go through walls that hard.
    In Unreal 4, the shadows are black after baking, until I enable the "skylight". But that doesn't brighten the interior somehow. See my Comparison between Unity 2021.2.19f1 (HDRP), Unreal 4 and Unreal 5 below:
     
  11. KYL3R

    KYL3R

    Joined:
    Nov 16, 2012
    Posts:
    135
    Unity (Baked Indirect):





    Unreal 4 (Baked Indirect)




    Unreal 5 (No Bake)

     
    Last edited: Apr 9, 2022
  12. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,795
    Why are you baking indirect light in Unreal and not in Unity?

    I’m also confused on which of these outputs you find desirable.
     
  13. KYL3R

    KYL3R

    Joined:
    Nov 16, 2012
    Posts:
    135
    I baked indirect Light in Unity too, I just didn't mention that in the screenshot. I did mention it in the post though.
    edit: I edited the images above to avoid confusion about baked indirect!

    What I find desirable?

    - All the variants without any kind of sky/ambient light (black floor outside) are bad in my opinion. If I'd increase the exposure, the direct light would blind me.
    - In Unity, Visual Environment enabled looks bad, walls look disconnected.

    + I like Unreal 4 with the skylight enabled.
    + I like Unity with the Indirect Diffuse Multiplier (at least a workaround)
    + I like the Unreal 5 with Skylight.
     
  14. KYL3R

    KYL3R

    Joined:
    Nov 16, 2012
    Posts:
    135
    For completeness, here is Unity with Reflection Probes:



    I still think the "faked" Version with Indirect Diffuse Mutiplier set to 50 looks better, while not using any Reflection Probes at all.

    So if you think "ew, this guy clearly didn't understand how to use Reflection Probes" then please help me. Because even if I try to place them nicely, the blending usually leaves ugly transitions. This doesn't look good, does it?
     
  15. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,795
    Can’t you just completely disable the global reflection probe or switch it to something really dark, or reduce its intensity to 0?

    You can do this in regular Unity, but I haven’t used in HDRP in a bit, so I don’t quite remember how to do it, but that is the thing that is messing up your Unity image with baked indirect.
     
  16. KYL3R

    KYL3R

    Joined:
    Nov 16, 2012
    Posts:
    135
    Decoupling the "displayed sky" from the "light affecting sky" allow me to do that. I could reduce the intensity of the 2nd sky to 0, so I can see the sky, but it doesn't affect anything.


    However I just realized, that I only baked the Directional Light. That's why it's almost pitch black on the outside, where the sun isn't hitting directly. My "hack" of tuning the indirect diffuse multiplier to 50 brightened the shadowed areas, but in reality I just want a "skylight" to illuminate everything visible from the sky.
    In Unreal, this seems to work while shadowing objects in realtime, therefore it's not lighting the iterior walls.
    In Unity, the Visual Environment ignores the walls (in realtime). But when baking, this should work. However I used GPU Bakery and that didn't consider the visual environment.
    I just added a "Skylight (Bakery)" to my scene and now the bake looks a lot better, obviously. I disabled the diffuse mutiplier, because it's now bright enough.

    Baked Lightmap, only Directional Light is considered, my bad - but I just didn't realize this until now.


    The Lit scene then looks like this:





    After adding the "Skylight (Bakery)" the baked lightmap looks like this:
    A lot brighter overall and the light scatters more to the inside, as it comes from all directions.


    The lit scene now looks like this, without any multiplier hacks, and no Reflection Probes.



    - I will now do a Test to see if the builtin Unity Lightmapper considers the Visual Environment properly.
    - I do have to check if I still need the visual Environment for non-static objects and if that works well with reflection probes or not.
     
  17. KYL3R

    KYL3R

    Joined:
    Nov 16, 2012
    Posts:
    135
    Ok so I did tests with the builtin Lightmapper:
    No Visual Environment:


    Visual Environment, with Phyiscally Based Sky & Volumetric Clouds (affected by Directional Light):
    - You can clearly see the blueish tint from the sky, also it's brighter in general.


    So the Visual Environment works just fine for Baking, just not in realtime like in Unreal 4.
    And when I use GPU Bakery, I have to use a Skylight.


    But still, while the baked lightmap looks correct, the visual environment still adds a realtime effect:


    So I have to disable it after baking:


    So I might as well stick with GPU Bakery and the bake-only-Skylight.
     
  18. KYL3R

    KYL3R

    Joined:
    Nov 16, 2012
    Posts:
    135
    The Reflection Probe "Situation" is better now, too.
    Before, I would have the sky reflect inside (well, everywhere) so whenever I placed a single Reflection Probe, I would basically be forced to put probes everywhere, because I will always see ugly blendings...


    But now, when disabling the visual environment, I can place Reflection Probes where I will use reflective materials, maybe a Sword or glass, without the need to fill everything, gapless, with reflection probes:


    Whenever an area is missing a probe, reflections will be black (assuming screenspace reflections are disabled) but that's fine, I can place them near water, glass and metal stuff, or even use big probes to have "something" in the reflection. But my big problem of the ugly seams on the ground is gone like this. :)
     
  19. KYL3R

    KYL3R

    Joined:
    Nov 16, 2012
    Posts:
    135
    Outside, I noticed a last thing I need to configure, before Reflection Probes work like I expect them to.

    First, the Reflection Probe would brighten the ground after baking:


    I needed to uncheck the "include sun in bake" on the physically based sky override:


    With that disabled, the probe looks fine and doesn't brighten the ground: