r.SSGI.MinimumLuminance
r.SSGI.MinimumLuminance
#Overview
name: r.SSGI.MinimumLuminance
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.SSGI.MinimumLuminance is to set a minimum luminance threshold for Screen Space Global Illumination (SSGI) calculations in Unreal Engine’s rendering system.
This setting variable is primarily used in the rendering subsystem of Unreal Engine, specifically in the Screen Space Ray Tracing module. It’s part of the SSGI (Screen Space Global Illumination) feature, which is responsible for calculating indirect lighting in screen space.
The value of this variable is set through a console variable (CVar) named CVarSSGIMinimumLuminance. It’s defined in the ScreenSpaceRayTracing.cpp file with a default value of 0.5f. This variable can be changed at runtime through console commands or project settings.
CVarSSGIMinimumLuminance interacts directly with the SSGI calculation process. It’s used in the ReducePrevSceneColorMip function, which is part of the SSGI pipeline. This function prepares the previous frame’s scene color for use in SSGI calculations.
Developers should be aware that this variable affects the sensitivity of the SSGI system to low-light areas. A higher value will cause the system to ignore more of the darker areas in the scene when calculating indirect lighting, potentially reducing noise but also potentially reducing detail in shadowed areas.
Best practices when using this variable include:
- Fine-tuning it based on the specific lighting conditions of your scene.
- Balancing it with other SSGI settings for optimal visual quality and performance.
- Testing its impact across a range of scene lighting conditions to ensure consistent results.
Regarding the associated variable CVarSSGIMinimumLuminance:
This is the actual console variable that stores and provides access to the r.SSGI.MinimumLuminance value. It’s defined as a TAutoConsoleVariable
The purpose of CVarSSGIMinimumLuminance is to provide a programmatic way to access and modify the r.SSGI.MinimumLuminance setting within the engine’s C++ code.
This variable is used in the rendering subsystem, specifically in the Screen Space Ray Tracing module.
The value of CVarSSGIMinimumLuminance is set when the engine initializes, but it can be modified at runtime through console commands or through the engine’s settings interface.
It interacts directly with the SSGI calculation process, as its value is retrieved in the ReducePrevSceneColorMip function using the GetValueOnRenderThread() method.
Developers should be aware that changes to this variable will take effect on the render thread, which means there might be a slight delay before the changes are visible.
Best practices for using CVarSSGIMinimumLuminance include:
- Using GetValueOnRenderThread() when accessing its value in render-thread code.
- Considering thread safety when modifying its value, especially in a multi-threaded environment.
- Using it in conjunction with other SSGI-related variables for comprehensive control over the SSGI system.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceRayTracing.cpp:57
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarSSGIMinimumLuminance(
TEXT("r.SSGI.MinimumLuminance"), 0.5f,
TEXT(""),
ECVF_Scalability | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarSSGIRejectUncertainRays(
TEXT("r.SSGI.RejectUncertainRays"), 1,
TEXT("Rejects the screen space ray if it was uncertain due to going behind screen geometry."),
#Associated Variable and Callsites
This variable is associated with another variable named CVarSSGIMinimumLuminance
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceRayTracing.cpp:56
Scope: file
Source code excerpt:
ECVF_Scalability | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<float> CVarSSGIMinimumLuminance(
TEXT("r.SSGI.MinimumLuminance"), 0.5f,
TEXT(""),
ECVF_Scalability | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarSSGIRejectUncertainRays(
TEXT("r.SSGI.RejectUncertainRays"), 1,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceRayTracing.cpp:825
Scope (from outer to inner):
file
namespace ScreenSpaceRayTracing
function FPrevSceneColorMip ReducePrevSceneColorMip
Source code excerpt:
PassParameters->PrevSceneColorPreExposureCorrection = View.PreExposure / View.PrevViewInfo.SceneColorPreExposure;
PassParameters->MinimumLuminance = CVarSSGIMinimumLuminance.GetValueOnRenderThread();
PassParameters->SkyDistance = CVarSSGISkyDistance.GetValueOnRenderThread();
PassParameters->PrevScreenPositionScaleBias = FVector4f(
ViewportExtent.X * 0.5f / BufferSize.X,
-ViewportExtent.Y * 0.5f / BufferSize.Y,
(ViewportExtent.X * 0.5f + ViewportOffset.X) / BufferSize.X,