From f7a69fc43d84362517fe852a7d3954bf39aab2a5 Mon Sep 17 00:00:00 2001 From: anisunity Date: Mon, 31 Jan 2022 11:11:45 +0100 Subject: [PATCH] Fixed using the wrong coordinate to compute the sampling direction for the screen space global illumination. --- .../CHANGELOG.md | 1 + .../ScreenSpaceGlobalIllumination.compute | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 63f5f398206..ccff36f3bf3 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -72,6 +72,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed missing unit in ray tracing related tooltips and docs (case 1397491). - Fixed errors spamming when in player mode due to ray tracing light cluster debug view (case 1390471). - Fixed warning upon deleting APV data assets. +- Fixed using the wrong coordinate to compute the sampling direction for the screen space global illumination. ## [14.0.0] - 2021-11-17 diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceGlobalIllumination.compute b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceGlobalIllumination.compute index fc1ee41265e..7047be503b7 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceGlobalIllumination.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceGlobalIllumination.compute @@ -199,21 +199,21 @@ void REPROJECT_GLOBAL_ILLUMINATION(uint3 dispatchThreadId : SV_DispatchThreadID, UNITY_XR_ASSIGN_VIEW_INDEX(dispatchThreadId.z); // Compute the pixel position to process - uint2 currentCoord = groupId * INDIRECT_DIFFUSE_TILE_SIZE + groupThreadId; - + uint2 inputCoord = dispatchThreadId.xy; + uint2 currentCoord = dispatchThreadId.xy; #if HALF_RES // Compute the full resolution pixel for the inputs that do not have a pyramid - currentCoord = currentCoord * 2; + inputCoord = inputCoord * 2; #endif // Read the depth and compute the position - float deviceDepth = LOAD_TEXTURE2D_X(_DepthTexture, currentCoord).x; - uint2 tileIndex = uint2(currentCoord) / GetTileSize(); - PositionInputs posInput = GetPositionInput(currentCoord, _ScreenSize.zw, deviceDepth, UNITY_MATRIX_I_VP, GetWorldToViewMatrix(), tileIndex); + float deviceDepth = LOAD_TEXTURE2D_X(_DepthTexture, inputCoord).x; + uint2 tileIndex = uint2(inputCoord) / GetTileSize(); + PositionInputs posInput = GetPositionInput(inputCoord, _ScreenSize.zw, deviceDepth, UNITY_MATRIX_I_VP, GetWorldToViewMatrix(), tileIndex); // Read the pixel normal NormalData normalData; - DecodeFromNormalBuffer(currentCoord.xy, normalData); + DecodeFromNormalBuffer(inputCoord.xy, normalData); // Generete a new direction to follow float2 newSample; @@ -308,5 +308,5 @@ void REPROJECT_GLOBAL_ILLUMINATION(uint3 dispatchThreadId : SV_DispatchThreadID, color = HsvToRgb(color); // Write the output to the target pixel - _IndirectDiffuseTextureRW[COORD_TEXTURE2D_X(dispatchThreadId.xy)] = color; + _IndirectDiffuseTextureRW[COORD_TEXTURE2D_X(currentCoord)] = color; }