r.LumenScene.DirectLighting.OffscreenShadowingTraceStepFactor
r.LumenScene.DirectLighting.OffscreenShadowingTraceStepFactor
#Overview
name: r.LumenScene.DirectLighting.OffscreenShadowingTraceStepFactor
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.LumenScene.DirectLighting.OffscreenShadowingTraceStepFactor is to control the step size factor used in offscreen shadowing calculations for Lumen’s direct lighting system in Unreal Engine 5.
This setting variable is primarily used in the Lumen Scene Direct Lighting subsystem, which is part of the Renderer module. It affects the rendering process, specifically the shadow calculation for direct lighting in Lumen.
The value of this variable is set through the console variable system, as indicated by the FAutoConsoleVariableRef declaration. It can be modified at runtime using console commands or through configuration files.
The associated variable GOffscreenShadowingTraceStepFactor interacts directly with r.LumenScene.DirectLighting.OffscreenShadowingTraceStepFactor. They share the same value, with GOffscreenShadowingTraceStepFactor being the C++ variable used in the code to access the setting.
Developers must be aware that this variable affects the performance and quality trade-off in shadow calculations. A higher value may improve performance but could potentially reduce shadow quality, while a lower value may increase shadow quality at the cost of performance.
Best practices when using this variable include:
- Keeping the value within the recommended range (0.1 to 10.0, as seen in the clamp function).
- Testing different values to find the optimal balance between performance and visual quality for your specific scene.
- Considering the impact on different hardware configurations, as the optimal value may vary depending on the target platform.
The associated variable GOffscreenShadowingTraceStepFactor is used directly in the C++ code to apply the step factor in shadow tracing calculations. It’s initialized with a default value of 5 and can be modified at runtime through the console variable system. When using this variable in code, developers should be aware that its value is clamped between 0.1 and 10.0 when applied in the shadowing calculations.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneDirectLighting.cpp:37
Scope: file
Source code excerpt:
float GOffscreenShadowingTraceStepFactor = 5;
FAutoConsoleVariableRef CVarOffscreenShadowingTraceStepFactor(
TEXT("r.LumenScene.DirectLighting.OffscreenShadowingTraceStepFactor"),
GOffscreenShadowingTraceStepFactor,
TEXT(""),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GLumenDirectLightingCloudTransmittance = 1;
#Associated Variable and Callsites
This variable is associated with another variable named GOffscreenShadowingTraceStepFactor
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneDirectLighting.cpp:35
Scope: file
Source code excerpt:
);
float GOffscreenShadowingTraceStepFactor = 5;
FAutoConsoleVariableRef CVarOffscreenShadowingTraceStepFactor(
TEXT("r.LumenScene.DirectLighting.OffscreenShadowingTraceStepFactor"),
GOffscreenShadowingTraceStepFactor,
TEXT(""),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GLumenDirectLightingCloudTransmittance = 1;
FAutoConsoleVariableRef CVarLumenDirectLightingCloudTransmittance(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneDirectLighting.cpp:1070
Scope (from outer to inner):
file
function static int32 ComputeShadowMaskFromLightAttenuation
lambda-function
Source code excerpt:
CommonParameters.ForwardLightData = View.ForwardLightingResources.ForwardLightUniformBuffer;
CommonParameters.MaxTraceDistance = Lumen::GetMaxTraceDistance(View);
CommonParameters.StepFactor = FMath::Clamp(GOffscreenShadowingTraceStepFactor, .1f, 10.0f);
CommonParameters.HeightfieldShadowReceiverBias = Lumen::GetHeightfieldReceiverBias();
};
int32 NumLightsNeedShadowMasks = StandaloneLightIndices.Num();
for (const int32 StandaloneLightIndex : StandaloneLightIndices)
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneDirectLighting.cpp:1254
Scope (from outer to inner):
file
function void TraceDistanceFieldShadows
lambda-function
Source code excerpt:
PassParameters->MaxTraceDistance = Lumen::GetMaxTraceDistance(View);
PassParameters->StepFactor = FMath::Clamp(GOffscreenShadowingTraceStepFactor, .1f, 10.0f);
PassParameters->MeshSDFShadowRayBias = LumenSceneDirectLighting::GetMeshSDFShadowRayBias();
PassParameters->HeightfieldShadowRayBias = LumenSceneDirectLighting::GetHeightfieldShadowRayBias();
PassParameters->GlobalSDFShadowRayBias = LumenSceneDirectLighting::GetGlobalSDFShadowRayBias();
PassParameters->HeightfieldMaxTracingSteps = Lumen::GetHeightfieldMaxTracingSteps();
};