Search Unity

Question HDRP's Fog : light's halo passing trough walls

Discussion in 'High Definition Render Pipeline' started by SiniKettu_, Jun 16, 2020.

  1. SiniKettu_

    SiniKettu_

    Joined:
    Aug 30, 2017
    Posts:
    19
    Hello,

    I ve got a light that is very close of the wall (this a torch on a wall) in a building. But we can see its halo through the wall from the outside of the building.

    I wonder how to keep the halo in the building... I have not seen any help on the Internet about this problem.

    Any idea ? Or explanation ?

    Best regards from France

    Sans titre.jpg
     
  2. SiniKettu_

    SiniKettu_

    Joined:
    Aug 30, 2017
    Posts:
    19
    Furthermore, the "glitch" disappears when the camera goes really close (1 or 2 meters) to the glitch's location.
     
  3. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    1,117
    I confirm the same in HDRP9, Unity2020.1
    Volumetrics leak at distance and fixes itself when camera gets close.
    My screenshot has light on the right side of the wall and yet volumetrics show up on the left side...
    I just reported it so I should be able to hear back soon.
    Untitled-1.jpg
     
  4. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    I think this is just the normal behaviour of lights.
    Volumetric light or halo needs a shadow map in order to not leak through meshes. So when the shadow of a light source is culled, both light and "fog" will leak through everything. So you have to tweak the shadow distance.

    Solutions:

    1. Change the light's Fade Distance so that the light will fade it out when going too far away from the building. Sure, the light and the fog will be no longer visible but better than seeing light leaking from far away. You often can see this strategy in many AAA games. A realtime light is only used when very close to the source. But within the distance, billboards and decals, projectors are used to fake the light spread.
    2. Place lights in a more open area so it does not rely heavily on shadows in order to not leak through walls. Only use volumetrics for the most important lights that are placed in an open area. Use faking strategies for the halo like planes.
    3. You have to overthink your level design. For a game you cannot illuminate everything with realtime shadows. You will hit very soon a performence limit. Like I mentioned above, volumetrics need a shadow but since you cannot have too much on screen, you need a strategy to disable the volumetrics.

    I'm using Unity 2019.4 and have no problems with light leaking. It just behaves like it is intended: Depending on the global and the light sources shadow distance, the shadows will be faded out and therefore result in leaking light.

    Other problems might be your walls are too thin or the light source is placed too close to a wall or maybe inside.
     
    Last edited: Jun 17, 2020
  5. SiniKettu_

    SiniKettu_

    Joined:
    Aug 30, 2017
    Posts:
    19
    Interesting !
    I disabled volumetrics on my indoor lights, they weren't very useful actually. It's way better now ! Thanks !
     
  6. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    1,117
    I think you are confusing a bug with level design conventions. This is clearly a bug and not working as intended.
     
  7. SiniKettu_

    SiniKettu_

    Joined:
    Aug 30, 2017
    Posts:
    19
    Yes, but we don't want it, wether it's a bug or not. So we need to find solutions and these level design conventions works while the fog is still bugy.
     
  8. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
  9. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    Like I said above: In my version I did not encounter this bug. However I can give you some advice about placing light sources regarding my experience with HDRP and also using Enlighten. I also had a project with a night scene and many lights. Nevertheless I would give the advice to place lights with volumetrics somewhere else. Even if this bug would not happen you would also face the issue of light leaking as soon as shadows get culled properly. So if your shadow distance is rather short and the lights can be seen from very far away, you will run in these problems that it looks not pleasing.

    If you encounter that the volumetric fog is leaking through something way before the shadow distance and even when the light source has shadows enabled, than it is indeed a bug.
    Normally light and fog starts to leak when the shadow of a light is culled. Before this shadow distance this should not happen.
     
    Last edited: Jun 20, 2020
  10. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    1,117
    Okay I did some testing this morning as I was also getting skeptical as Bordeaux's suggestions made a lot of sense.

    But, after doing some testing, I am convinced that something is going on with volumetrics leaking...
    I have tried Slice Distribution Uniformity, and this the best result I got.

    3 bright point lights 2 meters away from a wall.

    leak.jpg

    what I have found out.
    there is always a volumetric light leak with point lights if the wall is less than 1m. The amount visible depends on the intensity vs distance. I have managed to make it leak 15 meters away from the wall so, it is not really about point lights being close to the wall.

    Changing the Slice Distribution Uniformity slider actually changes the looks of the leak but does not remove it.

    I am not sure whether this is the intended behavior, but if it is, then it means volumetric accuracy is much much lower than one would generally expect.

    To answer Sinikettu's question, the solution is to make the walls thicker than 1m.

    My question is whether this is the intended behavior and if so we should really discuss if this is the outcome we'd like.

    Another cool upside is that I can make opaque materials glow from inside as if they were scattered :)
     
  11. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    I don't think this a bug, but mostly the current limitation of the volumetric fog technique used by unity, since i've notice the same issue in farcry 5 which i believe using the same volumetric fog technique.
     
    Last edited: Jun 22, 2020
  12. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    That's why I said placing realtime lights near outside walls is a bad idea.
     
  13. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Thing is this issue not only occured with a light placed near a wall, if you have a thick fog and you are inside a building the fog from outside affected by directional light will also leak inside
     
  14. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    If you're on HDRP 7, you can also increase the resolution by enabling "High quality" volumetrics in your HDRP settings, it will greatly increase the cost of the effect though: https://docs.unity3d.com/Packages/c...efinition@7.1/manual/Volumetric-Lighting.html

    HDRP 9 provides 2 new parameters in the Fog volume overrides (instead of the "High quality" mode): Volume Slice Count and Screen Resolution percentage. These will allow you to tune exactly how the froxel fog is sliced and you could then avoid most leaking with thin geometries. Obviously, pushing those 2 will increase the cost.

    Like Reanimate_L said, this technique has its limitations, no matter the engine, any voxel/froxel-based systems will encounter some form of this leaking, whenever the volumetric representation of the scene is much lower res than the scene itself.
     
  15. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    This is on farcry new dawn, i think they tweak it or change something. In farcry 5 it was worse though
    https://imgur.com/oX11PAq (Cannot embed video from imgur sadly)
     
    Last edited: Jun 22, 2020
  16. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    1,117
    pierred_unity, the slicing option sounds like the fix - although I have not tried it yet. Thanks for the information.
     
  17. Jairusx

    Jairusx

    Joined:
    Jun 25, 2020
    Posts:
    62
    Hello. I have even bigger issue. When I enable Anositropy and volumetric my sun passes through the objects. Am I missing something? Thanks upload_2021-3-22_0-46-1.png
     
  18. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Is there any way to disable to halo at light source? but also keep the fog?
     
  19. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    765
    hey, you can easily toggle volumetrics or use the multiplier by light
     

    Attached Files:

    radiantboy likes this.
  20. Jairusx

    Jairusx

    Joined:
    Jun 25, 2020
    Posts:
    62
    Yes, but what happen If I need that strong halo? Is there any work around to disable the halo passing the solid objects?
    Is this a bug actually or it is the normal behavior? :) Thanks!
     
  21. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    Hey, you need to increase the distance of the volumetric fog (click the little cog wheel on the header for the Fog) and tune that setting. It might be called "Fog extent" on older hdrp versions, now it's simply called "Volumetric fog distance". You also need to ensure the "Shadow" override is set far away enough.
     
  22. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    I love the volumetic fog, been looking for that for years - i just dont like how it concentrates at the source in a visible ball, can that be turned off but keep the fog outside of it?
     
  23. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    @radiantboy try to tweak the anisotropic settings in the volumetric fog
     
    radiantboy likes this.