r.Lumen.Reflections.TraceMeshSDFs
r.Lumen.Reflections.TraceMeshSDFs
#Overview
name: r.Lumen.Reflections.TraceMeshSDFs
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.Reflections.TraceMeshSDFs is to control whether Lumen’s reflection system traces mesh Signed Distance Fields (SDFs) during the reflection rendering process. This setting is part of the Lumen global illumination and reflection system in Unreal Engine 5’s rendering pipeline.
This setting variable is primarily used in the Lumen Reflections subsystem of Unreal Engine 5’s renderer module. It’s specifically referenced in the LumenReflections.cpp file, which is responsible for implementing Lumen’s reflection rendering.
The value of this variable is set through the Unreal Engine console variable system. It’s initialized to 1 (enabled) by default, but can be changed at runtime or through configuration files.
The associated variable GLumenReflectionTraceMeshSDFs directly interacts with r.Lumen.Reflections.TraceMeshSDFs. They share the same value, with GLumenReflectionTraceMeshSDFs being the actual integer variable used in the C++ code to control the behavior.
Developers should be aware that this variable affects the quality and performance of Lumen reflections. When enabled (set to non-zero), it allows the reflection system to trace mesh SDFs, which can provide more accurate reflections for complex geometry but may come at a performance cost.
Best practices when using this variable include:
- Consider disabling it (setting to 0) on lower-end hardware or when prioritizing performance over reflection quality.
- Test the visual impact and performance implications in your specific scenes when toggling this setting.
- Be aware that it only affects opaque reflections, as indicated by the condition check in the code.
Regarding the associated variable GLumenReflectionTraceMeshSDFs:
The purpose of GLumenReflectionTraceMeshSDFs is to serve as the actual integer variable that controls whether mesh SDF tracing is enabled in Lumen reflections.
It’s used directly in the Lumen Reflections rendering code to determine whether to include mesh SDF tracing in the reflection pass.
The value of this variable is set by the console variable system, mirroring the value of r.Lumen.Reflections.TraceMeshSDFs.
It interacts directly with the rendering logic, specifically in the RenderLumenReflections function, where it’s used to determine if mesh objects should be traced.
Developers should be aware that this variable directly affects the behavior of the reflection rendering pass. Its value (0 or non-zero) determines whether mesh SDF tracing is included in the reflection calculations.
Best practices include:
- Avoid directly modifying this variable in code; instead, use the console variable r.Lumen.Reflections.TraceMeshSDFs to control its value.
- When optimizing reflection performance, consider the impact of this variable on your specific scenes and adjust accordingly.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflections.cpp:36
Scope: file
Source code excerpt:
int32 GLumenReflectionTraceMeshSDFs = 1;
FAutoConsoleVariableRef GVarLumenReflectionTraceMeshSDFs(
TEXT("r.Lumen.Reflections.TraceMeshSDFs"),
GLumenReflectionTraceMeshSDFs,
TEXT(""),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GLumenReflectionsUseRadianceCache = 0;
#Associated Variable and Callsites
This variable is associated with another variable named GLumenReflectionTraceMeshSDFs
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflections.cpp:34
Scope: file
Source code excerpt:
);
int32 GLumenReflectionTraceMeshSDFs = 1;
FAutoConsoleVariableRef GVarLumenReflectionTraceMeshSDFs(
TEXT("r.Lumen.Reflections.TraceMeshSDFs"),
GLumenReflectionTraceMeshSDFs,
TEXT(""),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GLumenReflectionsUseRadianceCache = 0;
FAutoConsoleVariableRef CVarLumenReflectionsUseRadianceCache(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflections.cpp:1196
Scope (from outer to inner):
file
function FRDGTextureRef FDeferredShadingSceneRenderer::RenderLumenReflections
Source code excerpt:
}
const bool bTraceMeshObjects = GLumenReflectionTraceMeshSDFs != 0
&& Lumen::UseMeshSDFTracing(ViewFamily)
// HZB is only built to include opaque but is used to cull Mesh SDFs
&& ReflectionPass == ELumenReflectionPass::Opaque;
TraceReflections(
GraphBuilder,