r.Lumen.Reflections.Temporal

r.Lumen.Reflections.Temporal

#Overview

name: r.Lumen.Reflections.Temporal

This variable is created as a Console Variable (cvar).

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Lumen.Reflections.Temporal is to control whether a temporal filter is used in Lumen’s reflection system within Unreal Engine 5. This setting is part of the Lumen global illumination and reflection system, which is a core component of UE5’s rendering pipeline.

This setting variable is primarily used in the Lumen Reflections subsystem of Unreal Engine 5’s rendering module. It’s referenced in the LumenReflections.cpp file, which is part of the Renderer module.

The value of this variable is set through the engine’s console variable system. It’s defined as an FAutoConsoleVariableRef, which allows it to be changed at runtime through console commands or configuration files. The default value is 1, indicating that temporal filtering is enabled by default.

The r.Lumen.Reflections.Temporal variable interacts directly with the GLumenReflectionTemporalFilter variable. They share the same value, with GLumenReflectionTemporalFilter being the actual int32 variable used in the code, while r.Lumen.Reflections.Temporal is the console variable name used to control it.

Developers should be aware that this variable affects the quality and performance of Lumen reflections. When enabled (set to 1), it applies temporal filtering to the reflections, which can improve quality by reducing noise over time, but may also introduce some latency in reflection updates.

Best practices when using this variable include:

  1. Consider disabling it (set to 0) if you need immediate reflection updates without any temporal smoothing.
  2. Keep it enabled (set to 1) for most scenarios to benefit from noise reduction in reflections.
  3. Be aware that changing this setting may require adjusting other Lumen reflection settings for optimal results.

Regarding the associated variable GLumenReflectionTemporalFilter:

The purpose of GLumenReflectionTemporalFilter is to serve as the actual int32 variable that controls whether temporal filtering is applied to Lumen reflections in the engine’s C++ code.

This variable is used directly in the Lumen Reflections subsystem of the Unreal Engine 5 rendering module. It’s checked in various parts of the reflection rendering process to determine whether to apply temporal filtering.

The value of GLumenReflectionTemporalFilter is set by the r.Lumen.Reflections.Temporal console variable. They are directly linked, sharing the same value.

GLumenReflectionTemporalFilter interacts with other parts of the Lumen reflection system. For example, it’s used in conjunction with other conditions to determine whether to update history reflections and whether to use jittering in reflection tracing.

Developers should be aware that this variable directly affects the behavior of the Lumen reflection system. When it’s set to 1 (true), temporal filtering is applied, which can improve reflection quality over time but may introduce some lag in reflection updates.

Best practices for using GLumenReflectionTemporalFilter include:

  1. Generally, leave it enabled (1) for better quality reflections in most scenarios.
  2. Consider disabling it (0) in situations where immediate reflection updates are crucial.
  3. When modifying this variable, also consider adjusting related 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/LumenReflections.cpp:105

Scope: file

Source code excerpt:

int32 GLumenReflectionTemporalFilter = 1;
FAutoConsoleVariableRef CVarLumenReflectionTemporalFilter(
	TEXT("r.Lumen.Reflections.Temporal"),
	GLumenReflectionTemporalFilter,
	TEXT("Whether to use a temporal filter"),
	ECVF_Scalability | ECVF_RenderThreadSafe
	);

float GLumenReflectionTemporalMaxFramesAccumulated = 32.0f;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflections.cpp:103

Scope: file

Source code excerpt:

);

int32 GLumenReflectionTemporalFilter = 1;
FAutoConsoleVariableRef CVarLumenReflectionTemporalFilter(
	TEXT("r.Lumen.Reflections.Temporal"),
	GLumenReflectionTemporalFilter,
	TEXT("Whether to use a temporal filter"),
	ECVF_Scalability | ECVF_RenderThreadSafe
	);

float GLumenReflectionTemporalMaxFramesAccumulated = 32.0f;
FAutoConsoleVariableRef CVarLumenReflectionTemporalMaxFramesAccumulated(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflections.cpp:889

Scope (from outer to inner):

file
function     void UpdateHistoryReflections

Source code excerpt:

	}

	if (GLumenReflectionTemporalFilter
		&& ReflectionState
		&& ReflectionState->SpecularIndirectHistoryRT
		&& (!bUseBilaterialFilter || ReflectionState->ResolveVarianceHistoryRT)
		&& !View.bCameraCut 
		&& !View.bPrevTransformsReset
		// If the scene render targets reallocate, toss the history so we don't read uninitialized data

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflections.cpp:1095

Scope (from outer to inner):

file
function     FRDGTextureRef FDeferredShadingSceneRenderer::RenderLumenReflections

Source code excerpt:

	ReflectionTracingParameters.ReflectionSmoothBias = GLumenReflectionSmoothBias;
	ReflectionTracingParameters.ReflectionPass = (uint32)ReflectionPass;
	ReflectionTracingParameters.UseJitter = bDenoise && GLumenReflectionTemporalFilter ? 1 : 0;
	ReflectionTracingParameters.UseHighResSurface = CVarLumenReflectionsHiResSurface.GetValueOnRenderThread() != 0 ? 1 : 0;
	ReflectionTracingParameters.MaxReflectionBounces = LumenReflections::GetMaxReflectionBounces(View);
	ReflectionTracingParameters.MaxRefractionBounces = LumenReflections::GetMaxRefractionBounces(View);
	ReflectionTracingParameters.NearFieldMaxTraceDistance = NearFieldMaxTraceDistance;
	ReflectionTracingParameters.FarFieldMaxTraceDistance = bUseFarField ? Lumen::GetFarFieldMaxTraceDistance() : NearFieldMaxTraceDistance;
	ReflectionTracingParameters.NearFieldMaxTraceDistanceDitherScale = Lumen::GetNearFieldMaxTraceDistanceDitherScale(bUseFarField);