diff --git a/Source/Engine/Renderer/GI/DynamicDiffuseGlobalIllumination.cpp b/Source/Engine/Renderer/GI/DynamicDiffuseGlobalIllumination.cpp index c0042edbf..a6b7d0b29 100644 --- a/Source/Engine/Renderer/GI/DynamicDiffuseGlobalIllumination.cpp +++ b/Source/Engine/Renderer/GI/DynamicDiffuseGlobalIllumination.cpp @@ -389,9 +389,9 @@ bool DynamicDiffuseGlobalIlluminationPass::Render(RenderContext& renderContext, } // Calculate which cascades should be updated this frame - //const uint64 cascadeFrequencies[] = { 1, 2, 3, 5 }; + const uint64 cascadeFrequencies[] = { 1, 2, 3, 5 }; // TODO: prevent updating 2 cascades at once on Low quality - const uint64 cascadeFrequencies[] = { 1, 1, 1, 1 }; + //const uint64 cascadeFrequencies[] = { 1, 1, 1, 1 }; bool cascadeSkipUpdate[4]; for (int32 cascadeIndex = 0; cascadeIndex < cascadesCount; cascadeIndex++) { diff --git a/Source/Engine/Renderer/GlobalSignDistanceFieldPass.cpp b/Source/Engine/Renderer/GlobalSignDistanceFieldPass.cpp index bdae23a09..e3056a191 100644 --- a/Source/Engine/Renderer/GlobalSignDistanceFieldPass.cpp +++ b/Source/Engine/Renderer/GlobalSignDistanceFieldPass.cpp @@ -417,7 +417,7 @@ bool GlobalSignDistanceFieldPass::Render(RenderContext& renderContext, GPUContex } const int32 resolutionMip = Math::DivideAndRoundUp(resolution, GLOBAL_SDF_RASTERIZE_MIP_FACTOR); auto& giSettings = renderContext.List->Settings.GlobalIllumination; - const float distance = giSettings.Mode == GlobalIlluminationMode::DDGI ? giSettings.Distance : 15000.0f; + const float distance = Math::Min(giSettings.Mode == GlobalIlluminationMode::DDGI ? giSettings.Distance : 15000.0f, renderContext.View.Far); const float cascadesDistanceScales[] = { 1.0f, 2.5f, 5.0f, 10.0f }; const float distanceExtent = distance / cascadesDistanceScales[cascadesCount - 1]; diff --git a/Source/Shaders/GI/DDGI.shader b/Source/Shaders/GI/DDGI.shader index bb90c6a32..4a22bba27 100644 --- a/Source/Shaders/GI/DDGI.shader +++ b/Source/Shaders/GI/DDGI.shader @@ -264,6 +264,7 @@ void CS_UpdateProbes(uint3 GroupThreadId : SV_GroupThreadID, uint3 GroupId : SV_ int3 probesScrollOffsets = DDGI.ProbesScrollOffsets[CascadeIndex].xyz; int probeScrollClear = DDGI.ProbesScrollOffsets[CascadeIndex].w; int3 probeScrollDirections = DDGI.ProbeScrollDirections[CascadeIndex].xyz; + bool scrolled = false; UNROLL for (uint planeIndex = 0; planeIndex < 3; planeIndex++) { @@ -274,12 +275,13 @@ void CS_UpdateProbes(uint3 GroupThreadId : SV_GroupThreadID, uint3 GroupId : SV_ uint probeCount = DDGI.ProbesCounts[planeIndex]; uint coord = (probeCount + (scrollDirection ? (scrollOffset - 1) : (scrollOffset % probeCount))) % probeCount; if (probeCoords[planeIndex] == coord) - { - RWOutput[outputCoords] = float4(0, 0, 0, 0); - break; - } + scrolled = true; } } + if (scrolled) + { + RWOutput[outputCoords] = float4(0, 0, 0, 0); + } // Calculate octahedral projection for probe (unwraps spherical projection into a square) float2 octahedralCoords = GetOctahedralCoords(GroupThreadId.xy, DDGI_PROBE_RESOLUTION); @@ -336,7 +338,7 @@ void CS_UpdateProbes(uint3 GroupThreadId : SV_GroupThreadID, uint3 GroupId : SV_ float3 previous = RWOutput[outputCoords].rgb; float historyWeight = DDGI.ProbeHistoryWeight; //historyWeight = 0.0f; - if (ResetBlend || dot(previous, previous) == 0) + if (ResetBlend || scrolled || dot(previous, previous) == 0) historyWeight = 0.0f; #if DDGI_PROBE_UPDATE_MODE == 0 result *= DDGI.IndirectLightingIntensity;