r.Lumen.DiffuseIndirect.CardTraceEndDistanceFromCamera
r.Lumen.DiffuseIndirect.CardTraceEndDistanceFromCamera
#Overview
name: r.Lumen.DiffuseIndirect.CardTraceEndDistanceFromCamera
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.DiffuseIndirect.CardTraceEndDistanceFromCamera is to control the maximum distance from the camera at which card tracing for diffuse indirect lighting ends in Unreal Engine 5’s Lumen global illumination system.
This setting variable is primarily used in the Lumen rendering subsystem, specifically in the diffuse indirect lighting and reflection tracing components. It is utilized in the Renderer module of Unreal Engine 5.
The value of this variable is set through the Unreal Engine console variable system. It is initialized with a default value of 4000.0 units and can be modified at runtime.
The associated variable GDiffuseCardTraceEndDistanceFromCamera directly interacts with r.Lumen.DiffuseIndirect.CardTraceEndDistanceFromCamera. They share the same value, with GDiffuseCardTraceEndDistanceFromCamera being the C++ variable used in the engine’s source code.
Developers should be aware that this variable affects the distance at which card tracing for diffuse indirect lighting and reflections stops. It can impact both visual quality and performance. In orthographic views, the value may be overridden to match the view’s dimensions.
Best practices when using this variable include:
- Adjusting it based on the scale of your scene to ensure proper coverage of indirect lighting.
- Balancing it with other Lumen settings for optimal performance and visual quality.
- Testing different values in various scenarios to find the best trade-off between quality and performance for your specific project.
Regarding the associated variable GDiffuseCardTraceEndDistanceFromCamera:
- It is the internal C++ representation of the console variable.
- It is used directly in the rendering code to set up Lumen diffuse tracing and reflection tracing parameters.
- It is applied in both perspective and orthographic view scenarios, with special handling for orthographic views.
- Developers working directly with the engine source code should use this variable when accessing the card trace end distance in C++ code.
#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:79
Scope: file
Source code excerpt:
float GDiffuseCardTraceEndDistanceFromCamera = 4000.0f;
FAutoConsoleVariableRef CVarDiffuseCardTraceEndDistanceFromCamera(
TEXT("r.Lumen.DiffuseIndirect.CardTraceEndDistanceFromCamera"),
GDiffuseCardTraceEndDistanceFromCamera,
TEXT(""),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GLumenTraceDistanceScale = 1.0f;
#Associated Variable and Callsites
This variable is associated with another variable named GDiffuseCardTraceEndDistanceFromCamera
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenDiffuseIndirect.cpp:77
Scope: file
Source code excerpt:
);
float GDiffuseCardTraceEndDistanceFromCamera = 4000.0f;
FAutoConsoleVariableRef CVarDiffuseCardTraceEndDistanceFromCamera(
TEXT("r.Lumen.DiffuseIndirect.CardTraceEndDistanceFromCamera"),
GDiffuseCardTraceEndDistanceFromCamera,
TEXT(""),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GLumenTraceDistanceScale = 1.0f;
FAutoConsoleVariableRef CVarTraceDistanceScale(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenDiffuseIndirect.cpp:309
Scope (from outer to inner):
file
function void SetupLumenDiffuseTracingParameters
Source code excerpt:
float TraceSDFDistance = FMath::Clamp(View.ViewMatrices.GetOrthoDimensions().GetMax(), OutParameters.MinTraceDistance, OutParameters.MaxTraceDistance);
OutParameters.MaxMeshSDFTraceDistance = TraceSDFDistance;
OutParameters.CardTraceEndDistanceFromCamera = FMath::Max(GDiffuseCardTraceEndDistanceFromCamera, TraceSDFDistance);
}
else
{
OutParameters.MaxMeshSDFTraceDistance = FMath::Clamp(GLumenGatherCvars.MeshSDFTraceDistance, OutParameters.MinTraceDistance, OutParameters.MaxTraceDistance);
OutParameters.CardTraceEndDistanceFromCamera = GDiffuseCardTraceEndDistanceFromCamera;
}
OutParameters.SurfaceBias = FMath::Clamp(GLumenGatherCvars.SurfaceBias, .01f, 100.0f);
OutParameters.CardInterpolateInfluenceRadius = FMath::Clamp(GLumenDiffuseCardInterpolateInfluenceRadius, .01f, 1000.0f);
OutParameters.HeightfieldMaxTracingSteps = Lumen::GetHeightfieldMaxTracingSteps();
//@todo - remove
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflectionTracing.cpp:721
Scope (from outer to inner):
file
function void SetupIndirectTracingParametersForReflections
Source code excerpt:
//@todo - cleanup
OutParameters.StepFactor = 1.0f;
extern float GDiffuseCardTraceEndDistanceFromCamera;
OutParameters.CardTraceEndDistanceFromCamera = GDiffuseCardTraceEndDistanceFromCamera;
OutParameters.MinSampleRadius = 0.0f;
OutParameters.MinTraceDistance = 0.0f;
OutParameters.MaxTraceDistance = Lumen::GetMaxTraceDistance(View);
extern FLumenGatherCvarState GLumenGatherCvars;
bool OrthoOverrideMeshDF = false;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflectionTracing.cpp:742
Scope (from outer to inner):
file
function void SetupIndirectTracingParametersForReflections
Source code excerpt:
float TraceSDFDistance = FMath::Clamp(View.ViewMatrices.GetOrthoDimensions().GetMax(), OutParameters.MinTraceDistance, OutParameters.MaxTraceDistance);
OutParameters.MaxMeshSDFTraceDistance = TraceSDFDistance;
OutParameters.CardTraceEndDistanceFromCamera = FMath::Max(GDiffuseCardTraceEndDistanceFromCamera, TraceSDFDistance);
}
else
{
OutParameters.MaxMeshSDFTraceDistance = FMath::Clamp(GLumenGatherCvars.MeshSDFTraceDistance, OutParameters.MinTraceDistance, OutParameters.MaxTraceDistance);
OutParameters.CardTraceEndDistanceFromCamera = GDiffuseCardTraceEndDistanceFromCamera;
}
OutParameters.SurfaceBias = FMath::Clamp(GLumenGatherCvars.SurfaceBias, .01f, 100.0f);
OutParameters.CardInterpolateInfluenceRadius = 10.0f;
OutParameters.DiffuseConeHalfAngle = 0.0f;
OutParameters.TanDiffuseConeHalfAngle = 0.0f;