Search Unity

Feedback Volumetric Clouds

Discussion in 'High Definition Render Pipeline' started by SebLazyWizard, Mar 20, 2021.

  1. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    So with the latest release of HDRP 12 we finally got volumetric clouds and they look quite good so far.
    screen_1920x1080_2021-03-20_17-49-30.jpg
    You have plenty of options to customize the clouds and the lighting looks correct, especially in combination with the PBSky (the other cloud option "Cloud Layer" doesn't, but that's another story).

    The only major drawback is the way how cloud shadows are handled.
    It just uses a light cookie on the directional light, which works fine if every object/surface is below the clouds, but as soon as something is above them it looks wrong ofc.
    screen_1920x1080_2021-03-20_18-30-06.jpg
    It also seems that the clouds only support one directional light at a time. I use two (sun+moon) and I have to turn off the sunlight to make the moon effect them, however this might be just a bug.
     
    Gekigengar, soleron, Malbers and 14 others like this.
  2. merpheus

    merpheus

    Joined:
    Mar 5, 2013
    Posts:
    202
    My feedback is, cloud layers are too thin, for example red dead redemption 2 has multiple layers and looks a lot more believable and realistic. Being able to add thicker layers/more layers with different noise patterns would be great!

     
    Gekigengar, soleron, NotaNaN and 6 others like this.
  3. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    Well, you can...
    Using the manual mode gives you all the control you need, it's just about designing your lookup textures and tweaking the parameters.
    screen_1920x1080_2021-03-22_06-20-45.jpg
     
    NotaNaN, mariandev, BATTLEKOT and 4 others like this.
  4. Onigiri

    Onigiri

    Joined:
    Aug 10, 2014
    Posts:
    486
    I would love to see good translucent shadows in the future for stuff like volumetrics and particles(also dreaming about something like volumetric output for shader graph)
     
    Ruchir likes this.
  5. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    Current we indeed support only one directional light as a light source for the clouds. That is a consequence of HDRP's unique "Sun" mechanic (We say sun, but we mean dominant directional light that casts shadows).

    That said as long as you don't have the lighting of both your sun and your moon at the same time affecting your clouds it should be just fine.

    The sun is the first shadow casting directional light. If that is not practical to define your current "sun" (between your sun and your moon) maybe we could think of an explicit flag on the light to define the current "Sun" (aka dominant directional light that casts shadows and should be used for clouds).

    (I hope I made it clear, tell me if I didn't).

    For the shadows we are aware of that limitation, we will handle the over-cloud volume issue and will also offer a better shadow casting technique panel in the future.
     
    BATTLEKOT and chap-unity like this.
  6. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    Indeed, by using the manual mode you can decide to go for more stylized clouds like the ones you can find in RDR2. It is a bit trickier to setup than the simple or advanced modes but (almost) any cloud profiles remain possible.
     
    Lex4art likes this.
  7. merpheus

    merpheus

    Joined:
    Mar 5, 2013
    Posts:
    202
    nice!
    yeah then, I would say better presets that would allow us to get these types of results w/o going into the manual design process would be much appreciated. :)
     
    andreyefimov2010 likes this.
  8. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    Yeah this would be really helpful as right now it sometimes gets a bit confusing when handling day-night cycles
     
  9. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    Is this available in the latest alpha (a9) or did you use the GitHub repo?
     
  10. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    Also, it will be helpful if the game object could cast shadows on the cloud as I'm imagining it to be the case for some sort of stylized high rise building or mountains maybe
     
  11. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    Yea it's in the latest alpha.
     
    Ruchir likes this.
  12. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    934
    >Also, it will be helpful if the game object could cast shadows on the cloud as I'm imagining it to be the case for some >sort of stylized high rise building or mountains maybe

    Hi, The current cloud feature is optimized to be seen from the ground (i.e it is not good to fly inside the cloud or be above it). Future version will extent the usage to other cases (at a cost).
     
    Ruchir, mariandev, BATTLEKOT and 2 others like this.
  13. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    For some reason they are not rendered for me, I enabled them in volume and render settings but I'm not seeing any changes when I enable them nor I have an option to select them in the clouds option of the visual environment:(
     
  14. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    766
    Hey @Ruchir, first, there's no dropdown to select volumetric clouds in the visual environement. The "background clouds" select is only for the "flat" layer of cloud provided with the cloud layer override. (which can be used in combination with the clouds)

    Secondly, be sure that volumetric clouds is enabled in your HDRP default settings (to be able to see them in scene view)
    Third, volumetric clouds are displayed far away most of the time and the default far camera plane is set to 1000m by default (1km), so too see them, you'll need to increase this in your "game view camera" and in your scene view camera too by disabling dynamic clipping there.

    Hopefully, this should be enough.
     

    Attached Files:

    FernandoMK likes this.
  15. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    Yeah I forgot about the default settings, Thanks :)
     
  16. m0nsky

    m0nsky

    Joined:
    Dec 9, 2015
    Posts:
    257
    There's a great video showcasing the RDR2 volumetric clouds here. Would love to be able to fly through and above them using HDRP volumetric clouds, even if this means extra performance cost. (starting at 2:30)

     
  17. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    Haha, you have no idea how hacky and heavily scripted this hot air balloon scene was in practice. ;)

    Also, remember the balloon flies at a very slow speed, so this avoids/minimizes a lot of sampling artifacts. With the volumetric clouds in Unity, you can fly through them too, as long as you're aware of the temporal accumulation issues (or you can increase the number of samples to reduce them, at the price of cost).

    At the moment, the presets we provide (sparse/cloudy/overcast/stormy) are mainly tuned for "on the ground" scenarios, where the tiling is less visible than "outer space" ones. The former represents the vast majority of use cases. In the latest version of HDRP, we pushed improved presets btw, with higher frequency details and even less visible tiling than previously.

    Of course, if you need more fantasy clouds and need to fly through them and be frequently above them, you'll certainly want to invest more time into the system and create your own cloud coverage maps and LUTs to have more layers. This is something you can easily do either with the "Manual" or "Advanced" mode. The system is very flexible in that regard: you get 1-click Simple presets out of the box (which indeed are quite generic, by definition), and if you want, you are more than welcome to push it further with your own maps.

    I will produce a Unite Now video about the volumetric clouds to explain the system in more detail, especially the custom LUT part, as this can be fairly complicated to grasp. Probably for the second half of this year.

    And thanks to all of you for the feedback!
     
    soleron, Cyril_m, NotaNaN and 10 others like this.
  18. m0nsky

    m0nsky

    Joined:
    Dec 9, 2015
    Posts:
    257
    Hah, if that's the case then I have some idea what's going on.
    I don't have any graphics/master branch running here. Is there currently any functionality for (slowly) transitioning between these presets at runtime? I'm looking forward to the Unite Now video.
     
  19. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    If you use the "Simple > Custom" preset, you can do transitions easily, from super sparse clouds, all the way to giant storm clouds. It's just a matter of tuning a handful of sliders to tune the noise levels and density, as well as altitude and thickness; and you get a very flexible dynamic system.

    Alternatively, you can feed a render texture for the more complex "Manual" mode, so you're free to do all sorts of crazy weather transitions this way, by generating your own cloud coverage map on the fly.
     
    m0nsky and Ruchir like this.
  20. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    Would really love to get some insights into how they pull off these tricks :)
     
  21. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    I know that only one directional light is supposed to cast shadows and that's totally fine, but I need both the sun and moon light to have the PBSky properly simulated, especially at dawn/dusk.
    And suddenly turning off the sun when the moon appears isn't a good solution in this case.
    So atleast make it pick the real "sun" (which is the shadow casting light) automatically.

    I'd like to use both solutions together, but unfortunately they use inconsistent lighting.
    The cloud layer has a very different and simplistic lighting model and obviously doesn't match the lighting of the volumetric clouds, so it's impossible to use both in combination.
     
    DrSeltsam likes this.
  22. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    Btw it would be really helpful if some of the settings like cloud offset are available in the simple mode as well
     
  23. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Would be lovely to get some artist tuned samples for volumetric clouds too to get better impression what all we could achieve with this visually.
     
    m0nsky likes this.
  24. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    I found some bugs in this version of volumetric clouds where they just seem to flicker a lot like the temporal accumulation is completely disabled and are hardly visible at all, also towards the end you can see it doesn't really look natural how it fades into the fog when going below the ground plane
     
  25. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    Thanks, please report the issue (Help > Report a Bug, in Unity), with a stripped-down version of the project (already looks like one). It might be hardware/driver-related as well, it's not something we've experienced so far afaik.
     
  26. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    I really don't know how to reproduce this issue as I can't figure out a particular reason or a way to reproduce it :(
    It is hit and miss kind of bug
     
  27. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    You need a more correct basis and the problem gets a lot easier. Switching on a moon light when you switch off the sun light is wrong and is just creating unnecessary problems. Base it all on luminance. It's a relatively small amount of additional work for a much improved outcome.

    So you have body luminance, ambient luminance, and then DL's are simply a thing that a dominant body gets in a specific luminance range. What you will end up with in a sun/moon scenario is a fairly large gap where there is no DL on at all. The ambient light will be dominant.

    Directional lights are really an engine construct for performance reasons. So it's easy to conflate things here that really shouldn't be.
     
  28. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    Not sure what you are referring to, but the entire rendering (and the ambient light ofc) of the PBSky depends on the directional lights as they are the only source of light (except the sky emission texture). So you cant just turn them off or arbitrary manipulate them, because it would just break the sky rendering in an unrealistic manner.
     
  29. id0

    id0

    Joined:
    Nov 23, 2012
    Posts:
    455
    I did all of this, and still don't see any clouds, only shadows from them on the ground.
     
  30. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    Try increasing the far plane to something like 10km or 50 km
     
  31. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    I'm sorry for mentioning other engines, but I'm really curious -- if anyone has experience with both volumetric clouds in Unity & Unreal, how does unity's VC perform?

    If no one has experience with both, I'll check it out soon when I got time
     
  32. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    Last I checked Unreal's cloud do look better at default settings(didn't really know much as to how to customize them much, so can't go much into details) but somehow the performance was much worse for me, Unity's volumetric cloud does seem like a nice compromise between performance and quality, they look pretty good for in 90% of the situations(i.e, for when you are not above them or inside them) and if Unity provide a better shading and shadowing model in the future for those who need it, I don't think there's anything we are missing out on :)
     
  33. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
  34. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    All this at around 190 FPS for me ;)
     
  35. id0

    id0

    Joined:
    Nov 23, 2012
    Posts:
    455
    It's not helping, no clouds. What a hell?
     
    mrrusby likes this.
  36. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    Could you share the settings for this, I haven't been able to get something like this :(
     
  37. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    Hey guys, just in case, here are some tests I did several weeks ago, tuning the different presets and experimenting with the "Simple>Custom" mode.

    And here's a short video teaser showing the system in action, with the wind and cloud shadow interactions: https://drive.google.com/file/d/11mUntFgsDbvGfzZ-uySkBP_iR8K_9Hiz/view?usp=sharing

    The video is actually fairly out of date and only used an earlier implementation. Remember it's only meant to be released with HDRP 12 (end of the year with Unity 2021.2), so there will be more improvements/fixes coming. For now, the system is tuned to work very efficiently.

    Screenshot8.jpg

    Screenshot4.jpg

    Screenshot1.jpg

    Screenshot9.jpg
     
    NotaNaN, JamesArndt, keni4 and 12 others like this.
  38. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Are the volumetric clouds coming to URP at any point (for compute capable devices)?
     
    JamesArndt likes this.
  39. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    Well I'm still experimenting with this too and I'm slowly getting appealing results.
    In case you just want to know how to author the textures, then read the related documentation.
    https://github.com/Unity-Technologi...ic-Clouds.md#cloud-map-and-cloud-lookup-table
    I'm using substance designer to create them.
    You can find the textures(just the LUT though) for the preset clouds in ..."YourProjectName"\Library\PackageCache\com.unity.render-pipelines.high-definition@12.0.0\Runtime\RenderPipelineResources\Texture\VolumetricClouds

    I noticed that the lighting (using the PBSky) of the clouds isn't effected by the actual position of the sample points in world space, so I looked at the clouds shader code and found out that the lighting is always sampled at origin (0,0,0) and not where the clouds actually are.
    Will this be fixed in a later version or atleast add an option for it?
    Because I'd like to have proper physical lighting especially at higher cloud altitudes at dawn/dusk (it currently behaves like the earth is flat).

    Another question;
    Will there be some sort of point light support for the clouds, in case someone wants to simulate thunderstorms with lightning?
     
    Ruchir, m0nsky and rz_0lento like this.
  40. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    The clouds only rely on the global ambient probe. There is no cloud-specific probe system at the moment.

    No point light support for now, but that's a feature I'd like to have.
     
    Ruchir likes this.
  41. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    I should have made it clearer...
    I was primarily referring to the directional light behaviour, not the ambient light.
    The ambient light doesn't change much anyway, but the directional light does.
    On a low sun altitude the lower clouds can be lit with a red-orange light while the upper clouds are still yellowish-white, but currently they are all lit uniformly regardless of their height/position.

    As I said earlier this is due to the fact that the lighting is always sampled at world origin "float3 X = float3(0.0, 0.0, 0.0);" in this specific function.
    Code (CSharp):
    1. EnvironmentLighting EvaluateEnvironmentLighting(CloudRay ray)
    2. {
    3.     // Sun parameters
    4.     EnvironmentLighting environmentLight;
    5.     environmentLight.sunDirection = _SunDirection.xyz;
    6.     environmentLight.sunColor = _SunLightColor.xyz * (_ExposureSunColor ? GetCurrentExposureMultiplier() : 1.0);
    7.     environmentLight.ambientTerm = SampleSH9(_AmbientProbeCoeffs, ray.direction) * GetCurrentExposureMultiplier();
    8.  
    9. #ifdef PHYSICALLY_BASED_SUN
    10.     if(_PhysicallyBasedSun == 1)
    11.     // TODO: move this into a shared function
    12.     {
    13.         float3 X = float3(0.0, 0.0, 0.0);
    14.         float3 C = _PlanetCenterPosition.xyz;
    15.  
    16.         float r        = distance(X, C);
    17.         float cosHoriz = ComputeCosineOfHorizonAngle(r);
    18.         float cosTheta = dot(X - C, environmentLight.sunDirection) * rcp(r); // Normalize
    19.  
    20.         if (cosTheta >= cosHoriz) // Above horizon
    21.         {
    22.             float3 oDepth = ComputeAtmosphericOpticalDepth(r, cosTheta, true);
    23.             // Cannot do this once for both the sky and the fog because the sky may be desaturated. :-(
    24.             float3 transm  = TransmittanceFromOpticalDepth(oDepth);
    25.             float3 opacity = 1 - transm;
    26.             environmentLight.sunColor.rgb *= 1 - (Desaturate(opacity, _AlphaSaturation) * _AlphaMultiplier);
    27.         }
    28.         else
    29.         {
    30.             // return 0; // Kill the light. This generates a warning, so can't early out. :-(
    31.            environmentLight.sunColor = 0;
    32.         }
    33.     }
    34. #endif
    35.     return environmentLight;
    36. }
    37.  
     
    Ruchir likes this.
  42. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    upload_2021-3-28_10-20-5.png
    In unreal, they have a workflow to paint the clouds in-engine, something really nice to have in unity as well :)
    I remember someone had a custom open-source system for unity that also had these features
    https://github.com/kode80/kode80CloudsUnity3D

    Unity could implement something similar
    It also has a cubemap generator but I guess we could just bake a cubemap using reflection probes ourselves.

    Sorry to compare it with unreal, but I'm just curious if we will ever get clouds that match this kind of quality?
    upload_2021-3-28_10-16-3.png
    upload_2021-3-28_10-16-11.png

    Because right now although they are functioning and are good enough for many cases, their shading is still not on par with what you see here, and considering that I am just a gameplay programmer I don't think I'll be able to modify the default system to such an extent(the default LUT, etc), nor do I have a Big team(anyone else actually :oops:) that could help with this,(my point being that most users will stick to the default settings and modify them a bit instead of making complete new maps)
     
  43. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    Also, I'm trying to make something like (without the shadow part right now) but haven't been able to do it, It would be really helpful if could include an example for this kind of situation.
    When I modify the PBS Sky to have such a small radius(4km) it just starts glitching out, and on actual earth like scale it hardly is feasible to make some like this, considering unity doesn't support 64-bit precision(I tested it but didn't work for me, started having a lot of rendering bugs when zoomed out
    upload_2021-3-28_10-57-38.png

    I have also placed a sphere of the same size(8000 scale) at the center of the planet, and volumetric fog doesn't support this kind of setUp(spherical planet like fog) by default so, I can't really go anywhere except the top part where it's above the global ground level
    You can see some strange blue glow in the background here:
    upload_2021-3-28_11-2-0.png
    also, I wasn't able to figure out how to change the radius for the volumetric clouds, the curvature setting doesn't really help in this case

    I think I should make a separate thread if these are valid concerns at this point
     
    PutridEx likes this.
  44. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    Could we have Planet radius or something like that setting to be consistent with the PB sky? Because currently I have no idea, how to properly match them.
    upload_2021-3-28_11-37-6.png
     
    Last edited: Mar 28, 2021
  45. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    Also it would be great if we will finally get a spherical variant of Fog.
     
    Ruchir likes this.
  46. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    And since there is no Planet Position property it doesn't respect it too?
     
  47. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    The PBSky itself has spherical fog implemented but unfortunately the whole sky rendering is only applied to the background. We still need an option to draw it ontop of objects, to properly simulate it's atmosphere.
     
    Ruchir likes this.
  48. id0

    id0

    Joined:
    Nov 23, 2012
    Posts:
    455
    Still can't see damn clouds, no matter what setting I change. I'm on 2021.2 a10, HDRP 12 and use dx11.
     
    Last edited: Mar 28, 2021
  49. merpheus

    merpheus

    Joined:
    Mar 5, 2013
    Posts:
    202
    You need to enable them from HDRP Asset settings.
     
  50. id0

    id0

    Joined:
    Nov 23, 2012
    Posts:
    455
    Do you think I'm an idiot? Of course I was enable it. I turn everything on, and still nothing.
    I see shadows from the clouds, but no clouds. I increase camera view on 50000 but no clouds on the sky.