Skip to content

Fixed the intensity of the sky being reduced signficantly even if there is no clouds (case 1388279). #6601

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 5 commits into from
Dec 16, 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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed potential asymmetrical resource release in the volumetric clouds (case 1388218).
- Fixed the fade in mode of the clouds not impacting the volumetric clouds shadows (case 1381652).
- Fixed the rt screen space shadows not using the correct asset for allocating the history buffers.
- Fixed the intensity of the sky being reduced signficantly even if there is no clouds (case 1388279).

### 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 @@ -61,6 +61,8 @@
#define MAX_SKYBOX_VOLUMETRIC_CLOUDS_DISTANCE 200000.0f
// Maximal size of a light step
#define LIGHT_STEP_MAXIMAL_SIZE 1000.0f
// Threshold at which the clouds are considered inexistant (Found experimentally)
#define TRANSMITTANCE_DISCARD_THRESHOLD 0.992

// HDRP generic includes
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
Expand Down Expand Up @@ -1383,6 +1385,9 @@ void UPSAMPLE_KERNEL(uint3 finalCoord : SV_DispatchThreadID,
currentClouds.xyz = unapplyFastTonemapping(currentClouds.xyz);
currentClouds.w = saturate(currentClouds.w);

// Due to numerical precision issues, upscaling a bunch of 1.0 can lead to a slightly lower number, this fixes it.
currentClouds.w = currentClouds.w > TRANSMITTANCE_DISCARD_THRESHOLD ? 1.0 : currentClouds.w;

#ifdef LOCAL_VOLUMETRIC_CLOUDS
float cloudDepth = GetCloudDepth_LDS(groupThreadId, IndexToLocalOffsetCoords[closestNeighbor]);
#else
Expand Down Expand Up @@ -1460,6 +1465,9 @@ void UPSAMPLE_KERNEL_SKY(uint3 finalCoord : SV_DispatchThreadID,
currentClouds.xyz = unapplyFastTonemapping(currentClouds.xyz);
currentClouds.w = saturate(currentClouds.w);

// Due to numerical precision issues, upscaling a bunch of 1.0 can lead to a slightly lower number, this fixes it.
currentClouds.w = currentClouds.w > TRANSMITTANCE_DISCARD_THRESHOLD ? 1.0 : currentClouds.w;

// Store the upscaled result only, composite in later pass.
_VolumetricCloudsUpscaleTextureRW[COORD_TEXTURE2D_X(finalCoord.xy)] = currentClouds;
}
Expand Down Expand Up @@ -1491,6 +1499,9 @@ void COMBINE_KERNEL(uint3 finalCoord : SV_DispatchThreadID,
currentClouds.xyz = unapplyFastTonemapping(currentClouds.xyz);
currentClouds.w = saturate(currentClouds.w);

// Due to numerical precision issues, upscaling a bunch of 1.0 can lead to a slightly lower number, this fixes it.
currentClouds.w = currentClouds.w > TRANSMITTANCE_DISCARD_THRESHOLD ? 1.0 : currentClouds.w;

#ifdef LOCAL_VOLUMETRIC_CLOUDS
float cloudsDepth = LOAD_TEXTURE2D_X(_DepthStatusTexture, finalCoord.xy).z;
#else
Expand Down Expand Up @@ -1546,6 +1557,9 @@ void COMBINE_KERNEL_SKY(uint3 finalCoord : SV_DispatchThreadID)
currentClouds.xyz = unapplyFastTonemapping(currentClouds.xyz);
currentClouds.w = saturate(currentClouds.w);

// Due to numerical precision issues, upscaling a bunch of 1.0 can lead to a slightly lower number, this fixes it.
currentClouds.w = currentClouds.w > TRANSMITTANCE_DISCARD_THRESHOLD ? 1.0 : currentClouds.w;

// Store the upscaled result only, composite in later pass.
_VolumetricCloudsUpscaleTextureRW[COORD_TEXTURE2D_X(finalCoord.xy)] = currentClouds;
}
Expand Down