Add Global Surface Atlas resolution setting
This commit is contained in:
@@ -15,4 +15,5 @@ void GraphicsSettings::Apply()
|
||||
Graphics::AllowCSMBlending = AllowCSMBlending;
|
||||
Graphics::GlobalSDFQuality = GlobalSDFQuality;
|
||||
Graphics::GIQuality = GIQuality;
|
||||
Graphics::GlobalSurfaceAtlasResolution = GlobalSurfaceAtlasResolution;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
/// <summary>
|
||||
/// The Global SDF quality. Controls the volume texture resolution and amount of cascades to use.
|
||||
/// </summary>
|
||||
API_FIELD(Attributes="EditorOrder(2005), DefaultValue(Quality.High), EditorDisplay(\"Quality\")")
|
||||
API_FIELD(Attributes="EditorOrder(2005), DefaultValue(Quality.High), EditorDisplay(\"Global SDF\")")
|
||||
Quality GlobalSDFQuality = Quality::High;
|
||||
|
||||
#if USE_EDITOR
|
||||
@@ -85,9 +85,15 @@ public:
|
||||
/// <summary>
|
||||
/// The Global Illumination quality. Controls the quality of the GI effect.
|
||||
/// </summary>
|
||||
API_FIELD(Attributes="EditorOrder(2100), DefaultValue(Quality.High), EditorDisplay(\"Quality\")")
|
||||
API_FIELD(Attributes="EditorOrder(2100), DefaultValue(Quality.High), EditorDisplay(\"Global Illumination\")")
|
||||
Quality GIQuality = Quality::High;
|
||||
|
||||
/// <summary>
|
||||
/// The Global Surface Atlas resolution. Adjust it if atlas `flickers` due to overflow (eg. to 4096).
|
||||
/// </summary>
|
||||
API_FIELD(Attributes="EditorOrder(2130), Limit(256, 8192), EditorDisplay(\"Global Illumination\")")
|
||||
int32 GlobalSurfaceAtlasResolution = 2048;
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
/// Gets the instance of the settings asset (default value if missing). Object returned by this method is always loaded with valid data to use.
|
||||
|
||||
@@ -16,6 +16,7 @@ Quality Graphics::ShadowMapsQuality = Quality::Medium;
|
||||
bool Graphics::AllowCSMBlending = false;
|
||||
Quality Graphics::GlobalSDFQuality = Quality::High;
|
||||
Quality Graphics::GIQuality = Quality::High;
|
||||
int32 Graphics::GlobalSurfaceAtlasResolution = 2048;
|
||||
|
||||
#if GRAPHICS_API_NULL
|
||||
extern GPUDevice* CreateGPUDeviceNull();
|
||||
|
||||
@@ -63,6 +63,11 @@ 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;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "Engine/Engine/Engine.h"
|
||||
#include "Engine/Content/Content.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"
|
||||
@@ -344,8 +345,7 @@ bool GlobalSurfaceAtlasPass::Render(RenderContext& renderContext, GPUContext* co
|
||||
PROFILE_GPU_CPU("Global Surface Atlas");
|
||||
|
||||
// Setup options
|
||||
// TODO: configurable via graphics settings
|
||||
const int32 resolution = 2048;
|
||||
const int32 resolution = Math::Clamp(Graphics::GlobalSurfaceAtlasResolution, 256, GPU_MAX_TEXTURE_SIZE);
|
||||
const float resolutionInv = 1.0f / resolution;
|
||||
auto& giSettings = renderContext.List->Settings.GlobalIllumination;
|
||||
const float distance = giSettings.Distance;
|
||||
@@ -524,7 +524,7 @@ bool GlobalSurfaceAtlasPass::Render(RenderContext& renderContext, GPUContext* co
|
||||
}
|
||||
}
|
||||
context->SetState(_psClear);
|
||||
context->SetViewportAndScissors(Viewport(0, 0, resolution, resolution));
|
||||
context->SetViewportAndScissors(Viewport(0, 0, (float)resolution, (float)resolution));
|
||||
VB_DRAW();
|
||||
}
|
||||
}
|
||||
@@ -747,7 +747,7 @@ bool GlobalSurfaceAtlasPass::Render(RenderContext& renderContext, GPUContext* co
|
||||
context->CopyTexture(surfaceAtlasData.AtlasLighting, 0, 0, 0, 0, surfaceAtlasData.AtlasEmissive, 0);
|
||||
}
|
||||
|
||||
context->SetViewportAndScissors(Viewport(0, 0, resolution, resolution));
|
||||
context->SetViewportAndScissors(Viewport(0, 0, (float)resolution, (float)resolution));
|
||||
context->SetRenderTarget(surfaceAtlasData.AtlasLighting->View());
|
||||
context->BindSR(0, surfaceAtlasData.AtlasGBuffer0->View());
|
||||
context->BindSR(1, surfaceAtlasData.AtlasGBuffer1->View());
|
||||
|
||||
Reference in New Issue
Block a user