Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  3. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

HDRP 12 Cloud volume

Discussion in 'Graphics Experimental Previews' started by Ruchir, Feb 21, 2021.

  1. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    From what I tested in 2021.2a5(HDRP 12) I found these problems really standing out to me:
    • The cloud's shading doesn't get affected by the rotation of the sun (i.e, when using physically-based sky we have sunset color but the clouds stay bright white) which really looks bad
    • The shadow casting appears to be just some sort of projection of tiled texture offset in different channels but it doesn't match up with the actual cloud projection in the sky. For ex, I can see the sun clearly from the parts that should have been in shadow and vice versa.
    • Also, the cloud shading doesn't look at par with actual clouds, and increasing the no. of steps doesn't really look good, although This could simply be the limitation of this implementation.
    I get that this is still in the experimental stage but just wanted to draw attention to those things
     
    ftejada and iamarugin like this.
  2. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    595

    Nice input, interresting to see that the same issues exist with third party solutions as within too.


    To get clouds and pbs working together we had to recalculate retarget the sky colour and lighting volumes from to the Atmospheric Attenuation back to the cloud system.

    The issue ifor us was that HDRenderPipeline.EvaluateAtmosphericAttenuation is private and of course extremely bad practise to edit unity packages.
    since it's a private static class there's not really much we can do at this point, even inheritence which would be the ideal course, seems impossible.

    Code (CSharp):
    1.  
    2.          /// <summary>
    3.         /// Gets or add then returns the HD light data on as light
    4.         /// </summary>
    5.         /// <param name="light"></param>
    6.         /// <returns></returns>
    7.         private HDAdditionalLightData GetHDLightData(Light light)
    8.         {
    9.             if (light == null)
    10.             {
    11.                 return null;
    12.             }
    13.  
    14.             HDAdditionalLightData lightData = light.GetComponent<HDAdditionalLightData>();
    15.             if (lightData == null)
    16.             {
    17.                 lightData = light.gameObject.AddComponent<HDAdditionalLightData>();
    18.             }
    19.  
    20.             return lightData;
    21.         }
    22.         /// <summary>
    23.         /// Processes Atmospheric Attenuation
    24.         /// </summary>
    25.         /// <param name="color"></param>
    26.         /// <param name="light"></param>
    27.         /// <returns></returns>
    28.         private Color ProcessAtmosphericAttenuation(Color color, Light light)
    29.         {
    30.             if (light == null || m_skyVolume == null || m_physicallyBasedSky == null)
    31.             {
    32.                 m_skyVolume = GetSkyVolume();
    33.             }
    34.  
    35.             Color newColor = color;
    36.             if (m_physicallyBasedSky != null)
    37.             {
    38.                 Vector3 sunTransm = HDRenderPipeline.EvaluateAtmosphericAttenuation(m_physicallyBasedSky, -light.transform.forward, Camera.main.transform.position);
    39.                 newColor.r *= sunTransm.x;
    40.                 newColor.g *= sunTransm.y;
    41.                 newColor.b *= sunTransm.z;
    42.             }
    43.  
    44.             return newColor;
    45.         }
    46.         /// <summary>
    47.         /// Gets the sky volume and assigns the physically absed sky
    48.         /// </summary>
    49.         /// <returns></returns>
    50.         private Volume GetSkyVolume()
    51.         {
    52.             Volume[] volumes = GameObject.FindObjectsOfType<Volume>();
    53.             if (volumes.Length > 0)
    54.             {
    55.                 foreach (Volume volume in volumes)
    56.                 {
    57.                     if (volume.sharedProfile != null)
    58.                     {
    59.                         VolumeProfile profile = volume.sharedProfile;
    60.                         if (profile.TryGet(out PhysicallyBasedSky sky))
    61.                         {
    62.                             m_physicallyBasedSky = sky;
    63.                             return volume;
    64.                         }
    65.                     }
    66.                 }
    67.             }
    68.  
    69.             return null;
    70.         }
    71.  
    72.     }
    Hope this helps you or someone else working on this though :)
     
    Last edited: Mar 24, 2021
    ftejada, iamarugin and Ruchir like this.