Skip to content

Commit 87fb357

Browse files
authored
Fixed the fade in mode of the clouds not impacting the volumetric clouds shadows (case 1381652). (#6511)
* - Fixed the fade in mode of the clouds not impacting the volumetric clouds shadows (case 1381652). * Update runtime dx11 screenshot * Update standalone screenshots
1 parent 107a519 commit 87fb357

File tree

9 files changed

+20
-17
lines changed

9 files changed

+20
-17
lines changed
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
7474
- Fixed compilation issue related to shader stripping in ray tracing.
7575
- Fixed flipped UV for directional light cookie on PBR Sky (case 1382656).
7676
- Fixing missing doc API for RTAS Debug display.
77-
- Fixed AO dissapearing when DRS would be turned off through a camera, while hardware drs is active in DX12 or Vulkan (case 1383093).
78-
- Fixed misc shader warnings.
79-
- Fixed a shader warning in UnityInstancing.hlsl
80-
- Fixed for APV debug mode breaking rendering when switching to an asset with APV disabled.
77+
- Fixed the fade in mode of the clouds not impacting the volumetric clouds shadows (case 1381652).
8178

8279
### Changed
8380
- Converted most TGA textures files to TIF to reduce the size of HDRP material samples.

com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/HDRenderPipeline.VolumetricClouds.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ void UpdateShaderVariableslClouds(ref ShaderVariablesClouds cb, HDCamera hdCamer
488488
float groundShadowSize = settings.shadowDistance.value;
489489

490490
// The world space camera will be required but the global constant buffer will not be injected yet.
491-
cb._WorldSpaceShadowCenter = new Vector2(hdCamera.camera.transform.position.x, hdCamera.camera.transform.position.z);
491+
cb._WorldSpaceShadowCenter = new Vector4(hdCamera.camera.transform.position.x, hdCamera.camera.transform.position.y, hdCamera.camera.transform.position.z, 0.0f);
492492

493493
if (HasVolumetricCloudsShadows(hdCamera, settings))
494494
{

com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricClouds.compute

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1573,7 +1573,7 @@ void ComputeVolumetricCloudsShadow(uint3 currentCoords : SV_DispatchThreadID, ui
15731573

15741574
// Compute the position of the shadow plane
15751575
#ifdef LOCAL_VOLUMETRIC_CLOUDS
1576-
float3 shadowCookieCenterWS = float3(_WorldSpaceShadowCenter.x, _ShadowPlaneOffset, _WorldSpaceShadowCenter.y) + t * _SunDirection.xyz;
1576+
float3 shadowCookieCenterWS = float3(_WorldSpaceShadowCenter.x, _ShadowPlaneOffset, _WorldSpaceShadowCenter.z) + t * _SunDirection.xyz;
15771577
#else
15781578
float3 shadowCookieCenterWS = t * _SunDirection.xyz;
15791579
#endif
@@ -1612,6 +1612,10 @@ void ComputeVolumetricCloudsShadow(uint3 currentCoords : SV_DispatchThreadID, ui
16121612
// Compute the cloud density
16131613
CloudProperties cloudProperties;
16141614
EvaluateCloudProperties(positionWS, 0.0, 0.0, true, true, cloudProperties);
1615+
1616+
// Apply the camera fade it to match the clouds perceived by the camera
1617+
cloudProperties.density = DensityFadeIn(cloudProperties.density, length(positionWS - _WorldSpaceShadowCenter.xyz));
1618+
16151619
if (cloudProperties.density > CLOUD_DENSITY_TRESHOLD)
16161620
{
16171621
// Apply the extinction

com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricCloudsDef.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,10 @@ unsafe struct ShaderVariablesClouds
130130

131131
// The size of the shadow region (meters)
132132
public Vector2 _ShadowRegionSize;
133+
public Vector2 _PaddingVC0;
133134

134-
// World Camera Position used as the constant buffer has not been injected yet when this data is required
135-
public Vector2 _WorldSpaceShadowCenter;
135+
// World Camera Position used as the constant buffer has not been injected yet when this data is required, last channel is unused.
136+
public Vector4 _WorldSpaceShadowCenter;
136137

137138
// View projection matrix (non oblique) for the planar reflection matrices
138139
public Matrix4x4 _CameraViewProjection_NO;

com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricCloudsDef.cs.hlsl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ CBUFFER_START(ShaderVariablesClouds)
6161
int _ShadowCookieResolution;
6262
float _ShadowPlaneOffset;
6363
float2 _ShadowRegionSize;
64-
float2 _WorldSpaceShadowCenter;
64+
float2 _PaddingVC0;
65+
float4 _WorldSpaceShadowCenter;
6566
float4x4 _CameraViewProjection_NO;
6667
float4x4 _CameraInverseViewProjection_NO;
6768
float4x4 _CameraPrevViewProjection_NO;

0 commit comments

Comments
 (0)