Search Unity

[HELP] How to use fog in Universal RP?

Discussion in 'Universal Render Pipeline' started by kollosuss13, Mar 9, 2020.

  1. kollosuss13

    kollosuss13

    Joined:
    Feb 6, 2020
    Posts:
    14
    Hello, i upgrated built-in render pipeline to Universal RP, when i was using built-in RP fog worked fine, i used fade rendering type:

    Now fog don't hide objects:

    How can i solve this problem? Please help.
     
  2. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    244
    What shader is the ground using? It looks like this is not recieving fog but the other blocks are.
     
  3. kollosuss13

    kollosuss13

    Joined:
    Feb 6, 2020
    Posts:
    14
    upload_2020-3-10_14-29-50.png
     
  4. kollosuss13

    kollosuss13

    Joined:
    Feb 6, 2020
    Posts:
    14
    Should i use global fog?
    upload_2020-3-10_14-32-52.png
     
  5. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    244
    and thats the only material in the scene? do you have any lights in the scene and if so, does the fog work better if it is turned off?
     
  6. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    244
    Nope, I'm actually puzzled by the fact that you are seeing this, as you should be using URP and it has no deferred rendering.
     
    hippocoder likes this.
  7. kollosuss13

    kollosuss13

    Joined:
    Feb 6, 2020
    Posts:
    14
    i used deffered fog in post processing stack before
    upload_2020-3-10_14-49-38.png

    i have directional light in scene
     
  8. kollosuss13

    kollosuss13

    Joined:
    Feb 6, 2020
    Posts:
    14
    blocks have almost the same material but different color
     
  9. kollosuss13

    kollosuss13

    Joined:
    Feb 6, 2020
    Posts:
    14
    upload_2020-3-10_14-56-0.png
     
  10. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    244
    Ah ok, so Deferred fog will no longer work as we do not have a deferred renderer in URP, you will have to use the normal fog settings in the lighting settings window.

    upload_2020-3-10_14-27-34.png
     
    thelevel1slime likes this.
  11. kollosuss13

    kollosuss13

    Joined:
    Feb 6, 2020
    Posts:
    14
    upload_2020-3-10_15-42-11.png

    Now fog cover all objects
    upload_2020-3-10_15-43-37.png
     
  12. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    244
    Try lowering the density, also you can try the different 'Mode's to get the same look as before.
     
  13. kollosuss13

    kollosuss13

    Joined:
    Feb 6, 2020
    Posts:
    14
    upload_2020-3-10_15-52-6.png

    upload_2020-3-10_15-57-22.png

    i lowered density and tried different modes but it all the same, only linear mode don't cover ground but still don't hide blocks and i still see this message, maybe it's a bug or something.
     
  14. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    244
    I would try make the colour the same as your skybox, and then switch to linear fog, at that point playing with the near and far to get it the same distance it was. The message you are seeing is a UI issue, where it believes you are still using builtin renderer and not Universal RP, but this will not affect the fog.

    If you remember the settings you used on teh deferred fog that would be easiest to move them over as they should work the same.
     
  15. kollosuss13

    kollosuss13

    Joined:
    Feb 6, 2020
    Posts:
    14
    upload_2020-3-10_16-31-51.png

    done, but fog still don't hide blocks just cover them

    that how it was when i used standard RP
     
  16. kollosuss13

    kollosuss13

    Joined:
    Feb 6, 2020
    Posts:
    14
    I've solved this problem, my ground was a cube... when i change it to a plane all works fine now. thats was so simple, i feel awkward a little bit :)
     
    frbrz likes this.
  17. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,708
    Quick question how do I adjust the distance of the fog. I need a very long line of sight
     
  18. kollosuss13

    kollosuss13

    Joined:
    Feb 6, 2020
    Posts:
    14
    you can change density value of the fog
     
    Deleted User likes this.
  19. Nicate

    Nicate

    Joined:
    Jul 18, 2018
    Posts:
    16
    I'm pretty sure this is because (exponential) fog in URP is calculated per vertex instead of per pixel. I'm not sure if this is an oversight or on purpose for performance reasons (this is URP after all). So if you want more correct (exponential) fog on large objects using the built-in fog functionality, you will need to give them (a lot) more vertices.
     
    sp-LeventeLajtai and andreiagmu like this.
  20. BoberousR

    BoberousR

    Joined:
    Feb 8, 2020
    Posts:
    2
    Hey bro, I've been having the same issue you had when you started this thread. Although I can't seem to fix mine (even when i make a plane), I might of missed something. I was wondering if you could quickly show me how you fixed it, if you've got discord that might be easiest? :)

    All the best,
    R
     
  21. BoberousR

    BoberousR

    Joined:
    Feb 8, 2020
    Posts:
    2
    Or if anyone else has an effective solution for getting (not buggy) fog in the URP then I'd be very keen to know! :)
     
  22. Spaniel

    Spaniel

    Joined:
    Dec 23, 2012
    Posts:
    52
    Have been waiting on some info about how to fix fog (it's per vertex) or at least how to calculate depth in the fragment shader. No assistance from Unity and no thread replies. Disheartening.
     
  23. Eclectus

    Eclectus

    Joined:
    Oct 29, 2012
    Posts:
    20
    Hey Unity - Depth fog in the URP would be useful
     
  24. z2aido

    z2aido

    Joined:
    Oct 9, 2020
    Posts:
    2
    i have the same problem with fog in URP
     
  25. z2aido

    z2aido

    Joined:
    Oct 9, 2020
    Posts:
    2
    No it didn't work well I still had the same problem
     
  26. marcospgp

    marcospgp

    Joined:
    Jun 11, 2018
    Posts:
    194
    Try 0.002
     
  27. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    Fog intensity value must be very lower than 1
    use 0.00x values instead
    here is some tests on URP expo fog:




    Built in fog:
     
    DavidJang and marcospgp like this.