Add Global Surface Atlas resolution setting
This commit is contained in:
@@ -15,4 +15,5 @@ void GraphicsSettings::Apply()
|
|||||||
Graphics::AllowCSMBlending = AllowCSMBlending;
|
Graphics::AllowCSMBlending = AllowCSMBlending;
|
||||||
Graphics::GlobalSDFQuality = GlobalSDFQuality;
|
Graphics::GlobalSDFQuality = GlobalSDFQuality;
|
||||||
Graphics::GIQuality = GIQuality;
|
Graphics::GIQuality = GIQuality;
|
||||||
|
Graphics::GlobalSurfaceAtlasResolution = GlobalSurfaceAtlasResolution;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public:
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The Global SDF quality. Controls the volume texture resolution and amount of cascades to use.
|
/// The Global SDF quality. Controls the volume texture resolution and amount of cascades to use.
|
||||||
/// </summary>
|
/// </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;
|
Quality GlobalSDFQuality = Quality::High;
|
||||||
|
|
||||||
#if USE_EDITOR
|
#if USE_EDITOR
|
||||||
@@ -85,9 +85,15 @@ public:
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The Global Illumination quality. Controls the quality of the GI effect.
|
/// The Global Illumination quality. Controls the quality of the GI effect.
|
||||||
/// </summary>
|
/// </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;
|
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:
|
public:
|
||||||
/// <summary>
|
/// <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.
|
/// 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;
|
bool Graphics::AllowCSMBlending = false;
|
||||||
Quality Graphics::GlobalSDFQuality = Quality::High;
|
Quality Graphics::GlobalSDFQuality = Quality::High;
|
||||||
Quality Graphics::GIQuality = Quality::High;
|
Quality Graphics::GIQuality = Quality::High;
|
||||||
|
int32 Graphics::GlobalSurfaceAtlasResolution = 2048;
|
||||||
|
|
||||||
#if GRAPHICS_API_NULL
|
#if GRAPHICS_API_NULL
|
||||||
extern GPUDevice* CreateGPUDeviceNull();
|
extern GPUDevice* CreateGPUDeviceNull();
|
||||||
|
|||||||
@@ -63,6 +63,11 @@ public:
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
API_FIELD() static Quality GIQuality;
|
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:
|
public:
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include "Engine/Engine/Engine.h"
|
#include "Engine/Engine/Engine.h"
|
||||||
#include "Engine/Content/Content.h"
|
#include "Engine/Content/Content.h"
|
||||||
#include "Engine/Graphics/GPUDevice.h"
|
#include "Engine/Graphics/GPUDevice.h"
|
||||||
|
#include "Engine/Graphics/Graphics.h"
|
||||||
#include "Engine/Graphics/RenderTask.h"
|
#include "Engine/Graphics/RenderTask.h"
|
||||||
#include "Engine/Graphics/RenderBuffers.h"
|
#include "Engine/Graphics/RenderBuffers.h"
|
||||||
#include "Engine/Graphics/RenderTargetPool.h"
|
#include "Engine/Graphics/RenderTargetPool.h"
|
||||||
@@ -344,8 +345,7 @@ bool GlobalSurfaceAtlasPass::Render(RenderContext& renderContext, GPUContext* co
|
|||||||
PROFILE_GPU_CPU("Global Surface Atlas");
|
PROFILE_GPU_CPU("Global Surface Atlas");
|
||||||
|
|
||||||
// Setup options
|
// Setup options
|
||||||
// TODO: configurable via graphics settings
|
const int32 resolution = Math::Clamp(Graphics::GlobalSurfaceAtlasResolution, 256, GPU_MAX_TEXTURE_SIZE);
|
||||||
const int32 resolution = 2048;
|
|
||||||
const float resolutionInv = 1.0f / resolution;
|
const float resolutionInv = 1.0f / resolution;
|
||||||
auto& giSettings = renderContext.List->Settings.GlobalIllumination;
|
auto& giSettings = renderContext.List->Settings.GlobalIllumination;
|
||||||
const float distance = giSettings.Distance;
|
const float distance = giSettings.Distance;
|
||||||
@@ -524,7 +524,7 @@ bool GlobalSurfaceAtlasPass::Render(RenderContext& renderContext, GPUContext* co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
context->SetState(_psClear);
|
context->SetState(_psClear);
|
||||||
context->SetViewportAndScissors(Viewport(0, 0, resolution, resolution));
|
context->SetViewportAndScissors(Viewport(0, 0, (float)resolution, (float)resolution));
|
||||||
VB_DRAW();
|
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->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->SetRenderTarget(surfaceAtlasData.AtlasLighting->View());
|
||||||
context->BindSR(0, surfaceAtlasData.AtlasGBuffer0->View());
|
context->BindSR(0, surfaceAtlasData.AtlasGBuffer0->View());
|
||||||
context->BindSR(1, surfaceAtlasData.AtlasGBuffer1->View());
|
context->BindSR(1, surfaceAtlasData.AtlasGBuffer1->View());
|
||||||
|
|||||||
Reference in New Issue
Block a user