r.Lumen.Reflections.ScreenTraces

r.Lumen.Reflections.ScreenTraces

#Overview

name: r.Lumen.Reflections.ScreenTraces

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.ScreenTraces is to control whether screen-space tracing is used for reflections in Lumen, Unreal Engine 5’s global illumination and reflection system. This setting determines if the engine should trace against the screen for reflections before falling back to other methods.

This setting variable is primarily used in the Lumen reflection system, which is part of Unreal Engine’s rendering subsystem. Based on the callsites, it’s specifically utilized in the LumenReflectionTracing module.

The value of this variable is set through the console variable system, as indicated by the FAutoConsoleVariableRef. This allows it to be modified at runtime or through configuration files.

The associated variable GLumenReflectionScreenTraces interacts directly with r.Lumen.Reflections.ScreenTraces. They share the same value, with GLumenReflectionScreenTraces being the internal C++ variable used in the code.

Developers should be aware that:

  1. This variable affects rendering performance and quality.
  2. It’s marked with ECVF_Scalability, indicating it’s part of the scalability settings.
  3. It’s also marked as ECVF_RenderThreadSafe, meaning it can be safely changed from any thread.

Best practices when using this variable include:

  1. Consider the performance impact of enabling screen traces for reflections.
  2. Use it in conjunction with other Lumen settings for optimal results.
  3. Test different values to find the best balance between performance and visual quality for your specific use case.

Regarding the associated variable GLumenReflectionScreenTraces: The purpose of GLumenReflectionScreenTraces is to serve as the internal C++ representation of the r.Lumen.Reflections.ScreenTraces setting. It’s used directly in the rendering code to determine whether to perform screen-space tracing for reflections.

This variable is used in the Lumen reflection tracing system, specifically in the TraceReflections function of the LumenReflectionTracing module.

Its value is set by the console variable system and is used to control the flow of the reflection tracing process.

Developers should be aware that this variable directly affects the behavior of the reflection tracing system and should be used cautiously when modifying it directly in C++ code.

Best practices include using the console variable r.Lumen.Reflections.ScreenTraces to modify this setting rather than changing GLumenReflectionScreenTraces directly, as the console variable system provides better control and safety mechanisms.

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

Scope: file

Source code excerpt:

int32 GLumenReflectionScreenTraces = 1;
FAutoConsoleVariableRef CVarLumenReflectionScreenTraces(
	TEXT("r.Lumen.Reflections.ScreenTraces"),
	GLumenReflectionScreenTraces,
	TEXT("Whether to trace against the screen for reflections before falling back to other methods."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

int32 GLumenReflectionHierarchicalScreenTracesMaxIterations = 50;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

#include "ShaderPrintParameters.h"

int32 GLumenReflectionScreenTraces = 1;
FAutoConsoleVariableRef CVarLumenReflectionScreenTraces(
	TEXT("r.Lumen.Reflections.ScreenTraces"),
	GLumenReflectionScreenTraces,
	TEXT("Whether to trace against the screen for reflections before falling back to other methods."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

int32 GLumenReflectionHierarchicalScreenTracesMaxIterations = 50;
FAutoConsoleVariableRef CVarLumenReflectionHierarchicalScreenTracesMaxIterations(

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

Scope (from outer to inner):

file
function     void TraceReflections

Source code excerpt:

	const FSceneTextureParameters& SceneTextureParameters = GetSceneTextureParameters(GraphBuilder, SceneTextures);

	const bool bScreenTraces = GLumenReflectionScreenTraces != 0 && View.Family->EngineShowFlags.LumenScreenTraces && View.FinalPostProcessSettings.LumenReflectionsScreenTraces;
	const bool bSampleSceneColorAtHit = (GLumenReflectionsSampleSceneColorAtHit != 0 && bScreenTraces) || GLumenReflectionsSampleSceneColorAtHit == 2;
	const bool bDistantScreenTraces = GLumenReflectionsDistantScreenTraces && bScreenTraces;

	if (bScreenTraces)
	{
		FReflectionTraceScreenTexturesCS::FParameters* PassParameters = GraphBuilder.AllocParameters<FReflectionTraceScreenTexturesCS::FParameters>();