From f3b2aa1e3cc694a0ef8195c541e8a679117a2b6b Mon Sep 17 00:00:00 2001 From: Tim <15017472+doodlum@users.noreply.github.com> Date: Mon, 25 Nov 2024 11:25:58 +0000 Subject: [PATCH 1/2] chore: pb shadow improvements --- package/Shaders/Utility.hlsl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package/Shaders/Utility.hlsl b/package/Shaders/Utility.hlsl index ff75d34ee..a8bbefbde 100644 --- a/package/Shaders/Utility.hlsl +++ b/package/Shaders/Utility.hlsl @@ -381,12 +381,11 @@ float GetPoissonDiskFilteredShadowVisibility(float noise, float2x2 rotationMatri float visibility = 0; for (int sampleIndex = 0; sampleIndex < sampleCount; ++sampleIndex) { float2 sampleOffset = mul(Random::SpiralSampleOffsets8[sampleIndex], rotationMatrix); - sampleOffset *= 1.5; # if defined(RENDER_SHADOWMASKDPB) float2 sampleUV = sampleOffset + baseUV.xy; - baseUV.z += noise; + baseUV.z += noise * 0.5; bool lowerHalf = baseUV.z * 0.5 + 0.5 < 0; float3 normalizedPositionLS = normalize(float3(sampleUV.xy, baseUV.z)); From 1d9d153af73f93c27068e3a0de26664a90e3ffb6 Mon Sep 17 00:00:00 2001 From: Tim <15017472+doodlum@users.noreply.github.com> Date: Mon, 25 Nov 2024 11:29:22 +0000 Subject: [PATCH 2/2] chore: more cleanup --- package/Shaders/Utility.hlsl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/package/Shaders/Utility.hlsl b/package/Shaders/Utility.hlsl index a8bbefbde..6edce9a8d 100644 --- a/package/Shaders/Utility.hlsl +++ b/package/Shaders/Utility.hlsl @@ -383,9 +383,8 @@ float GetPoissonDiskFilteredShadowVisibility(float noise, float2x2 rotationMatri float2 sampleOffset = mul(Random::SpiralSampleOffsets8[sampleIndex], rotationMatrix); # if defined(RENDER_SHADOWMASKDPB) - float2 sampleUV = sampleOffset + baseUV.xy; - - baseUV.z += noise * 0.5; + float2 sampleUV = baseUV.xy + sampleOffset * ShadowSampleParam.z; + baseUV.z += noise * ShadowSampleParam.z; bool lowerHalf = baseUV.z * 0.5 + 0.5 < 0; float3 normalizedPositionLS = normalize(float3(sampleUV.xy, baseUV.z));