r.Lumen.Visualize.TraceMeshSDFs
r.Lumen.Visualize.TraceMeshSDFs
#Overview
name: r.Lumen.Visualize.TraceMeshSDFs
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to use Mesh SDF tracing for lumen scene visualization.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.Visualize.TraceMeshSDFs is to control whether Mesh SDF (Signed Distance Field) tracing is used for Lumen scene visualization. This setting is part of Unreal Engine 5’s Lumen global illumination system, specifically its visualization and debugging features.
This setting variable is primarily used in the Renderer module of Unreal Engine, particularly within the Lumen subsystem. Based on the callsites, it’s clear that this variable is utilized in the LumenVisualize.cpp file, which is responsible for visualization features of the Lumen system.
The value of this variable is set through the Unreal Engine console variable system. It’s defined as an FAutoConsoleVariableRef, which means it can be modified at runtime through console commands or configuration files.
The associated variable GVisualizeLumenSceneTraceMeshSDFs interacts directly with r.Lumen.Visualize.TraceMeshSDFs. They share the same value, with GVisualizeLumenSceneTraceMeshSDFs being the actual integer variable used in the C++ code.
Developers should be aware that this variable affects the visualization of Lumen scenes, specifically whether Mesh SDF tracing is used. It’s a boolean value (0 or 1), where 1 enables Mesh SDF tracing for visualization.
Best practices when using this variable include:
- Use it primarily for debugging and visualization purposes.
- Be aware that enabling this feature may have performance implications, especially in complex scenes.
- Use in conjunction with other Lumen visualization tools for comprehensive debugging.
Regarding the associated variable GVisualizeLumenSceneTraceMeshSDFs:
The purpose of GVisualizeLumenSceneTraceMeshSDFs is to store the actual value of whether Mesh SDF tracing should be used for Lumen scene visualization. It’s the C++ representation of the console variable r.Lumen.Visualize.TraceMeshSDFs.
This variable is used directly in the Renderer module, specifically in the Lumen visualization code. It’s checked in the SetupVisualizeParameters function to determine whether to trace Mesh SDFs.
The value of this variable is set through the console variable system, mirroring r.Lumen.Visualize.TraceMeshSDFs.
It interacts with other visualization parameters, such as GVisualizeLumenSceneConeStepFactor, as seen in the SetupVisualizeParameters function.
Developers should be aware that this variable directly controls the behavior of Lumen visualization. When it’s non-zero and LumenDetailTraces are enabled in the engine show flags, Mesh SDF tracing is activated.
Best practices for using this variable include:
- Use it in conjunction with View.Family->EngineShowFlags.LumenDetailTraces for full control over visualization.
- Be mindful of its performance impact when enabled.
- Use it as part of a broader strategy for debugging and optimizing Lumen global illumination in your scenes.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenVisualize.cpp:68
Scope: file
Source code excerpt:
int32 GVisualizeLumenSceneTraceMeshSDFs = 1;
FAutoConsoleVariableRef CVarVisualizeLumenSceneTraceMeshSDFs(
TEXT("r.Lumen.Visualize.TraceMeshSDFs"),
GVisualizeLumenSceneTraceMeshSDFs,
TEXT("Whether to use Mesh SDF tracing for lumen scene visualization."),
ECVF_RenderThreadSafe
);
float GVisualizeLumenSceneMaxMeshSDFTraceDistance = -1.0f;
#Associated Variable and Callsites
This variable is associated with another variable named GVisualizeLumenSceneTraceMeshSDFs
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenVisualize.cpp:66
Scope: file
Source code excerpt:
);
int32 GVisualizeLumenSceneTraceMeshSDFs = 1;
FAutoConsoleVariableRef CVarVisualizeLumenSceneTraceMeshSDFs(
TEXT("r.Lumen.Visualize.TraceMeshSDFs"),
GVisualizeLumenSceneTraceMeshSDFs,
TEXT("Whether to use Mesh SDF tracing for lumen scene visualization."),
ECVF_RenderThreadSafe
);
float GVisualizeLumenSceneMaxMeshSDFTraceDistance = -1.0f;
FAutoConsoleVariableRef CVarVisualizeLumenSceneCardMaxTraceDistance(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenVisualize.cpp:670
Scope (from outer to inner):
file
function void SetupVisualizeParameters
Source code excerpt:
// FLumenVisualizeSceneSoftwareRayTracingParameters
{
bool bTraceMeshSDF = GVisualizeLumenSceneTraceMeshSDFs != 0 && View.Family->EngineShowFlags.LumenDetailTraces;
if (!bTraceMeshSDF)
{
MaxMeshSDFTraceDistance = 0.0f;
}
VisualizeParameters.VisualizeStepFactor = FMath::Clamp(GVisualizeLumenSceneConeStepFactor, .1f, 10.0f);