Search Unity

Feedback Volumetric Clouds

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

  1. LumaPxxx

    LumaPxxx

    Joined:
    Oct 3, 2010
    Posts:
    339
    K~MT5@_QAMGV[5QN1~6WBGU.jpg
    S2{CQM5B`T{S_UWFGPHO]A2.jpg
    (JLH%DVJKUJU$B04)(MP]C7.jpg

    Hello,i've tried the new Cloud Layer in 2022.2.0a13.
    it's sooooooo beautiful,i love it !
    thank you for your hard work !

    just a small bug or something i haven't figured out.
    the default tint color of the Cloud Layer seems a bit yellow...?
    i have to use a blue tint color for it to blend with the volumetric clouds.

    tint1.jpg
    tint2.jpg
     
  2. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    766
    Hey, thanks for the positive feedback, it's much appreciated.

    The only thing missing (to make the lighting match) in the cloud layer right now is the ambient probe contribution (which the volumetric clouds has). So this is why you are seeing this discrepancy. (if you put ambient probe dimmer to 0 in the volumetric clouds, they should match)

    It's known and not complicated to add and it will probably be done soon.

    It's more a matter of design on where to control both ambient probe dimmer for both cloud system than a technical limitations.
     
    Last edited: Jun 15, 2022
    bdb400, ftejada, AdamGoodrich and 5 others like this.
  3. KYL3R

    KYL3R

    Joined:
    Nov 16, 2012
    Posts:
    135
    Hey, I tried reproducing in a new project, didn't work. Though I found out it's related to the "Lighting Override Mask" (Edit-> Project Settings ->HDRP ->Sky->Lighting Override Mask) so I will check if it's a bug or if I just didn't configure that correctly.
     
  4. glatteinfo

    glatteinfo

    Joined:
    Nov 17, 2019
    Posts:
    19
    Hello! I have been trying to create a weather system using volumetric clouds + physically based sky. The main challenge for me was to create smooth transitions - i.e. in-between presets or single properties. One method I tried was to use Animator and to transition over time in between profiles. It has the downside, that it "resets" the clouds if I transition in between i.e. overcast and cloudy instead of smooth transitioning from one to another.

    Then I went and tried to transition 2 values of a single preset (cloud thickness and altitude) by code over time.deltatime . It does the trick (at least for single properties). However, it also produces artifacts of your screen edges in the clouds when you rotate the camera (they disappear after a few seconds) and it forces you to disable Realtime Global Illumination, since it gives the error "UpdateEnvironment readback buffer overflow, please schedule fewer updates." if you don't.

    I then went ahead and tried to gradually increase aerosol density over time. This produces sudden light changes once the increase stops and completely kills the performance.

    Is there a "right" or better way to transition between profiles, presets and/or individual properties over time? And will there be the option in the future to adjust individual properties over time using the animator?

    Thanks for any answer in advance!

    P.s. and if you would have a hint for me how to adjust Shadows, Midtones, Highlights from code.. i tried:

    Skyvolume.TryGet<ShadowsMidtonesHighlights>(out ShadowsMidtonesHighlights shadows);
    shadows.shadows.value.Set(-1, 1, 1, 100);


    gives me no errors but doesn't work and also returns wrong values in debug
     
    Last edited: May 18, 2022
  5. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    766
    With the current public (non alpha) version, there's no clean way of blending properly.

    This is why it has been improved very recently and some parameters have been replaced by curves to allow users to interpolate between the presets.

    You can have a sense of the change here.
    This is not the final PR, (the final one is not public anymore).
    The improvement has landed and is technically available in the last public alpha (2022.2.0a15)
     
  6. glatteinfo

    glatteinfo

    Joined:
    Nov 17, 2019
    Posts:
    19
    Thanks a lot - at last my mind can rest and I know it's not just me :) ! I'll just sit back tight then and wait for the next public release or try the alpha. Thanks again!

    P.s. Are there plans to allow adjustment of individual HDRP Postprocessing and VS parameters through Animator/Animations in the future?
     
  7. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    is there a way to exclude volumetric clouds from being rendered into the cubemap in:
    UpdateSkyEnvironment -> RenderSkyToCubemap?
    VolumetricCloudsTrace takes 0.8ms on my rtx2060 rendering to a 128px cubemap and i really do not need clouds here.
     
    Last edited: May 19, 2022
    PutridEx likes this.
  8. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    766
    By the way, theses are due to the temporal accumulation of the volumetric clouds, lowering this value (something like .7 or .8) should drastically reduce the artifacts you see on screen.

    Also, one simpler way to blend between profile of clouds (or other post process) is to use the volume system.
    You can have two different volume both with volumetric clouds overrides but with slightly different settings and then you just have to adjust the "weight" property of the volume themselves (cf documentation) to change the appearance of the clouds.

    Hope that helps.
     
    Deleted User likes this.
  9. glatteinfo

    glatteinfo

    Joined:
    Nov 17, 2019
    Posts:
    19
    thanks a lot! the temporal accumulation fix is a great tip. As for the volumes and blending their weights - that was my first attempt, but it seemed that it does not do what I expected, which is actually blending the properties so i.e. transitioning the size from small clouds in the original volume to bigger clouds in the target volume. Instead, it looks like in the first frame of the weight transition, a set of new clouds of the second volume appear which then gradually blend in. That creates a very hard transition. But maybe I did something wrong.. I'll try again since you say it's possible!
     
    Last edited: May 21, 2022
  10. alti

    alti

    Joined:
    Jan 8, 2014
    Posts:
    94
    how do you control the directional light that effects the clouds? It seems to choose it itself, which makes things unpredictable / unmanageable.
    What if we want to use a light to light the clouds that does not cast shadows? Is this possible?
    It worked in an earlier version of unity, but after going to the new LTS version, the light I used for cloud effects (lightening) stopped working. Now the lighting only works when I turn the shadow light off, which can't happen. Is there a better way to give the impression of thunder / lightening?

    I feel like if you has made the scattering tint color hdr, this wouldn't be an issue, an we as artists and developers would have a lot more freedom. Is there a way to change that, or is there some deeper reason it wasn't made HDR?
     
    Last edited: Jun 14, 2022
    ftejada likes this.
  11. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    We finally need some kind of point light support, that would perfectly fit to simulate lightning.
     
    Gooren and ftejada like this.
  12. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Couple of questions - haven't tested origin shifting with these clouds (local ones) but I expect there's some scheme or other to do.

    Also point lights seem interesting in both local and non local scenarios.
     
    Gooren likes this.
  13. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    How do you get these light beams aka god rays from the volumetric clouds? I have my directional light with volumetric intensity of max 16 and I don't see anything ...
     
  14. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    Hey, have a look at this scene I shared here:
    https://forum.unity.com/threads/volumetric-clouds.1078811/page-13#post-7940989




    The reason you're not seeing the fog is probably because your volumetric fog doesn't extend far enough from the camera (nor high enough).
     
  15. SkandYxyz

    SkandYxyz

    Joined:
    Mar 13, 2015
    Posts:
    83
    I use crest, which uses shader graph together with raytraced reflections. Am I missing something or is the reflection wrong?
    upload_2022-7-30_17-52-24.png
    I would expect this result from screen space reflection (KWS Water):
    upload_2022-7-30_17-54-41.png

    It seems to be the difference between raytracing and raymarching.

    Thank you in advance,
    Andre
     
  16. Lex4art

    Lex4art

    Joined:
    Nov 17, 2012
    Posts:
    445
    Maybe tweaking this parameter will fix pixelization in ray tracing mode (with the cost of performance):
    Vol sky res.png
     
  17. SkandYxyz

    SkandYxyz

    Joined:
    Mar 13, 2015
    Posts:
    83
    I increased the resulution and it looks better. But what I found out is that the reflection stays while the clouds are moving.
    upload_2022-7-30_18-16-6.png
    upload_2022-7-30_18-17-10.png
    When I change the Reflection cubemap size it is synced again. This should be a realtime sky reflection probe I guess?
    It is indeed updated, when I change the Directional Light and thus the physically based sky.

    Found out there is an option in the physically based sky to update the sky reflection probe frequently.
    upload_2022-7-30_18-28-13.png
     
    Last edited: Jul 30, 2022
  18. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    Hey, all sky types have an "Update Mode". If you want their reflection (including clouds) to be updated in real-time, set the sky to Real-time update, with a lower period (0 means every frame).Try to keep this update period as high as possible to reduce the cost. The actual resolution of the reflection is set in the HDRP asset, Lighting > Sky.

    2022-07-30_17-59-53.gif
     
    mariandev, newguy123, Ruchir and 4 others like this.
  19. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    I also need point light support. One does not simply simulate lightning without it.
    Is there any time frame for it?
    HDRP Volumetric Clouds tick all the boxes for us, except for this one thing.
     
    SebLazyWizard likes this.
  20. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    Point lights to affect the volumetric clouds?
     
  21. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    Oh hell yeah, it should be enough to just put a strong point light inside the clouds and enable Volumetrics on that light.
    Surrounding clouds should then be lit by that light. This is necessary for a good looking lightnings.
     
  22. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    It is not as trivial as that unfortunately. It is something we'll eventually support, but not in the immediate future.
     
  23. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    Dayum :(
    Any ideas on some workarounds? I could use a local volumetric fog that supports volumetric lights. And put it high in the sky while using cloudy preset. That way, it should not look out of place, but not sure about blending of these two etc.

    Also is there a way to find out where clouds are located on XZ plane?
    This would be useful to make it rain only below the clouds.
     
  24. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Render your effects before the cloud, in the skybox for example, or even opaque with suitable bloom, and the cloud will render after it with suitable extinction, so it might be close enough.
     
    Gooren likes this.
  25. Wawruch2

    Wawruch2

    Joined:
    Oct 6, 2016
    Posts:
    68
    I was wondering if you could add custom Erosion Noise Type in a texture format. I think it would help a lot. Is this something you would consider?
     
  26. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Can you give me an example? Right now you can set any 3d texture as the detail noise...
     
  27. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    Any news on PlanetCenterPosition setting?
     
  28. Wawruch2

    Wawruch2

    Joined:
    Oct 6, 2016
    Posts:
    68
    @jjxtra You can't control this one in any type of Cloud Control. I think it would help me customize the shape of moving clouds.
     

    Attached Files:

  29. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    766
    Piggybacking on my own comment to link the issue tracker about this missing part.
    It has been fixed on latest version (2023.1) and will be backported to 2022.2 at least.
     
  30. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    I'm noticing these artifacts. The artifacts only appear in the mac standalone build and not in unity editor.
    Any ideas what might be causing this or how I can go about fixing it?
    Unity 2021.3.1f1

    Screen Shot 2022-10-15 at 12.52.14 AM.png
     
  31. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    Strangely, I get similar issues in 2023.1 on PC, in Editor, when I iterate and switch often between raytracing override volumes, and pathtracing. IE switching on/off pathtracing and off again, 30% of the time I get these artefacts also and only way to get rid of it is to restart the editor....
     
  32. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
  33. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    Btw, in case you missed this blitz day post, we're adding a 3rd level of noise to the clouds.

    It's particularly useful for short to mid range details, and makes them significantly more detailed in most situations.

    Each preset will come with a "Performance" (2 levels of noise) and a "Quality" (3 levels of noise) mode:





     
    Last edited: Oct 21, 2022
    LumaPxxx, OCASM, Ziddon and 9 others like this.
  34. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    595
    I saw the blitz day post and thought to myself that Anis and Pierre are having a high 5 moment on this.

    Really really nice results
     
  35. thephox1982

    thephox1982

    Joined:
    Jan 21, 2022
    Posts:
    20
    Thanks, but I am still unable to get shadows from volumetric clouds in 2021.3 LTS, I just given up and proceeding without it.
     
  36. Jack_Martison

    Jack_Martison

    Joined:
    Jun 24, 2018
    Posts:
    143
    What can we expect from performance standpoint? I really like "Quality" preset
     
  37. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    You should report a bug, this is not normal. Maybe you have an incorrect setup, or a conflict with another shadowcasting feature, or another asset from the Asset Store causing issues we can't support.
     
  38. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    504
    I thought it might have just been an issue with the water-vs-clouds, like this post from the Water thread
    But I think it's clouds vs everything else.

    In these pics, I've got the HDRP/Lit shader, but the one not sorting is set to Surface Type: Transparent. I've got support for depth pre-and post-pass enabled, even got Depth Write enabled.

    Are clouds always going to be behind anything and everything transparent, or is there some queue for them? The Sorting Priority slider doesn't seem to do anything to help.

    2022-12-11 23_56_25-Window.png 2022-12-11 23_52_07-Window.png
     
  39. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    Hello. 2022 is out and I don't see planet center position setting anywhere. So it is still hardcoded? And as I understood we can't expect it to appear any time soon?
     
  40. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    Hey,

    The unification of the planet parameters for the various HDRP effects (Sky, Fog, VClouds and Water) is a quite complex task (it is not just about the planet center position).

    It is something that we defined on paper, but the work is not done yet. The earliest it may arrive is 2023.2.

    Thank you for your patience,
     
    ashtorak and TerraUnity like this.
  41. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    Transparent objects and volumetric clouds will not work properly unfortunately, the only exception to that case is the water system that we solved in 2023.1.
     
    ashtorak likes this.
  42. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    will that also include volumetric fog shadowing? at the moment we don't have self shadowing if we use volumetric shaders. Sorry if this a bit out of topic
     
  43. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    Thanks for info. I waited for this for two years, can wait one more.
     
  44. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    So I gave the manual cloud authoring mode another shot and quickly realised that the cloud density can still only be changed in the cloud map but not in the cloud LUT, which makes it impossible to define different densities per cloud type and/or per altitude.

    I provided a solution for this back then https://forum.unity.com/threads/volumetric-clouds.1078811/page-2#post-7025461 and adopted it to the latest source code, in case someone is interested.
    Changes are made in VolumetricCloudsUtilities.hlsl starting around line 440 and are marked with "//MOD swap";
    Code (CSharp):
    1. // Function that evaluates the coverage data for a given point in planet space
    2. void GetCloudCoverageData(float3 positionPS, out CloudCoverageData data)
    3. {
    4.     // Convert the position into dome space and center the texture is centered above (0, 0, 0)
    5.     float2 normalizedPosition = AnimateCloudMapPosition(positionPS).xz / _NormalizationFactor * _CloudMapTiling.xy + _CloudMapTiling.zw - 0.5;
    6.     // Read the data from the texture
    7.     float4 cloudMapData =  SAMPLE_TEXTURE2D_LOD(_CloudMapTexture, s_linear_repeat_sampler, float2(normalizedPosition), 0);
    8.  
    9. //MOD swap //data.coverage = float2(cloudMapData.x, cloudMapData.x * cloudMapData.x);
    10.     data.coverage = float2(cloudMapData.x, 0);
    11.  
    12.     data.rainClouds = cloudMapData.y;
    13.     data.cloudType = cloudMapData.z;
    14.     data.maxCloudHeight = cloudMapData.w;
    15. }
    16.  
    17. // Function that evaluates the cloud properties at a given absolute world space position
    18. void EvaluateCloudProperties(float3 positionWS, float noiseMipOffset, float erosionMipOffset, bool cheapVersion, bool lightSampling,
    19.                             out CloudProperties properties)
    20. {
    21.     // Convert to planet space
    22.     float3 positionPS = positionWS + float3(0, _EarthRadius, 0);
    23.  
    24.     // Initliaze all the values to 0 in case
    25.     ZERO_INITIALIZE(CloudProperties, properties);
    26.  
    27.     // By default the ambient occlusion is 1.0
    28.     properties.ambientOcclusion = 1.0;
    29.  
    30.     // If the next sampling point is not inside the coud volume the density
    31.     if (!PointInsideCloudVolume(positionPS) || positionPS.y < 0.0f)
    32.         return;
    33.  
    34.     // Compute the normalized position for the three channels
    35.     float3 normalizedPos = positionPS / _NormalizationFactor;
    36.  
    37.     // Evaluate the normalized height of the position within the cloud volume
    38.     properties.height = EvaluateNormalizedCloudHeight(positionPS);
    39.  
    40.     // Evaluate the generic sampling coordinates
    41.     float3 baseNoiseSamplingCoordinates = float3(AnimateBaseNoisePosition(positionPS).xzy / NOISE_TEXTURE_NORMALIZATION_FACTOR) * _ShapeScale - float3(_ShapeNoiseOffset.x, _ShapeNoiseOffset.y, _VerticalShapeNoiseOffset);
    42.  
    43.     // Evaluate the coordinates at which the noise will be sampled and apply wind displacement
    44.     baseNoiseSamplingCoordinates += properties.height * float3(_WindDirection.x, _WindDirection.y, 0.0f) * _AltitudeDistortion;
    45.  
    46.     // Read the low frequency Perlin-Worley and Worley noises
    47.     float lowFrequencyNoise = SAMPLE_TEXTURE3D_LOD(_Worley128RGBA, s_trilinear_repeat_sampler, baseNoiseSamplingCoordinates.xyz, noiseMipOffset);
    48.  
    49.     // Initiliaze the erosion and shape factors (that will be overriden)
    50.     float shapeFactor = lerp(0.1, 1.0, _ShapeFactor);
    51.     float erosionFactor = _ErosionFactor;
    52.  
    53.     // Evaluate the cloud coverage data for this position
    54.     CloudCoverageData cloudCoverageData;
    55.     GetCloudCoverageData(positionPS, cloudCoverageData);
    56.  
    57.     // If this region of space has no cloud coverage, exit right away
    58.     if (cloudCoverageData.coverage.x <= CLOUD_DENSITY_TRESHOLD || cloudCoverageData.maxCloudHeight < properties.height)
    59.         return;
    60.  
    61.     // Read from the LUT
    62.  
    63.     float3 densityErosionAO = SAMPLE_TEXTURE2D_LOD(_CloudLutTexture, s_linear_clamp_sampler, float2(cloudCoverageData.cloudType, properties.height), CLOUD_LUT_MIP_OFFSET);
    64.  
    65.     // Adjust the shape and erosion factor based on the LUT and the coverage
    66.     shapeFactor = shapeFactor * densityErosionAO.y;
    67.     erosionFactor = erosionFactor * densityErosionAO.y;
    68.  
    69.     // Combine with the low frequency noise, we want less shaping for large clouds
    70.     lowFrequencyNoise = lerp(1.0, lowFrequencyNoise, shapeFactor);
    71.     float base_cloud = 1.0 - densityErosionAO.x * cloudCoverageData.coverage.x * (1.0 - shapeFactor);
    72.  
    73. //MOD swap //base_cloud = saturate(DensityRemap(lowFrequencyNoise, base_cloud, 1.0, 0.0, 1.0)) * cloudCoverageData.coverage.y;
    74.     base_cloud = saturate(DensityRemap(lowFrequencyNoise, base_cloud, 1.0, 0.0, 1.0)) * densityErosionAO.y * densityErosionAO.y;
    75.  
    76.     // Weight the ambient occlusion's contribution
    77.     properties.ambientOcclusion = densityErosionAO.z;
    78.  
    79.     // Change the sigma based on the rain cloud data
    80.     properties.sigmaT = lerp(0.04, 0.12, cloudCoverageData.rainClouds);
    81.  
    82.     // The ambient occlusion value that is baked is less relevant if there is shaping or erosion, small hack to compensate that
    83.     float ambientOcclusionBlend = saturate(1.0 - max(erosionFactor, shapeFactor) * 0.5);
    84.     properties.ambientOcclusion = lerp(1.0, properties.ambientOcclusion, ambientOcclusionBlend);
    85.  
    86.     // Apply the erosion for nifer details
    87.     if (!cheapVersion)
    88.     {
    89.         float3 fineNoiseSamplingCoordinates = AnimateFineNoisePosition(positionPS) / NOISE_TEXTURE_NORMALIZATION_FACTOR * _ErosionScale;
    90.         float highFrequencyNoise = 1.0 - SAMPLE_TEXTURE3D_LOD(_ErosionNoise, s_linear_repeat_sampler, fineNoiseSamplingCoordinates, CLOUD_DETAIL_MIP_OFFSET + erosionMipOffset).x;
    91.         // Compute the weight of the low frequency noise
    92.    
    93. //MOD swap //highFrequencyNoise = lerp(0.0, highFrequencyNoise, erosionFactor * 0.75f * cloudCoverageData.coverage.x * _ErosionFactorCompensation);
    94.         highFrequencyNoise = lerp(0.0, highFrequencyNoise, erosionFactor * 0.75f * densityErosionAO.y * _ErosionFactorCompensation);
    95.  
    96.         base_cloud = DensityRemap(base_cloud, highFrequencyNoise, 1.0, 0.0, 1.0);
    97.         properties.ambientOcclusion = saturate(properties.ambientOcclusion - sqrt(highFrequencyNoise * _ErosionOcclusion));
    98.     }
    99.  
    100.     // Given that we are not sampling the erosion texture, we compensate by substracting an erosion value
    101.     if (lightSampling)
    102.         base_cloud -= erosionFactor * 0.1;
    103.  
    104.     // Make sure we do not send any negative values
    105.     base_cloud = max(0, base_cloud);
    106.  
    107.     // Attenuate everything by the density multiplier
    108.     properties.density = base_cloud * _DensityMultiplier;
    109. }
    It now reuses the erosion channel in the LUT for the density too (I used the free alpha channel before, but it turned out that erosion and density using the same value looks the best anyway). The coverage cannel in the cloud map now only controls the coverage (like it is supposed to do), but not the density.

    So finally I was able to have any cloud type / density at any given position, which is essential to create realistic cloudscapes.
    clouds3.jpg Image Sequence_003_0060.jpg Image Sequence_005_0060.jpg Image Sequence_006_0060.jpg Image Sequence_007_0060.jpg

    EDIT
    Btw, the alpha channel in the cloud map defines the maximum height of the cloud layer at the given pixel position, this isn't noted in the documentation.

    I hope Unity considers to implement the change how density is handled, so I don't have to change it manually each time a new version of HDRP releases.
     
    Last edited: Apr 18, 2023
  45. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    There's an issue with the ambient lighting of the clouds.
    It simply samples the ambient probe from two directions (up and down) and lerps between the results depending on cloud height.
    This leads to pitch black (lower)clouds when the sun is below the horizon and the planet in shadow. Image Sequence_008_0060.jpg

    I changed the ambient contribution to be more average, which greatly improves the visuals.
    Image Sequence_009_0060.jpg

    It's a simple change in VolumetricCloudsUtilities.hlsl at "EvaluateEnvironmentLighting";
    Code (CSharp):
    1. // Functions that evaluates all the lighting data that will be needed by the cloud ray
    2. EnvironmentLighting EvaluateEnvironmentLighting(CloudRay ray, float3 entryEvaluationPointWS, float3 exitEvaluationPointWS)
    3. {
    4.     // Sun parameters
    5.     EnvironmentLighting lighting;
    6.     lighting.sunDirection = _SunDirection.xyz;
    7.     lighting.sunColor0 = _SunLightColor.xyz * GetCurrentExposureMultiplier();
    8.     lighting.sunColor1 = lighting.sunColor0;
    9.  
    10. //MOD swap... more average ambient contribution
    11.     //lighting.ambientTermTop = SampleSH9(_VolumetricCloudsAmbientProbeBuffer, float3(0, 1, 0)) * GetCurrentExposureMultiplier();
    12.     //lighting.ambientTermBottom = SampleSH9(_VolumetricCloudsAmbientProbeBuffer, float3(0, -1, 0)) * GetCurrentExposureMultiplier();
    13.     lighting.ambientTermTop = SampleSH9(_VolumetricCloudsAmbientProbeBuffer, float3(0, 0.5, 0)) * GetCurrentExposureMultiplier();
    14.     lighting.ambientTermBottom = SampleSH9(_VolumetricCloudsAmbientProbeBuffer, float3(0, -0.5, 0)) * GetCurrentExposureMultiplier();
    15. ...
    16. ...
     
  46. KeithStein

    KeithStein

    Joined:
    Mar 26, 2022
    Posts:
    3
    I've been searching like mad, but can't seem to find something which I feel like should be very simple. I love the quality of these clouds, they're perfect for my needs, except I need to be able to move them without the clouds changing. I'd like to be able to just use the Simple Cloudy preset, but I need to use a floating origin (or origin re-basing) to allow for larger worlds. Literally all I need to do is just take the clouds exactly as they are, and offset them in a given direction. "Shape Offset" gets me close, but per the docs (and my testing) it effects "larger noise passing through the cloud coverage", not the clouds themselves. So when I try to shift using that, erosion details on a given cloud would change, which would be pretty jarring if someone were staring at or moving through a cloud. Clouds Offset.gif
    Notice how the shape of the cloud changes as I adjust the shape offset? I don't want to change the shape, just to move it somewhere else.

    Is there any way to accomplish what I want? I'll take whatever advice you can give, even if I have to dive down the rabbit hole of the advanced features (which I've tried, but I'll try again). And if not, will such a feature possibly exist in the future?
     
  47. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    595


    There are horizontal and vertical wind erosion controls that could be worth adjusting depending on the situation. A note to remember is that erosion textures ( high ad low frequency) continuously pass through the clouds, however, the speed and frequency at which this occurs both vertically and horizontally is up to you.

    upload_2023-4-24_10-21-5.png

    `shapeSpeedMultiplier.m_Value`
    `erosionSpeedMultiplier.m_Value`

    `verticalShapeWindSpeed.m_Value`
    `verticalErosionWindSpeed.m_Value`



    Experiment: Speed Ramping:

    1. Erosion Speed Multiplier and Vertical Erosion Wind Speed:
      • These parameters control the erosion scrolling of the small frequency in the vertical (V) and horizontal (H) directions.
    2. Shape Speed Multiplier and Vertical Shape Wind Speed:
      • These parameters control the scrolling appearance of the clouds.

      • If the shape values are set to 0, the cloud will not scroll up or down in the scene (only the smaller erosions will scroll if their values are above 0).
    How to Implement Ramping:

    1. Gradually decrease the Shape values or both the Shape and Erosion values leading up to the origin shift.
    2. Perform the origin shift.
    3. Gradually increase the values back to their original settings.
    Using this ramping technique, you should be able to smooth out any abrupt curves or changes resulting from the shifting space.
     
  48. KeithStein

    KeithStein

    Joined:
    Mar 26, 2022
    Posts:
    3
    I appreciate the response, and while the info you gave me is very helpful in terms of understanding how those parameters work, I don't see how they help me with this problem. I think I might either be misunderstanding your advice, or you may be misunderstanding my question.

    When I execute the origin shift, everything in my world will move by a few thousand meters in a single frame. I'm effectively offsetting everything by a single Vector3. I need to offset my clouds by that same Vector3.

    I've set up my volumetric clouds so that there is no wind:
    upload_2023-5-6_15-21-59.png

    When the origin move happens, I try using shapeOffset to move the clouds.

    clouds.shapeOffset.value += Shift * shapeOffsetPerMeter;

    (Through testing and research, I've found that shapeOffsetPerMeter = ~0.00005f)

    This is what it looks like from a camera that is moving along with the clouds:
    Cloud Origin Move.gif

    The finer shapes of the clouds change suddenly and very noticeably, even though their general shape stays the same.
     
    cLick1338 likes this.
  49. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    704
    I will test a bit further, but my first finding is that if you move the camera and the shape offset my a value that is a multiple of the shape scale, you will have the exact same rendering.

    upload_2023-5-24_8-24-8.png
    upload_2023-5-24_8-24-49.png

    Here the shape scale is 5, and I moved the camera and clouds by an offset of 5000, resulting in the same clouds shape.

    [Edit] According to the doc, this is more simple than that : The shape will tile itself in the [0;1] range, so if you always offset by integer values you should always have the same result.
     
    chap-unity likes this.
  50. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    704
    @unity_6E38E0973418D30049BB

    After some digging, maybe I've found your issue ?
    From what I understood, you are using the clouds in local mode, moving the camera, teleporting back to the origin and apply a shape offset to have the clouds match again.

    I think that the volumetric clouds are missing a "origin" parameter to suite your case, as the Shape Offset is only affecting the lowest frequency of the noise, and the clouds don't tile.

    Probably the best solution for you would be to disable local clouds ?