r.Lumen.ReSTIRGather.Temporal

r.Lumen.ReSTIRGather.Temporal

#Overview

name: r.Lumen.ReSTIRGather.Temporal

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.ReSTIRGather.Temporal is to control whether a temporal filter is used in the Lumen ReSTIR (Reservoir Spatio-Temporal Importance Resampling) gathering process. This setting is part of Unreal Engine 5’s Lumen global illumination system, specifically for the ReSTIR algorithm used in real-time ray tracing.

The Lumen ReSTIR Gather subsystem within the Renderer module relies on this setting variable. It is used in the LumenReSTIRGather.cpp file, which is part of the core rendering pipeline for Lumen.

The value of this variable is set through the Unreal Engine console variable system. It is initialized with a default value of 1 (enabled) and can be changed at runtime using console commands or through project settings.

This variable interacts directly with its associated C++ variable GLumenReSTIRGatherTemporalFilter. They share the same value, and the C++ variable is used in the actual rendering code to determine whether to apply the temporal filter.

Developers should be aware that enabling this feature (which is the default) can improve the quality and stability of global illumination over time, potentially reducing flickering and noise. However, it may also introduce some latency in responding to lighting changes.

Best practices when using this variable include:

  1. Keep it enabled (value 1) for most scenarios to benefit from temporal stability.
  2. Consider disabling it (value 0) if you need immediate response to lighting changes or if you’re experiencing ghosting artifacts.
  3. Test your scenes with both settings to find the best balance between visual quality and responsiveness for your specific use case.

Regarding the associated variable GLumenReSTIRGatherTemporalFilter:

The purpose of GLumenReSTIRGatherTemporalFilter is to provide a C++ accessible boolean flag that directly controls the temporal filter application in the Lumen ReSTIR gather process.

This variable is used within the Renderer module, specifically in the Lumen subsystem’s ReSTIR gather implementation.

Its value is set by the console variable system and is directly linked to the r.Lumen.ReSTIRGather.Temporal setting.

GLumenReSTIRGatherTemporalFilter interacts with the rendering pipeline code, determining whether to dispatch the temporal accumulation pass in the RenderLumenReSTIRGather function.

Developers should be aware that this variable directly affects the rendering pipeline’s behavior and can impact performance and visual quality.

Best practices for using this variable include:

  1. Avoid modifying it directly in C++ code; instead, use the console variable system to ensure consistency.
  2. When profiling or debugging Lumen’s ReSTIR gather process, check this variable’s state to understand whether temporal filtering is active.
  3. Consider exposing this setting in your game’s graphics options if you want to give users fine-grained control over the global illumination quality.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReSTIRGather.cpp:173

Scope: file

Source code excerpt:

int32 GLumenReSTIRGatherTemporalFilter = 1;
FAutoConsoleVariableRef CVarLumenReSTIRGatherTemporalFilter(
	TEXT("r.Lumen.ReSTIRGather.Temporal"),
	GLumenReSTIRGatherTemporalFilter,
	TEXT("Whether to use a temporal filter"),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

int32 GLumenReSTIRGatherClearHistoryEveryFrame = 0;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReSTIRGather.cpp:171

Scope: file

Source code excerpt:

);

int32 GLumenReSTIRGatherTemporalFilter = 1;
FAutoConsoleVariableRef CVarLumenReSTIRGatherTemporalFilter(
	TEXT("r.Lumen.ReSTIRGather.Temporal"),
	GLumenReSTIRGatherTemporalFilter,
	TEXT("Whether to use a temporal filter"),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

int32 GLumenReSTIRGatherClearHistoryEveryFrame = 0;
FAutoConsoleVariableRef CVarLumenReSTIRGatherClearHistoryEveryFrame(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReSTIRGather.cpp:1240

Scope (from outer to inner):

file
function     FSSDSignalTextures FDeferredShadingSceneRenderer::RenderLumenReSTIRGather

Source code excerpt:

	}

	if (GLumenReSTIRGatherTemporalFilter)
	{
		DispatchTemporalAccumulation(
			GraphBuilder,
			View,
			SceneTextures,
			LumenCardRenderer.bPropagateGlobalLightingChange,