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).

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:

  1. Enabling it for scenes where high-quality lighting is crucial and performance is not a major concern.
  2. Disabling it for scenes with high instance density or where performance is a priority.
  3. 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:

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseScalability.ini:276, section: [GlobalIlluminationQuality@2]

Location: <Workspace>/Engine/Config/BaseScalability.ini:299, section: [GlobalIlluminationQuality@3]

Location: <Workspace>/Engine/Config/BaseScalability.ini:323, section: [GlobalIlluminationQuality@Cine]

#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;