Add GI probes spacing setting

This commit is contained in:
Wojciech Figat
2022-06-20 10:09:09 +02:00
parent 3238861f64
commit 9cbaeb21f5
6 changed files with 13 additions and 11 deletions

View File

@@ -15,6 +15,5 @@ void GraphicsSettings::Apply()
Graphics::AllowCSMBlending = AllowCSMBlending;
Graphics::GlobalSDFQuality = GlobalSDFQuality;
Graphics::GIQuality = GIQuality;
Graphics::GlobalSurfaceAtlasResolution = GlobalSurfaceAtlasResolution;
Graphics::PostProcessSettings = PostProcessSettings;
}

View File

@@ -89,6 +89,12 @@ public:
API_FIELD(Attributes="EditorOrder(2100), DefaultValue(Quality.High), EditorDisplay(\"Global Illumination\")")
Quality GIQuality = Quality::High;
/// <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(Attributes="EditorOrder(2120), Limit(50, 1000), EditorDisplay(\"Global Illumination\")")
float GIProbesSpacing = 100;
/// <summary>
/// The Global Surface Atlas resolution. Adjust it if atlas `flickers` due to overflow (eg. to 4096).
/// </summary>

View File

@@ -16,7 +16,6 @@ Quality Graphics::ShadowMapsQuality = Quality::Medium;
bool Graphics::AllowCSMBlending = false;
Quality Graphics::GlobalSDFQuality = Quality::High;
Quality Graphics::GIQuality = Quality::High;
int32 Graphics::GlobalSurfaceAtlasResolution = 2048;
PostProcessSettings Graphics::PostProcessSettings;
#if GRAPHICS_API_NULL

View File

@@ -63,11 +63,6 @@ public:
/// </summary>
API_FIELD() static Quality GIQuality;
/// <summary>
/// The Global Surface Atlas resolution. Adjust it if atlas `flickers` due to overflow.
/// </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>

View File

@@ -9,6 +9,7 @@
#include "Engine/Core/Math/Int3.h"
#include "Engine/Core/Math/Matrix3x3.h"
#include "Engine/Core/Math/Quaternion.h"
#include "Engine/Core/Config/GraphicsSettings.h"
#include "Engine/Engine/Engine.h"
#include "Engine/Content/Content.h"
#include "Engine/Debug/DebugDraw.h"
@@ -268,7 +269,8 @@ 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)
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)
int32 probeRaysCount; // Amount of rays to trace randomly around each probe
switch (Graphics::GIQuality)
{

View File

@@ -10,8 +10,8 @@
#include "Engine/Core/Math/OrientedBoundingBox.h"
#include "Engine/Engine/Engine.h"
#include "Engine/Content/Content.h"
#include "Engine/Core/Config/GraphicsSettings.h"
#include "Engine/Graphics/GPUDevice.h"
#include "Engine/Graphics/Graphics.h"
#include "Engine/Graphics/RenderTask.h"
#include "Engine/Graphics/RenderBuffers.h"
#include "Engine/Graphics/RenderTargetPool.h"
@@ -345,8 +345,9 @@ bool GlobalSurfaceAtlasPass::Render(RenderContext& renderContext, GPUContext* co
PROFILE_GPU_CPU("Global Surface Atlas");
// Setup options
const int32 resolution = Math::Clamp(Graphics::GlobalSurfaceAtlasResolution, 256, GPU_MAX_TEXTURE_SIZE);
const float resolutionInv = 1.0f / resolution;
auto* graphicsSettings = GraphicsSettings::Get();
const int32 resolution = Math::Clamp(graphicsSettings->GlobalSurfaceAtlasResolution, 256, GPU_MAX_TEXTURE_SIZE);
const float resolutionInv = 1.0f / (float)resolution;
auto& giSettings = renderContext.List->Settings.GlobalIllumination;
const float distance = giSettings.Distance;