Skip to content

Commit f76cc4e

Browse files
Fixed the intensity of the sky being reduced signficantly even if there is no clouds (case 1388279). (#6601)
* Fixed the intensity of the sky being reduced signficantly even if there is no clouds (case 1388279). * Update screenshots * UpdateLinuxScreenshot Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
1 parent 73bad5a commit f76cc4e

File tree

7 files changed

+25
-10
lines changed

7 files changed

+25
-10
lines changed
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Loading
Loading
Loading

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
8282
- Fixed potential asymmetrical resource release in the volumetric clouds (case 1388218).
8383
- Fixed the fade in mode of the clouds not impacting the volumetric clouds shadows (case 1381652).
8484
- Fixed the rt screen space shadows not using the correct asset for allocating the history buffers.
85+
- Fixed the intensity of the sky being reduced signficantly even if there is no clouds (case 1388279).
8586

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

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@
6161
#define MAX_SKYBOX_VOLUMETRIC_CLOUDS_DISTANCE 200000.0f
6262
// Maximal size of a light step
6363
#define LIGHT_STEP_MAXIMAL_SIZE 1000.0f
64+
// Threshold at which the clouds are considered inexistant (Found experimentally)
65+
#define TRANSMITTANCE_DISCARD_THRESHOLD 0.992
6466

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

1388+
// Due to numerical precision issues, upscaling a bunch of 1.0 can lead to a slightly lower number, this fixes it.
1389+
currentClouds.w = currentClouds.w > TRANSMITTANCE_DISCARD_THRESHOLD ? 1.0 : currentClouds.w;
1390+
13861391
#ifdef LOCAL_VOLUMETRIC_CLOUDS
13871392
float cloudDepth = GetCloudDepth_LDS(groupThreadId, IndexToLocalOffsetCoords[closestNeighbor]);
13881393
#else
@@ -1460,6 +1465,9 @@ void UPSAMPLE_KERNEL_SKY(uint3 finalCoord : SV_DispatchThreadID,
14601465
currentClouds.xyz = unapplyFastTonemapping(currentClouds.xyz);
14611466
currentClouds.w = saturate(currentClouds.w);
14621467

1468+
// Due to numerical precision issues, upscaling a bunch of 1.0 can lead to a slightly lower number, this fixes it.
1469+
currentClouds.w = currentClouds.w > TRANSMITTANCE_DISCARD_THRESHOLD ? 1.0 : currentClouds.w;
1470+
14631471
// Store the upscaled result only, composite in later pass.
14641472
_VolumetricCloudsUpscaleTextureRW[COORD_TEXTURE2D_X(finalCoord.xy)] = currentClouds;
14651473
}
@@ -1491,6 +1499,9 @@ void COMBINE_KERNEL(uint3 finalCoord : SV_DispatchThreadID,
14911499
currentClouds.xyz = unapplyFastTonemapping(currentClouds.xyz);
14921500
currentClouds.w = saturate(currentClouds.w);
14931501

1502+
// Due to numerical precision issues, upscaling a bunch of 1.0 can lead to a slightly lower number, this fixes it.
1503+
currentClouds.w = currentClouds.w > TRANSMITTANCE_DISCARD_THRESHOLD ? 1.0 : currentClouds.w;
1504+
14941505
#ifdef LOCAL_VOLUMETRIC_CLOUDS
14951506
float cloudsDepth = LOAD_TEXTURE2D_X(_DepthStatusTexture, finalCoord.xy).z;
14961507
#else
@@ -1546,6 +1557,9 @@ void COMBINE_KERNEL_SKY(uint3 finalCoord : SV_DispatchThreadID)
15461557
currentClouds.xyz = unapplyFastTonemapping(currentClouds.xyz);
15471558
currentClouds.w = saturate(currentClouds.w);
15481559

1560+
// Due to numerical precision issues, upscaling a bunch of 1.0 can lead to a slightly lower number, this fixes it.
1561+
currentClouds.w = currentClouds.w > TRANSMITTANCE_DISCARD_THRESHOLD ? 1.0 : currentClouds.w;
1562+
15491563
// Store the upscaled result only, composite in later pass.
15501564
_VolumetricCloudsUpscaleTextureRW[COORD_TEXTURE2D_X(finalCoord.xy)] = currentClouds;
15511565
}

0 commit comments

Comments
 (0)