diff --git a/Source/Engine/Core/Config/GraphicsSettings.h b/Source/Engine/Core/Config/GraphicsSettings.h index a3a5e7ded..9fef78f74 100644 --- a/Source/Engine/Core/Config/GraphicsSettings.h +++ b/Source/Engine/Core/Config/GraphicsSettings.h @@ -84,6 +84,12 @@ public: API_FIELD(Attributes="EditorOrder(2000), EditorDisplay(\"Global SDF\")") bool EnableGlobalSDF = false; + /// + /// Draw distance of the Global SDF. Actual value can be large when using DDGI. + /// + API_FIELD(Attributes="EditorOrder(2001), EditorDisplay(\"Global SDF\"), Limit(1000), ValueCategory(Utils.ValueCategory.Distance)") + float GlobalSDFDistance = 15000.0f; + /// /// The Global SDF quality. Controls the volume texture resolution and amount of cascades to use. /// diff --git a/Source/Engine/Graphics/PostProcessSettings.h b/Source/Engine/Graphics/PostProcessSettings.h index 525da3f36..19b3cec93 100644 --- a/Source/Engine/Graphics/PostProcessSettings.h +++ b/Source/Engine/Graphics/PostProcessSettings.h @@ -358,7 +358,7 @@ API_STRUCT() struct FLAXENGINE_API GlobalIlluminationSettings : ISerializable float BounceIntensity = 1.0f; /// - /// Defines how quickly GI blends between the the current frame and the history buffer. Lower values update GI faster, but with more jittering and noise. If the camera in your game doesn't move much, we recommend values closer to 1. + /// Defines how quickly GI blends between the current frame and the history buffer. Lower values update GI faster, but with more jittering and noise. If the camera in your game doesn't move much, we recommend values closer to 1. /// API_FIELD(Attributes="EditorOrder(20), Limit(0, 1), PostProcessSetting((int)GlobalIlluminationSettingsOverride.TemporalResponse)") float TemporalResponse = 0.9f; diff --git a/Source/Engine/Renderer/GlobalSignDistanceFieldPass.cpp b/Source/Engine/Renderer/GlobalSignDistanceFieldPass.cpp index b9830c6ee..27eed44b8 100644 --- a/Source/Engine/Renderer/GlobalSignDistanceFieldPass.cpp +++ b/Source/Engine/Renderer/GlobalSignDistanceFieldPass.cpp @@ -5,6 +5,7 @@ #include "Engine/Core/Math/Vector3.h" #include "Engine/Core/Math/Matrix3x4.h" #include "Engine/Core/Collections/HashSet.h" +#include "Engine/Core/Config/GraphicsSettings.h" #include "Engine/Engine/Engine.h" #include "Engine/Content/Content.h" #include "Engine/Graphics/GPUContext.h" @@ -411,7 +412,10 @@ 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 = Math::Min(giSettings.Mode == GlobalIlluminationMode::DDGI ? giSettings.Distance : 15000.0f, renderContext.View.Far); + float distance = GraphicsSettings::Get()->GlobalSDFDistance; + if (giSettings.Mode == GlobalIlluminationMode::DDGI) + distance = Math::Max(distance, giSettings.Distance); + distance = Math::Min(distance, renderContext.View.Far); const float cascadesDistanceScales[] = { 1.0f, 2.5f, 5.0f, 10.0f }; const float distanceExtent = distance / cascadesDistanceScales[cascadesCount - 1];