r.Lumen.Reflections.HierarchicalScreenTraces.RelativeDepthThickness

r.Lumen.Reflections.HierarchicalScreenTraces.RelativeDepthThickness

#Overview

name: r.Lumen.Reflections.HierarchicalScreenTraces.RelativeDepthThickness

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.HierarchicalScreenTraces.RelativeDepthThickness is to determine the depth thickness of objects hit by Hierarchical Z-Buffer (HZB) tracing in Lumen’s reflection system, using a relative depth threshold.

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 screen-space tracing component of Lumen reflections.

The value of this variable is set through the console variable system, as indicated by the FAutoConsoleVariableRef declaration. It can be adjusted at runtime or set in configuration files.

The variable interacts closely with GLumenReflectionHierarchicalScreenTraceRelativeDepthThreshold, which shares the same value. This value is used in calculations related to the relative depth thickness for HZB tracing in reflections.

Developers should be aware that this variable affects the accuracy and performance of screen-space reflections in Lumen. A higher value may result in thicker object representations in the depth buffer, potentially capturing more detail but at the cost of performance.

Best practices when using this variable include:

  1. Adjusting it based on the specific needs of your scene and the desired balance between reflection quality and performance.
  2. Testing different values to find the optimal setting for your project.
  3. Considering the interaction with other Lumen reflection settings for best results.

Regarding the associated variable GLumenReflectionHierarchicalScreenTraceRelativeDepthThreshold:

The purpose of this variable is to store the actual value used in the reflection tracing calculations. It’s initialized with a default value of 0.005f.

This variable is used directly in the Lumen reflection system, specifically in the screen tracing pass of the reflection pipeline.

The value is set at the global scope of the file and can be modified through the console variable system.

It interacts directly with the r.Lumen.Reflections.HierarchicalScreenTraces.RelativeDepthThickness console variable, from which it gets its value.

Developers should be aware that modifying this variable will directly affect the behavior of the Hierarchical Z-Buffer tracing in Lumen reflections.

Best practices for this variable include:

  1. Avoid modifying it directly in code; instead, use the console variable to ensure consistency.
  2. Consider its impact on both visual quality and performance when adjusting its value.
  3. Use it in conjunction with other Lumen reflection settings for optimal results.

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

Scope: file

Source code excerpt:

float GLumenReflectionHierarchicalScreenTraceRelativeDepthThreshold = .005f;
FAutoConsoleVariableRef GVarLumenReflectionHierarchicalScreenTraceRelativeDepthThreshold(
	TEXT("r.Lumen.Reflections.HierarchicalScreenTraces.RelativeDepthThickness"),
	GLumenReflectionHierarchicalScreenTraceRelativeDepthThreshold,
	TEXT("Determines depth thickness of objects hit by HZB tracing, as a relative depth threshold."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

float GLumenReflectionHierarchicalScreenTraceHistoryDepthTestRelativeThickness = .01f;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

float GLumenReflectionHierarchicalScreenTraceRelativeDepthThreshold = .005f;
FAutoConsoleVariableRef GVarLumenReflectionHierarchicalScreenTraceRelativeDepthThreshold(
	TEXT("r.Lumen.Reflections.HierarchicalScreenTraces.RelativeDepthThickness"),
	GLumenReflectionHierarchicalScreenTraceRelativeDepthThreshold,
	TEXT("Determines depth thickness of objects hit by HZB tracing, as a relative depth threshold."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

float GLumenReflectionHierarchicalScreenTraceHistoryDepthTestRelativeThickness = .01f;
FAutoConsoleVariableRef GVarLumenReflectionHierarchicalScreenTraceHistoryDepthTestRelativeThickness(

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

Scope (from outer to inner):

file
function     void TraceReflections

Source code excerpt:


		PassParameters->MaxHierarchicalScreenTraceIterations = GLumenReflectionHierarchicalScreenTracesMaxIterations;
		PassParameters->RelativeDepthThickness = GLumenReflectionHierarchicalScreenTraceRelativeDepthThreshold * View.ViewMatrices.GetPerProjectionDepthThicknessScale();
		PassParameters->HistoryDepthTestRelativeThickness = GLumenReflectionHierarchicalScreenTraceHistoryDepthTestRelativeThickness * View.ViewMatrices.GetPerProjectionDepthThicknessScale();
		PassParameters->MinimumTracingThreadOccupancy = GLumenReflectionScreenTracesMinimumOccupancy;

		PassParameters->ReflectionTracingParameters = ReflectionTracingParameters;
		PassParameters->ReflectionTileParameters = ReflectionTileParameters;
		PassParameters->IndirectTracingParameters = IndirectTracingParameters;