r.Lumen.Reflections.DistantScreenTraces.MaxTraceDistance

r.Lumen.Reflections.DistantScreenTraces.MaxTraceDistance

#Overview

name: r.Lumen.Reflections.DistantScreenTraces.MaxTraceDistance

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.MaxTraceDistance is to define the maximum trace distance for distant screen traces in the Lumen reflection system. This setting is part of Unreal Engine 5’s Lumen global illumination and reflection system.

This setting variable is primarily used in the rendering system, specifically in the Lumen reflection tracing subsystem. Based on the callsites, it’s clear that this variable is utilized in the LumenReflectionTracing module.

The value of this variable is set through the Unreal Engine console variable system. It’s initialized with a default value of 200000.0f and can be modified at runtime using console commands.

The associated variable GLumenReflectionDistantScreenTraceMaxTraceDistance directly interacts with this console variable. They share the same value, with the console variable acting as an interface for adjusting the value at runtime.

Developers should be aware that this variable affects the maximum distance for distant screen traces in reflections. A higher value will allow for longer-distance traces but may impact performance. Conversely, a lower value might improve performance but could limit the accuracy of distant reflections.

Best practices when using this variable include:

  1. Adjusting it based on the scale and requirements of your scene.
  2. Balancing between visual quality and performance.
  3. Testing different values to find the optimal setting for your specific use case.
  4. Considering the interaction with other Lumen reflection settings for best results.

Regarding the associated variable GLumenReflectionDistantScreenTraceMaxTraceDistance:

#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:119

Scope: file

Source code excerpt:

float GLumenReflectionDistantScreenTraceMaxTraceDistance = 200000.0f;
FAutoConsoleVariableRef GVarLumenReflectionDistantScreenTraceMaxTraceDistance(
	TEXT("r.Lumen.Reflections.DistantScreenTraces.MaxTraceDistance"),
	GLumenReflectionDistantScreenTraceMaxTraceDistance,
	TEXT("Trace distance of distant screen traces."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<float> CVarLumenReflectionsSampleSceneColorNormalTreshold(

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

float GLumenReflectionDistantScreenTraceMaxTraceDistance = 200000.0f;
FAutoConsoleVariableRef GVarLumenReflectionDistantScreenTraceMaxTraceDistance(
	TEXT("r.Lumen.Reflections.DistantScreenTraces.MaxTraceDistance"),
	GLumenReflectionDistantScreenTraceMaxTraceDistance,
	TEXT("Trace distance of distant screen traces."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<float> CVarLumenReflectionsSampleSceneColorNormalTreshold(
	TEXT("r.Lumen.Reflections.SampleSceneColorNormalTreshold"),

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

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());
			PermutationVector.Set< FReflectionTraceVoxelsCS::FHairStrands >(bNeedTraceHairVoxel);