Various DDGI improvements

This commit is contained in:
Wojciech Figat
2022-06-13 16:02:41 +02:00
parent eb1e39b3c4
commit 37511c0e6b
3 changed files with 10 additions and 8 deletions

View File

@@ -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++)
{

View File

@@ -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];

View File

@@ -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;