r.Lumen.TraceMeshSDFs.Allow
r.Lumen.TraceMeshSDFs.Allow
#Overview
name: r.Lumen.TraceMeshSDFs.Allow
The value of this variable can be defined or overridden in .ini config files. 3
.ini config files referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether Lumen should trace against Mesh Signed Distance fields. When enabled, Lumen\'s Software Tracing will be more accurate, but scenes with high instance density (overlapping meshes) will have high tracing costs. When disabled, lower resolution Global Signed Distance Field will be used instead.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.TraceMeshSDFs.Allow is to control whether Lumen should trace against Mesh Signed Distance Fields (SDFs) for improved accuracy in software tracing at the cost of potentially higher tracing costs in scenes with high instance density.
This setting variable is primarily used by the Lumen subsystem within Unreal Engine’s rendering module. It specifically affects the Lumen Diffuse Indirect lighting calculations.
The value of this variable is set through the console variable system in Unreal Engine. It’s initialized with a default value of 1 (enabled) and can be changed at runtime or through configuration files.
The associated variable GLumenAllowTracingMeshSDFs directly interacts with r.Lumen.TraceMeshSDFs.Allow. They share the same value and are used interchangeably in the code.
Developers must be aware that enabling this variable can significantly impact performance in scenes with many overlapping meshes. When disabled, Lumen will use a lower resolution Global Signed Distance Field instead, which may be less accurate but more performant.
Best practices when using this variable include:
- Enabling it for scenes where high-quality lighting is crucial and performance is not a major concern.
- Disabling it for scenes with high instance density or where performance is a priority.
- Testing both enabled and disabled states to find the right balance between visual quality and performance for your specific scene.
Regarding the associated variable GLumenAllowTracingMeshSDFs:
- Its purpose is the same as r.Lumen.TraceMeshSDFs.Allow, serving as an internal representation of the console variable.
- It’s used directly in the Lumen subsystem’s code to determine whether to use Mesh SDF tracing.
- The value is set by the console variable system and can be accessed in C++ code.
- It interacts with other variables like GLumenTraceMeshSDFs and ViewFamily.EngineShowFlags.LumenDetailTraces to determine the final tracing behavior.
- Developers should not modify this variable directly but instead use the console variable r.Lumen.TraceMeshSDFs.Allow to control its value.
- Best practices include using this variable in conjunction with other Lumen settings to fine-tune the balance between lighting quality and performance in your game or application.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseScalability.ini:276, section: [GlobalIlluminationQuality@2]
- INI Section:
GlobalIlluminationQuality@2
- Raw value:
0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:299, section: [GlobalIlluminationQuality@3]
- INI Section:
GlobalIlluminationQuality@3
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:323, section: [GlobalIlluminationQuality@Cine]
- INI Section:
GlobalIlluminationQuality@Cine
- Raw value:
1
- Is Array:
False
#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:105
Scope: file
Source code excerpt:
int32 GLumenAllowTracingMeshSDFs = 1;
FAutoConsoleVariableRef CVarLumenAllowTraceMeshSDFs(
TEXT("r.Lumen.TraceMeshSDFs.Allow"),
GLumenAllowTracingMeshSDFs,
TEXT("Whether Lumen should trace against Mesh Signed Distance fields. When enabled, Lumen's Software Tracing will be more accurate, but scenes with high instance density (overlapping meshes) will have high tracing costs. When disabled, lower resolution Global Signed Distance Field will be used instead."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
FAutoConsoleVariableRef GVarLumenDiffuseMaxMeshSDFTraceDistance(
#Associated Variable and Callsites
This variable is associated with another variable named GLumenAllowTracingMeshSDFs
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenDiffuseIndirect.cpp:103
Scope: file
Source code excerpt:
// Scalability setting driven by scalability ini
int32 GLumenAllowTracingMeshSDFs = 1;
FAutoConsoleVariableRef CVarLumenAllowTraceMeshSDFs(
TEXT("r.Lumen.TraceMeshSDFs.Allow"),
GLumenAllowTracingMeshSDFs,
TEXT("Whether Lumen should trace against Mesh Signed Distance fields. When enabled, Lumen's Software Tracing will be more accurate, but scenes with high instance density (overlapping meshes) will have high tracing costs. When disabled, lower resolution Global Signed Distance Field will be used instead."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
FAutoConsoleVariableRef GVarLumenDiffuseMaxMeshSDFTraceDistance(
TEXT("r.Lumen.TraceMeshSDFs.TraceDistance"),
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenDiffuseIndirect.cpp:193
Scope (from outer to inner):
file
function bool Lumen::UseMeshSDFTracing
Source code excerpt:
{
return GLumenTraceMeshSDFs != 0
&& GLumenAllowTracingMeshSDFs != 0
&& ViewFamily.EngineShowFlags.LumenDetailTraces;
}
bool Lumen::UseGlobalSDFTracing(const FSceneViewFamily& ViewFamily)
{
return ViewFamily.EngineShowFlags.LumenGlobalTraces;