r.Lumen.Reflections.DistantScreenTraces.DepthThreshold

r.Lumen.Reflections.DistantScreenTraces.DepthThreshold

#Overview

name: r.Lumen.Reflections.DistantScreenTraces.DepthThreshold

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.Reflections.DistantScreenTraces.DepthThreshold is to set a depth threshold for linear screen traces performed in areas where other tracing methods have missed in Lumen’s reflection system.

This setting variable is primarily used in the Lumen reflection system, which is part of Unreal Engine 5’s global illumination and reflection solution. It’s specifically utilized in the rendering subsystem, particularly in the Lumen reflection tracing module.

The value of this variable is set through the Unreal Engine’s console variable system. It’s defined as an FAutoConsoleVariableRef, which means it can be adjusted at runtime through console commands or configuration files.

This variable interacts closely with GLumenReflectionDistantScreenTraceSlopeCompareTolerance, as they share the same value. This suggests that the depth threshold and slope comparison tolerance for distant screen traces are tightly coupled in the reflection tracing algorithm.

Developers should be aware that this variable affects the accuracy and performance of distant screen traces in Lumen reflections. A higher value might improve performance but could potentially reduce the accuracy of reflections for distant objects.

Best practices when using this variable include:

  1. Adjusting it in conjunction with other Lumen reflection settings for optimal balance between quality and performance.
  2. Testing its impact in various lighting scenarios and environments.
  3. Considering its interaction with GLumenReflectionDistantScreenTraceSlopeCompareTolerance when making adjustments.

Regarding GLumenReflectionDistantScreenTraceSlopeCompareTolerance:

This associated variable serves as a slope comparison tolerance for distant screen traces in Lumen reflections. It’s used in the same context as r.Lumen.Reflections.DistantScreenTraces.DepthThreshold and likely helps determine when to perform additional traces based on the slope of the depth buffer.

The variable is set in the same location as r.Lumen.Reflections.DistantScreenTraces.DepthThreshold and is used in the ReflectionTraceVoxelsCS compute shader.

Developers should consider this variable when fine-tuning the behavior of distant screen traces in Lumen reflections, especially in scenes with complex geometry or when optimizing for performance in large environments.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflectionTracing.cpp:111

Scope: file

Source code excerpt:

float GLumenReflectionDistantScreenTraceSlopeCompareTolerance = 2.0f;
FAutoConsoleVariableRef GVarLumenReflectionDistantScreenTraceDepthThreshold(
	TEXT("r.Lumen.Reflections.DistantScreenTraces.DepthThreshold"),
	GLumenReflectionDistantScreenTraceSlopeCompareTolerance,
	TEXT("Depth threshold for the linear screen traces done where other traces have missed."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

float GLumenReflectionDistantScreenTraceMaxTraceDistance = 200000.0f;

#Associated Variable and Callsites

This variable is associated with another variable named GLumenReflectionDistantScreenTraceSlopeCompareTolerance. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflectionTracing.cpp:109

Scope: file

Source code excerpt:

);

float GLumenReflectionDistantScreenTraceSlopeCompareTolerance = 2.0f;
FAutoConsoleVariableRef GVarLumenReflectionDistantScreenTraceDepthThreshold(
	TEXT("r.Lumen.Reflections.DistantScreenTraces.DepthThreshold"),
	GLumenReflectionDistantScreenTraceSlopeCompareTolerance,
	TEXT("Depth threshold for the linear screen traces done where other traces have missed."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

float GLumenReflectionDistantScreenTraceMaxTraceDistance = 200000.0f;
FAutoConsoleVariableRef GVarLumenReflectionDistantScreenTraceMaxTraceDistance(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflectionTracing.cpp:1069

Scope (from outer to inner):

file
function     void TraceReflections

Source code excerpt:


			PassParameters->DistantScreenTraceFurthestHZBTexture = View.HZB;
			PassParameters->DistantScreenTraceSlopeCompareTolerance = GLumenReflectionDistantScreenTraceSlopeCompareTolerance;
			PassParameters->DistantScreenTraceMaxTraceDistance = GLumenReflectionDistantScreenTraceMaxTraceDistance;

			FReflectionTraceVoxelsCS::FPermutationDomain PermutationVector;
			PermutationVector.Set< FReflectionTraceVoxelsCS::FThreadGroupSize32 >(Lumen::UseThreadGroupSize32());
			PermutationVector.Set< FReflectionTraceVoxelsCS::FTraceGlobalSDF >(Lumen::UseGlobalSDFTracing(*View.Family));
			PermutationVector.Set< FReflectionTraceVoxelsCS::FSimpleCoverageBasedExpand>(Lumen::UseGlobalSDFTracing(*View.Family) && Lumen::UseGlobalSDFSimpleCoverageBasedExpand());