diff --git a/Source/Shaders/GI/DDGI.hlsl b/Source/Shaders/GI/DDGI.hlsl index 88b9a4cb8..a1de04462 100644 --- a/Source/Shaders/GI/DDGI.hlsl +++ b/Source/Shaders/GI/DDGI.hlsl @@ -238,7 +238,7 @@ float3 SampleDDGIIrradianceCascade(DDGIData data, Texture2D probes // Sample distance texture float2 octahedralCoords = GetOctahedralCoords(-biasedPosToProbe); float2 uv = GetDDGIProbeUV(data, cascadeIndex, probeIndex, octahedralCoords, DDGI_PROBE_RESOLUTION_DISTANCE); - float2 probeDistance = probesDistance.SampleLevel(SamplerLinearClamp, uv, 0).rg * 2.0f; + float2 probeDistance = probesDistance.SampleLevel(SamplerLinearClamp, uv, 0).rg; // Visibility weight (Chebyshev) if (biasedPosToProbeDist > probeDistance.x && useVisibility) diff --git a/Source/Shaders/GI/DDGI.shader b/Source/Shaders/GI/DDGI.shader index f0528f5a3..91c7de00b 100644 --- a/Source/Shaders/GI/DDGI.shader +++ b/Source/Shaders/GI/DDGI.shader @@ -807,7 +807,11 @@ void CS_UpdateProbes(uint3 GroupThreadId : SV_GroupThreadID, uint3 GroupId : SV_ // Normalize results float epsilon = (float)probeRaysCount * 1e-9f; +#if DDGI_PROBE_UPDATE_MODE == DDGI_PROBE_UPDATE_IRRADIANCE result.rgb *= 1.0f / (2.0f * max(result.a, epsilon)); +#else + result.rgb *= 1.0f / max(result.a, epsilon); +#endif // Load current probe value uint2 outputCoords = GetDDGIProbeTexelCoords(DDGI, CascadeIndex, probeIndex) * (DDGI_PROBE_RESOLUTION + 2) + 1 + GroupThreadId.xy;