Add GIProbesSpacing and GlobalSurfaceAtlasResolution to global Graphics for runtime editing

#4001
This commit is contained in:
2026-06-21 23:07:17 +02:00
parent f9b691bbbb
commit 3db688e5fd
4 changed files with 17 additions and 4 deletions
+4
View File
@@ -25,7 +25,9 @@ float Graphics::ShadowUpdateRate = 1.0f;
bool Graphics::AllowCSMBlending = false;
Quality Graphics::GlobalSDFQuality = Quality::High;
Quality Graphics::GIQuality = Quality::High;
float Graphics::GIProbesSpacing = 100;
bool Graphics::GICascadesBlending = false;
int32 Graphics::GlobalSurfaceAtlasResolution = 2048;
PostProcessSettings Graphics::PostProcessSettings;
bool Graphics::GammaColorSpace = true;
bool Graphics::SpreadWorkload = true;
@@ -76,7 +78,9 @@ void GraphicsSettings::Apply()
Graphics::AllowCSMBlending = AllowCSMBlending;
Graphics::GlobalSDFQuality = GlobalSDFQuality;
Graphics::GIQuality = GIQuality;
Graphics::GIProbesSpacing = GIProbesSpacing;
Graphics::GICascadesBlending = GICascadesBlending;
Graphics::GlobalSurfaceAtlasResolution = GlobalSurfaceAtlasResolution;
Graphics::PostProcessSettings = ::PostProcessSettings();
Graphics::PostProcessSettings.BlendWith(PostProcessSettings, 1.0f);
Graphics::GammaColorSpace = GammaColorSpace;
+10
View File
@@ -68,11 +68,21 @@ public:
/// </summary>
API_FIELD() static Quality GIQuality;
/// <summary>
/// The Global Illumination probes spacing distance (in world units). Defines the quality of the GI resolution. Adjust to 200-500 to improve performance and lower frequency GI data.
/// </summary>
API_FIELD() static float GIProbesSpacing;
/// <summary>
/// Enables cascades splits blending for Global Illumination.
/// </summary>
API_FIELD() static bool GICascadesBlending;
/// <summary>
/// The Global Surface Atlas resolution. Adjust it if atlas `flickers` due to overflow (eg. to 4096).
/// </summary>
API_FIELD() static int32 GlobalSurfaceAtlasResolution;
/// <summary>
/// The default Post Process settings. Can be overriden by PostFxVolume on a level locally, per camera or for a whole map.
/// </summary>
@@ -328,8 +328,7 @@ bool DynamicDiffuseGlobalIlluminationPass::RenderInner(RenderContext& renderCont
// Setup options
auto& settings = renderContext.List->Settings.GlobalIllumination;
auto* graphicsSettings = GraphicsSettings::Get();
const float probesSpacing = Math::Clamp(graphicsSettings->GIProbesSpacing, 10.0f, 1000.0f); // GI probes placement spacing nearby camera (for closest cascade; gets automatically reduced for further cascades)
const float probesSpacing = Math::Clamp(Graphics::GIProbesSpacing, 10.0f, 1000.0f); // GI probes placement spacing nearby camera (for closest cascade; gets automatically reduced for further cascades)
int32 probeRaysCount; // Amount of rays to trace randomly around each probe
switch (Graphics::GIQuality) // Ensure to match CS_TraceRays permutations
{
@@ -16,6 +16,7 @@
#include "Engine/Graphics/GPUContext.h"
#include "Engine/Graphics/GPUDevice.h"
#include "Engine/Graphics/GPUPass.h"
#include "Engine/Graphics/Graphics.h"
#include "Engine/Graphics/RenderTask.h"
#include "Engine/Graphics/RenderBuffers.h"
#include "Engine/Graphics/RenderTargetPool.h"
@@ -259,8 +260,7 @@ public:
void GetOptions(const RenderContext& renderContext, int32& resolution, float& distance)
{
auto* graphicsSettings = GraphicsSettings::Get();
resolution = Math::Clamp(graphicsSettings->GlobalSurfaceAtlasResolution, 256, GPU_MAX_TEXTURE_SIZE);
resolution = Math::Clamp(Graphics::GlobalSurfaceAtlasResolution, 256, GPU_MAX_TEXTURE_SIZE);
auto& giSettings = renderContext.List->Settings.GlobalIllumination;
distance = giSettings.Distance;
}