Skip to content

Fixed the fade in mode of the clouds not impacting the volumetric clouds shadows (case 1381652). #6511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 1 addition & 4 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed compilation issue related to shader stripping in ray tracing.
- Fixed flipped UV for directional light cookie on PBR Sky (case 1382656).
- Fixing missing doc API for RTAS Debug display.
- Fixed AO dissapearing when DRS would be turned off through a camera, while hardware drs is active in DX12 or Vulkan (case 1383093).
- Fixed misc shader warnings.
- Fixed a shader warning in UnityInstancing.hlsl
- Fixed for APV debug mode breaking rendering when switching to an asset with APV disabled.
- Fixed the fade in mode of the clouds not impacting the volumetric clouds shadows (case 1381652).

### Changed
- Converted most TGA textures files to TIF to reduce the size of HDRP material samples.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ void UpdateShaderVariableslClouds(ref ShaderVariablesClouds cb, HDCamera hdCamer
float groundShadowSize = settings.shadowDistance.value;

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

if (HasVolumetricCloudsShadows(hdCamera, settings))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1573,7 +1573,7 @@ void ComputeVolumetricCloudsShadow(uint3 currentCoords : SV_DispatchThreadID, ui

// Compute the position of the shadow plane
#ifdef LOCAL_VOLUMETRIC_CLOUDS
float3 shadowCookieCenterWS = float3(_WorldSpaceShadowCenter.x, _ShadowPlaneOffset, _WorldSpaceShadowCenter.y) + t * _SunDirection.xyz;
float3 shadowCookieCenterWS = float3(_WorldSpaceShadowCenter.x, _ShadowPlaneOffset, _WorldSpaceShadowCenter.z) + t * _SunDirection.xyz;
#else
float3 shadowCookieCenterWS = t * _SunDirection.xyz;
#endif
Expand Down Expand Up @@ -1612,6 +1612,10 @@ void ComputeVolumetricCloudsShadow(uint3 currentCoords : SV_DispatchThreadID, ui
// Compute the cloud density
CloudProperties cloudProperties;
EvaluateCloudProperties(positionWS, 0.0, 0.0, true, true, cloudProperties);

// Apply the camera fade it to match the clouds perceived by the camera
cloudProperties.density = DensityFadeIn(cloudProperties.density, length(positionWS - _WorldSpaceShadowCenter.xyz));

if (cloudProperties.density > CLOUD_DENSITY_TRESHOLD)
{
// Apply the extinction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,10 @@ unsafe struct ShaderVariablesClouds

// The size of the shadow region (meters)
public Vector2 _ShadowRegionSize;
public Vector2 _PaddingVC0;

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

// View projection matrix (non oblique) for the planar reflection matrices
public Matrix4x4 _CameraViewProjection_NO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ CBUFFER_START(ShaderVariablesClouds)
int _ShadowCookieResolution;
float _ShadowPlaneOffset;
float2 _ShadowRegionSize;
float2 _WorldSpaceShadowCenter;
float2 _PaddingVC0;
float4 _WorldSpaceShadowCenter;
float4x4 _CameraViewProjection_NO;
float4x4 _CameraInverseViewProjection_NO;
float4x4 _CameraPrevViewProjection_NO;
Expand Down