Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Feature Request Volumetric fog blocking light too much

Discussion in 'High Definition Render Pipeline' started by Ava42, Jan 12, 2023.

  1. Ava42

    Ava42

    Joined:
    Aug 4, 2012
    Posts:
    33
    On level design phase of work I found that it is hard and even impossible in some situations to configurate volumetric fog area (min max and attenuation).
    On tall levels bottom part become too dark and have no light shafts... it seems Unity by default render volumetric fog more like sand dust (with strong sun block) rather than light water fog.

    is there any settings should I ckeck?
    i found that UE have "Extinction Scale" (Controls how much the participating media blocks light.) param and cant find it in unity... it seems its hardcoded for some reason...
     
  2. Ava42

    Ava42

    Joined:
    Aug 4, 2012
    Posts:
    33
    while testing I also notice that light will be blocked even without volumetric fog...
     
  3. Misaki_eKU

    Misaki_eKU

    Joined:
    May 3, 2018
    Posts:
    85
    Do you mean high density fog but not block the light?
     
  4. Ava42

    Ava42

    Joined:
    Aug 4, 2012
    Posts:
    33
    no its really about blocking the light.... in bottom of fog min height light parts will be almost same dark as in shadows from directional light.
     
  5. Ava42

    Ava42

    Joined:
    Aug 4, 2012
    Posts:
    33
    for example i have this scene... for third person shooter.. i turn off fog to better understand what it its...
    upload_2023-1-21_17-47-50.png

    so i enable super hard fog for scene and now i can see only upper part:

    upload_2023-1-21_17-50-49.png

    but now when i trying to go to bottom level i see this:

    upload_2023-1-21_17-52-0.png

    only after I increase sunlight 1000 times light can pass through fog light blocking and i can see this:

    upload_2023-1-21_17-53-22.png

    but upper part become totally white from ultra powerful sun =)
    so fog is blocking sun light in constant value that cannot be changed.

    so editing sunblock power can add more realism because natural hard fog never blocks 100% sunlight as Unity do it by default.
     

    Attached Files:

  6. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,133
    Adjust the fog attenuation value, the higher the less dense fog is, the lower the denser it'll be.
    There's also a base height value, and max height value, and other parameters you can change in your fog override.

    All lights also have a volumetric intensity value, you can find it in your sun.
     
  7. Ava42

    Ava42

    Joined:
    Aug 4, 2012
    Posts:
    33
    yeah but none of that params cant beat black shadow from fog. Light volumetric intensity value also make it bright only above black shadow. Only increasing light power intensity will start to fill light through fog.
    That's why this topic is Feature Request, missed light blocking parameter in HDRP fog settings. (i also check in visiblity of additional properties)

    maybe there is HDRP source code of fog shaders that can be modified manually?
     
  8. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,133
    You can use APV (probe volumes), new probe system for HDRP in 2022.2 and up.
    When using APV, it will feed correct color info/indirect lighting to volumetric fog.
     
  9. mgeorgedeveloper

    mgeorgedeveloper

    Joined:
    Jul 10, 2012
    Posts:
    308
    My general opinion on this... it is tricky in Unity (HDRP) to make strong sun shafts or god rays, without having the fog look super "thick". Maybe the values are realism based and quite accurate, but artistically if you just want to see a bunch of exaggerated rays coming through the tree tops, you have to do quite a few hacks and adjustments to get close the desired outcome.
     
  10. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    591
    @Ava42

    You could always blend a local Volume with a fog override for the lower level. what i am not fully realising is your set-up.

    It looks like you're using anisotropic backscattering ( negative numbers on the slider) and increasing the volumetric contribution of your sun to increase the visible god ray scatter, but unsure why you're getting an exposure difference like that.
    are you updating the ambient sky probe or is it set to static?

    what is your scene scale?

    i can't see much visible difference of exposure with vertical scale, I just lose the sun vis.

    my test scene was only 500m verticle for the objects and ground, but i get absolutely nothing similar to this.

    i'd maybe take a step back and look at your ambient probe contribution and general exposure, it looks like you're using a very dark HDRI sky, so check its contribution too.

    i highly recommend using the Rendering debuggers lighting tab under Window as well, you'll be able to see your current contributions on all lighting types.
     

    Attached Files:

  11. JarkkoUnity

    JarkkoUnity

    Unity Technologies

    Joined:
    Feb 1, 2021
    Posts:
    17
    Directional lighting is attenuated based on the height fog parameters (Fog Attenuation Distance, Base Height and Maximum Height), i.e. if you have a thick layer of fog above ground, it attenuates (shadows) the directional light that has to travel through that fog per Beer's law before it hits the ground. I don't think there's currently any way to circumvent this attenuation. What you can try to do is to tweak those fog parameters so that the fog layer isn't as thick and thus doesn't attenuate the light as much.
     
    Last edited: Jan 26, 2023
  12. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    230
    Ava42 and JarkkoUnity like this.
  13. JarkkoUnity

    JarkkoUnity

    Unity Technologies

    Joined:
    Feb 1, 2021
    Posts:
    17
    That's a good point @SebLazyWizard. The light attenuation code by height fog is indeed #ifdeffed with LIGHT_EVALUATION_NO_HEIGHT_FOG
     
  14. Ava42

    Ava42

    Joined:
    Aug 4, 2012
    Posts:
    33
    Yep works like a charm! Thank you!
    Wonder why it is not simple checkmark in fog settings.
    Also as I understand it have better performance.