Add GlobalIllumination to debug GI probes

This commit is contained in:
Wojciech Figat
2022-06-17 15:07:58 +02:00
parent 9f99d74e53
commit 1db65ac882
3 changed files with 8 additions and 2 deletions

View File

@@ -1409,6 +1409,7 @@ namespace FlaxEditor.Viewport
new ViewModeOptions(ViewMode.QuadOverdraw, "Quad Overdraw"),
new ViewModeOptions(ViewMode.GlobalSDF, "Global SDF"),
new ViewModeOptions(ViewMode.GlobalSurfaceAtlas, "Global Surface Atlas"),
new ViewModeOptions(ViewMode.GlobalIllumination, "Global Illumination"),
};
private void WidgetCamSpeedShowHide(Control cm)

View File

@@ -864,6 +864,11 @@ API_ENUM() enum class ViewMode
/// Draw Global Surface Atlas preview.
/// </summary>
GlobalSurfaceAtlas = 25,
/// <summary>
/// Draw Global Illumination debug preview (eg. irradiance probes).
/// </summary>
GlobalIllumination = 26,
};
/// <summary>

View File

@@ -269,7 +269,7 @@ bool DynamicDiffuseGlobalIlluminationPass::Render(RenderContext& renderContext,
// Setup options
auto& settings = renderContext.List->Settings.GlobalIllumination;
const float probesSpacing = 100.0f; // GI probes placement spacing nearby camera (for closest cascade; gets automatically reduced for further cascades)
int32 probeRaysCount;
int32 probeRaysCount; // Amount of rays to trace randomly around each probe
switch (Graphics::GIQuality)
{
case Quality::Low:
@@ -287,7 +287,7 @@ bool DynamicDiffuseGlobalIlluminationPass::Render(RenderContext& renderContext,
break;
}
ASSERT_LOW_LAYER(Math::Min(Math::AlignUp(probeRaysCount, DDGI_TRACE_RAYS_GROUP_SIZE_X), DDGI_TRACE_RAYS_LIMIT) == probeRaysCount);
bool debugProbes = false; // TODO: add debug option to draw probes locations -> in Graphics window - Editor-only
bool debugProbes = renderContext.View.Mode == ViewMode::GlobalIllumination;
const float indirectLightingIntensity = settings.Intensity;
const float probeHistoryWeight = Math::Clamp(settings.TemporalResponse, 0.0f, 0.98f);
const float distance = settings.Distance;