r.Lumen.ScreenProbeGather.ScreenTraces.ThicknessScaleWhenNoFallback
r.Lumen.ScreenProbeGather.ScreenTraces.ThicknessScaleWhenNoFallback
#Overview
name: r.Lumen.ScreenProbeGather.ScreenTraces.ThicknessScaleWhenNoFallback
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Larger scales effectively treat depth buffer surfaces as thicker for screen traces when there is no Distance Field present to resume the occluded ray.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.ScreenProbeGather.ScreenTraces.ThicknessScaleWhenNoFallback is to control the thickness scale of surfaces in the depth buffer for screen traces when there is no Distance Field present to resume occluded rays in Lumen’s screen probe gathering process.
This setting variable is primarily used in the Lumen rendering system, which is part of Unreal Engine’s global illumination solution. Specifically, it’s utilized in the screen probe gathering subsystem of Lumen.
The value of this variable is set through the Unreal Engine’s console variable system. It’s defined as a float with a default value of 2.0.
This variable interacts directly with its associated C++ variable GLumenScreenProbeScreenTracesThicknessScaleWhenNoFallback. They share the same value, and the console variable is used to expose this setting to users and allow runtime modification.
Developers should be aware that increasing this value will effectively treat surfaces in the depth buffer as thicker for screen traces when there’s no Distance Field available. This can impact the visual quality and performance of the Lumen global illumination system.
Best practices when using this variable include:
- Adjusting it carefully, as it can significantly affect the appearance of global illumination.
- Testing different values in various scenarios to find the optimal balance between visual quality and performance.
- Considering the presence or absence of Distance Fields in the scene when tweaking this value.
Regarding the associated variable GLumenScreenProbeScreenTracesThicknessScaleWhenNoFallback:
This is the internal C++ variable that directly stores the value set by the console variable. It’s used in the rendering code to apply the thickness scale during the screen probe gathering process.
The variable is used in the RenderLumenScreenProbeGather function of the FDeferredShadingSceneRenderer class. Here, it’s multiplied by the per-projection depth thickness scale to determine the final ScreenTraceNoFallbackThicknessScale parameter.
Developers should note that this variable is only applied when hardware ray-traced screen probe gathering is not in use. When hardware ray tracing is active, a default scale of 1.0 is used instead.
Best practices for this associated variable include:
- Avoiding direct modification of this variable in code, instead use the console variable for adjustments.
- Being aware of its interaction with hardware ray tracing settings.
- Considering its impact on performance and visual quality when optimizing the Lumen system.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeGather.cpp:232
Scope: file
Source code excerpt:
float GLumenScreenProbeScreenTracesThicknessScaleWhenNoFallback = 2;
FAutoConsoleVariableRef CVarLumenScreenProbeScreenTracesThicknessScaleWhenNoFallback(
TEXT("r.Lumen.ScreenProbeGather.ScreenTraces.ThicknessScaleWhenNoFallback"),
GLumenScreenProbeScreenTracesThicknessScaleWhenNoFallback,
TEXT("Larger scales effectively treat depth buffer surfaces as thicker for screen traces when there is no Distance Field present to resume the occluded ray."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GLumenScreenProbeSpatialFilter = 1;
#Associated Variable and Callsites
This variable is associated with another variable named GLumenScreenProbeScreenTracesThicknessScaleWhenNoFallback
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeGather.cpp:230
Scope: file
Source code excerpt:
);
float GLumenScreenProbeScreenTracesThicknessScaleWhenNoFallback = 2;
FAutoConsoleVariableRef CVarLumenScreenProbeScreenTracesThicknessScaleWhenNoFallback(
TEXT("r.Lumen.ScreenProbeGather.ScreenTraces.ThicknessScaleWhenNoFallback"),
GLumenScreenProbeScreenTracesThicknessScaleWhenNoFallback,
TEXT("Larger scales effectively treat depth buffer surfaces as thicker for screen traces when there is no Distance Field present to resume the occluded ray."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GLumenScreenProbeSpatialFilter = 1;
FAutoConsoleVariableRef GVarLumenScreenProbeFilter(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeGather.cpp:1878
Scope (from outer to inner):
file
function FSSDSignalTextures FDeferredShadingSceneRenderer::RenderLumenScreenProbeGather
Source code excerpt:
ScreenProbeParameters.ScreenProbeGatherMaxMip = GLumenScreenProbeGatherNumMips - 1;
ScreenProbeParameters.RelativeSpeedDifferenceToConsiderLightingMoving = GLumenScreenProbeRelativeSpeedDifferenceToConsiderLightingMoving;
ScreenProbeParameters.ScreenTraceNoFallbackThicknessScale = (Lumen::UseHardwareRayTracedScreenProbeGather(ViewFamily) ? 1.0f : GLumenScreenProbeScreenTracesThicknessScaleWhenNoFallback) * View.ViewMatrices.GetPerProjectionDepthThicknessScale();
ScreenProbeParameters.NumUniformScreenProbes = ScreenProbeParameters.ScreenProbeViewSize.X * ScreenProbeParameters.ScreenProbeViewSize.Y;
ScreenProbeParameters.MaxNumAdaptiveProbes = FMath::TruncToInt(ScreenProbeParameters.NumUniformScreenProbes * GLumenScreenProbeGatherAdaptiveProbeAllocationFraction);
ScreenProbeParameters.FixedJitterIndex = GLumenScreenProbeFixedJitterIndex;
{