r.Lumen.Reflections.Temporal.MaxFramesAccumulated

r.Lumen.Reflections.Temporal.MaxFramesAccumulated

#Overview

name: r.Lumen.Reflections.Temporal.MaxFramesAccumulated

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.Temporal.MaxFramesAccumulated is to control the temporal accumulation of Lumen reflections in Unreal Engine 5’s rendering system. It specifically affects the temporal filtering of reflections, balancing between smooth transitions and responsiveness to lighting changes.

This setting variable is primarily used in the Lumen reflection system, which is part of Unreal Engine 5’s global illumination solution. It’s utilized within the Renderer module, specifically in the Lumen reflections component.

The value of this variable is set through the engine’s console variable system. It’s initialized with a default value of 32.0f and can be modified at runtime.

The variable interacts directly with its associated C++ variable GLumenReflectionTemporalMaxFramesAccumulated. They share the same value, with the console variable acting as an interface for runtime adjustments.

Developers should be aware that this variable affects the trade-off between lighting change responsiveness and visual stability. Lower values will make the system react faster to lighting changes but may introduce more flickering due to noise.

Best practices when using this variable include:

  1. Adjust it based on the specific needs of your scene. Fast-paced environments might benefit from lower values, while static scenes could use higher values for smoother results.
  2. Test different values to find the right balance between responsiveness and stability for your particular use case.
  3. Consider the performance implications, as lower values might require more frequent updates.

Regarding the associated variable GLumenReflectionTemporalMaxFramesAccumulated:

This is the actual C++ variable that stores the value set by the console variable. It’s used directly in the rendering code, specifically in the UpdateHistoryReflections function of the Lumen reflection system.

The purpose of GLumenReflectionTemporalMaxFramesAccumulated is to provide the maximum number of frames to accumulate in the temporal filtering process for Lumen reflections.

This variable is used in the Renderer module, specifically in the Lumen reflections component of Unreal Engine 5.

Its value is set by the console variable r.Lumen.Reflections.Temporal.MaxFramesAccumulated and is used directly in the shader parameters for reflection processing.

Developers should be aware that this variable directly affects the shader behavior for Lumen reflections. Changes to this value will impact how quickly the reflections respond to changes in the scene lighting.

Best practices for using this variable include:

  1. Understand that it’s controlled by the console variable and should generally not be modified directly in code.
  2. When optimizing reflection quality and performance, consider this variable in conjunction with other Lumen reflection settings.
  3. Monitor its impact on both visual quality and performance when adjusting the associated console variable.

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

Scope: file

Source code excerpt:

float GLumenReflectionTemporalMaxFramesAccumulated = 32.0f;
FAutoConsoleVariableRef CVarLumenReflectionTemporalMaxFramesAccumulated(
	TEXT("r.Lumen.Reflections.Temporal.MaxFramesAccumulated"),
	GLumenReflectionTemporalMaxFramesAccumulated,
	TEXT("Lower values cause the temporal filter to propagate lighting changes faster, but also increase flickering from noise."),
	ECVF_Scalability | ECVF_RenderThreadSafe);

TAutoConsoleVariable<int32> CVarLumenReflectionTemporalMaxRayDirections(
	TEXT("r.Lumen.Reflections.Temporal.MaxRayDirections"),

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	);

float GLumenReflectionTemporalMaxFramesAccumulated = 32.0f;
FAutoConsoleVariableRef CVarLumenReflectionTemporalMaxFramesAccumulated(
	TEXT("r.Lumen.Reflections.Temporal.MaxFramesAccumulated"),
	GLumenReflectionTemporalMaxFramesAccumulated,
	TEXT("Lower values cause the temporal filter to propagate lighting changes faster, but also increase flickering from noise."),
	ECVF_Scalability | ECVF_RenderThreadSafe);

TAutoConsoleVariable<int32> CVarLumenReflectionTemporalMaxRayDirections(
	TEXT("r.Lumen.Reflections.Temporal.MaxRayDirections"),
	16,

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

Scope (from outer to inner):

file
function     void UpdateHistoryReflections

Source code excerpt:

				(HistoryViewRect->Max.X - 0.5f) * InvBufferSize.X,
				(HistoryViewRect->Max.Y - 0.5f) * InvBufferSize.Y);
			PassParameters->MaxFramesAccumulated = GLumenReflectionTemporalMaxFramesAccumulated;
			PassParameters->NeighborhoodClampExpandWithResolveVariance = GLumenReflectionNeighborhoodClampExpandWithResolveVariance;

			PassParameters->VelocityTexture = VelocityTexture;
			PassParameters->VelocityTextureSampler = TStaticSamplerState<SF_Bilinear>::GetRHI();
			PassParameters->ResolvedReflections = ResolvedReflections;
			PassParameters->ResolvedReflectionsDepth = ResolvedReflectionsDepth;