Search Unity

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

Weather & day time in HDRP

Discussion in 'High Definition Render Pipeline' started by raingame_, Feb 12, 2021.

  1. raingame_

    raingame_

    Joined:
    Jan 15, 2019
    Posts:
    28
    How to achieve different day times and weather conditions in HDRP? Like, what settings and parameters should I tweak? Or if I want some rainy weather with nice looking clouds it's better to look for some assets in the Asset Store?
     
  2. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    752
    For performance reasons, HDRP don't currently support realtime "time of day".

    However, you can still use a Physically Based Sky with a Directional Light that moves to simulate the sun/moon position (sunset, high noon, sunrise.. etc). The PBR Sky will update its color and sun disk according to your Directional Light orientation.

    For clouds, currently on latest HDRP you can use the "Cloud Layer" override which is a simple cloud layer to simulate the upper layer of clouds that can be setup in the "Visual Environment" override. It can be added on top of any Sky.

    Also, it's not fully ready yet, but in the near future you will be able to combine it with the "Volumetric Clouds" override for closer, interactable clouds (that receives fog and volumetric light).
     
    Last edited: Feb 12, 2021
    tmonestudio and raingame_ like this.
  3. raingame_

    raingame_

    Joined:
    Jan 15, 2019
    Posts:
    28
    thank you so much for the information!
     
    chap-unity likes this.
  4. Bartolomeus755

    Bartolomeus755

    Joined:
    Jun 20, 2013
    Posts:
    283
    Hi, could not see the Cloud Layer in the Sky Override in HDRP 10.3.1.
     
  5. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    752
    Hi, it has been removed temporarily in 10.3 but it's available starting from HDRP 12 which is available in the latest 2021.2 alpha for now. It will most probably be backported to HDRP 11 (2021.1.x) soon !
     
    Bartolomeus755 likes this.
  6. Bartolomeus755

    Bartolomeus755

    Joined:
    Jun 20, 2013
    Posts:
    283
    Thx for the info. Looking forward to test it.
     
    chap-unity likes this.
  7. TonyvanLoon

    TonyvanLoon

    Joined:
    Nov 29, 2016
    Posts:
    2
    HDRP 11 is out now with Unity 2021.1. How are things standing with the 'Cloud Layer'? Are there plans to get in Unity 2021.1 using HDRP 11?
     
  8. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    752
    AFAIK, no plans to backport it to 11. You'll need HDRP 12 available in latest 2021.2 alphas.
     
  9. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Wait how did we have to handle the Sun and Moon lighting transition with this setup? using 2 directional light and flip them at dusk/dawn or just one directional light?
     
  10. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,833
    Day night cycle makes the game lighting amazing especially for outdoor scenes...
    this is my experience ...
    managing sun, moon and sky rotation and color using procedural and calculation way has too much high quality result

    this is a simple calculation of the day night cycle :


    I worked on it to customize based on my needs and the result was amazing:
     
  11. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    690
    I did some tests on a personal project and the physically based sky can already handle two directional light and celestial bodies. But you still have to disable one or the other when it is under the horizon, else it will still affect the objects in the scene.
    The other tricky thing is to switch shadow emission from one to the other, because HDRP supports only a single directional light casting shadows. This can be done through the API .
     
    chap-unity likes this.
  12. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Oh this is the setup that i currently used. The only missing part is handling the sky and fog volume settings depending on TOD
     
  13. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    230
    The planet itself blocks the light if its below the horizon.
    I keep both the sun and moon active all the time and objects don't get lit if they are in the planets shadow.
     
  14. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    you can keep both light active, but you can't have both light have shadow enabled, this is the only thing that you need to flip or else HDRP will freak out because the shadow atlas can only support one directional light
     
    chap-unity likes this.
  15. dangr25

    dangr25

    Joined:
    Apr 8, 2018
    Posts:
    2
    This tutorial worked fine for me in HDRP, certain values will need to be tweaked like light intensities, and space emission multiplier, the shadow emissions get switched as well.
     
  16. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    interesting, in my HDRP version updating the sky at runtime tanking the FPS.
     
  17. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    648
    Any idea why updating HDProbe.RequestRenderNextUpdate() is causing a dark flash for me while updating? Its very quick and looks like the reflections are going dark while figuring out what the next should be.

    Is there a different way I should be handling time of day? Its an overhead style game.
     
  18. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,174
    I followed this tutorial; very useful.

    However, for me setting the Space Emission Multiplier to such a high value has a major effect on the scene, as it affects the amount of light the space background emits. I had to keep the value under at/under 1 to avoid issues, whereas in the video he uses a max value of 1000.

    Perhaps Unity has adjusted things to make the old 1000 value unusable, or perhaps I missed something or am doing something wrong.

    With that said, this seems like a bad way to control how visible the night sky is. Is there a way to make it based on how much non space light is hitting the camera?
     
  19. Jack_Martison

    Jack_Martison

    Joined:
    Jun 24, 2018
    Posts:
    134
    This tutorial is a good way to kill performance, moving sun each frame is very expensive, setting up specific steps per frame much more convincing.
    As for emission, it's better to keep it within static number (I use around 15, depending on texture you are using)
     
  20. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,174
    Interesting. In my test (Editor only, Unity 2023.2.0b12, HDRP 16.0.3) I only see a 1-2 FPS drop when moving the sun. Of course, there are likely certain settings/features that do not handle the movement as well. Is there something you know of for sure that doesn't like the sun being moved?