r.Lumen.DiffuseIndirect.TraceStepFactor
r.Lumen.DiffuseIndirect.TraceStepFactor
#Overview
name: r.Lumen.DiffuseIndirect.TraceStepFactor
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.Lumen.DiffuseIndirect.TraceStepFactor is to control the step factor for diffuse indirect tracing in the Lumen global illumination system of Unreal Engine 5. This setting variable is part of the rendering system, specifically the Lumen lighting subsystem.
Based on the details in the Callsites section, this setting variable is primarily used in the Lumen module of the Renderer subsystem. It’s defined and used in the LumenDiffuseIndirect.cpp file, which is part of the Lumen global illumination implementation.
The value of this variable is set using an FAutoConsoleVariableRef, which means it can be adjusted at runtime through console commands or configuration files. The default value is 1.0, as seen in the initialization of GDiffuseTraceStepFactor.
This variable interacts directly with GDiffuseTraceStepFactor, which is the associated C++ variable that stores the actual value. They share the same value, with r.Lumen.DiffuseIndirect.TraceStepFactor being the console variable name and GDiffuseTraceStepFactor being the C++ variable used in the code.
Developers must be aware that this variable affects the performance and quality of the Lumen diffuse indirect lighting calculations. A higher value may improve performance at the cost of accuracy, while a lower value may increase accuracy but at a higher performance cost.
Best practices when using this variable include:
- Keeping the value within a reasonable range (the code clamps it between 0.1 and 10.0)
- Testing different values to find the optimal balance between performance and visual quality for your specific scene
- Consider exposing this setting to end-users for performance scaling options
Regarding the associated variable GDiffuseTraceStepFactor:
The purpose of GDiffuseTraceStepFactor is to store the actual value of the trace step factor used in the Lumen diffuse indirect lighting calculations.
This variable is used within the Lumen module of the Renderer subsystem, specifically in the SetupLumenDiffuseTracingParameters function.
The value of GDiffuseTraceStepFactor is set by the console variable r.Lumen.DiffuseIndirect.TraceStepFactor.
It interacts with the FLumenIndirectTracingParameters structure, specifically setting the StepFactor member of this structure.
Developers should be aware that this variable is used directly in the lighting calculations and its value is clamped between 0.1 and 10.0 when used.
Best practices for using GDiffuseTraceStepFactor include:
- Avoiding direct modification of this variable in code, instead use the console variable to change its value
- Understanding that changes to this variable will directly impact the Lumen diffuse indirect lighting calculations
- Considering the performance implications when adjusting this value, as it can affect the number of steps taken during ray tracing
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenDiffuseIndirect.cpp:40
Scope: file
Source code excerpt:
float GDiffuseTraceStepFactor = 1;
FAutoConsoleVariableRef CVarDiffuseTraceStepFactor(
TEXT("r.Lumen.DiffuseIndirect.TraceStepFactor"),
GDiffuseTraceStepFactor,
TEXT("."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GLumenDiffuseMinSampleRadius = 10;
#Associated Variable and Callsites
This variable is associated with another variable named GDiffuseTraceStepFactor
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenDiffuseIndirect.cpp:38
Scope: file
Source code excerpt:
);
float GDiffuseTraceStepFactor = 1;
FAutoConsoleVariableRef CVarDiffuseTraceStepFactor(
TEXT("r.Lumen.DiffuseIndirect.TraceStepFactor"),
GDiffuseTraceStepFactor,
TEXT("."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GLumenDiffuseMinSampleRadius = 10;
FAutoConsoleVariableRef CVarLumenDiffuseMinSampleRadius(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenDiffuseIndirect.cpp:300
Scope (from outer to inner):
file
function void SetupLumenDiffuseTracingParameters
Source code excerpt:
void SetupLumenDiffuseTracingParameters(const FViewInfo& View, FLumenIndirectTracingParameters& OutParameters)
{
OutParameters.StepFactor = FMath::Clamp(GDiffuseTraceStepFactor, .1f, 10.0f);
OutParameters.MinSampleRadius = FMath::Clamp(GLumenDiffuseMinSampleRadius, .01f, 100.0f);
OutParameters.MinTraceDistance = FMath::Clamp(GLumenDiffuseMinTraceDistance, .01f, 1000.0f);
OutParameters.MaxTraceDistance = Lumen::GetMaxTraceDistance(View);
if (!View.IsPerspectiveProjection() && CVarOrthoOverrideMeshDFTraceDistances.GetValueOnAnyThread())
{