r.Lumen.ReSTIRGather.FixedJitterIndex

r.Lumen.ReSTIRGather.FixedJitterIndex

#Overview

name: r.Lumen.ReSTIRGather.FixedJitterIndex

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.ReSTIRGather.FixedJitterIndex is to provide a debugging tool for the Lumen ReSTIR (Resampled Importance Sampling for Real-Time) gather process in Unreal Engine 5’s rendering system. It allows developers to override the frame index with a constant value for debugging purposes.

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

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

The associated variable GLumenReSTIRGatherFixedJitterIndex directly interacts with r.Lumen.ReSTIRGather.FixedJitterIndex. They share the same value, with GLumenReSTIRGatherFixedJitterIndex being the C++ variable that stores the console variable’s value.

Developers must be aware that this variable is intended for debugging purposes only. When set to 0 or a higher value, it overrides the normal frame index calculation in the ReSTIR gather process. This can affect the temporal coherence and quality of the global illumination results.

Best practices when using this variable include:

  1. Use it only for debugging specific issues related to the ReSTIR gather process.
  2. Remember to reset it to -1 (default value) after debugging to restore normal functionality.
  3. Be cautious when using it in production builds, as it may impact performance and visual quality.

Regarding the associated variable GLumenReSTIRGatherFixedJitterIndex:

The purpose of GLumenReSTIRGatherFixedJitterIndex is to store the value of the r.Lumen.ReSTIRGather.FixedJitterIndex console variable in C++ code.

It is used in the Lumen ReSTIR gather process, specifically in the temporal accumulation dispatch and the main ReSTIR gather rendering function.

The value of this variable is set by the console variable system when r.Lumen.ReSTIRGather.FixedJitterIndex is modified.

This variable directly interacts with the r.Lumen.ReSTIRGather.FixedJitterIndex console variable and is used in the rendering code to control the jitter index.

Developers should be aware that modifying this variable directly in C++ code is not recommended. Instead, they should use the console variable r.Lumen.ReSTIRGather.FixedJitterIndex to control its value.

Best practices for using this variable include accessing it only for reading within the rendering code and relying on the console variable system for value changes.

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

Scope: file

Source code excerpt:

int32 GLumenReSTIRGatherFixedJitterIndex = -1;
FAutoConsoleVariableRef CVarLumenReSTIRGatherFixedJitterIndex(
	TEXT("r.Lumen.ReSTIRGather.FixedJitterIndex"),
	GLumenReSTIRGatherFixedJitterIndex,
	TEXT("When 0 or larger, overrides the frame index with a constant for debugging"),
	ECVF_RenderThreadSafe
);

int32 GLumenReSTIRTemporalResampling = 1;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

int32 GLumenReSTIRGatherFixedJitterIndex = -1;
FAutoConsoleVariableRef CVarLumenReSTIRGatherFixedJitterIndex(
	TEXT("r.Lumen.ReSTIRGather.FixedJitterIndex"),
	GLumenReSTIRGatherFixedJitterIndex,
	TEXT("When 0 or larger, overrides the frame index with a constant for debugging"),
	ECVF_RenderThreadSafe
);

int32 GLumenReSTIRTemporalResampling = 1;
FAutoConsoleVariableRef CVarLumenReSTIRTemporalResampling(

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

Scope (from outer to inner):

file
function     void DispatchTemporalAccumulation
lambda-function

Source code excerpt:

							(DiffuseIndirectHistoryViewRect->Max.Y - 1.0f) * InvBufferSize.Y);

						PassParameters->FixedJitterIndex = GLumenReSTIRGatherFixedJitterIndex;

						PassParameters->DiffuseIndirect = DiffuseIndirect;
						PassParameters->RoughSpecularIndirect = RoughSpecularIndirect;
						PassParameters->ResolveVariance = ResolveVariance;

						{

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

Scope (from outer to inner):

file
function     FSSDSignalTextures FDeferredShadingSceneRenderer::RenderLumenReSTIRGather

Source code excerpt:

	ReSTIRParameters.ReservoirViewSize = ViewSize;
	ReSTIRParameters.ReservoirBufferSize = ReservoirBufferSize;
	ReSTIRParameters.FixedJitterIndex = GLumenReSTIRGatherFixedJitterIndex;
	ReSTIRParameters.ResamplingNormalDotThreshold = FMath::Cos(GLumenReSTIRResamplingAngleThreshold * PI / 180.0f);
	ReSTIRParameters.ResamplingDepthErrorThreshold = GLumenReSTIRResamplingDepthErrorThreshold;

	ReSTIRParameters.Textures = AllocateReservoirTextures(GraphBuilder, ReservoirBufferSize);
	ReSTIRParameters.UAVs = CreateReservoirUAVs(GraphBuilder, ReSTIRParameters.Textures);