r.Lumen.ReSTIRGather.TemporalResampling
r.Lumen.ReSTIRGather.TemporalResampling
#Overview
name: r.Lumen.ReSTIRGather.TemporalResampling
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to do a temporal resampling pass on the reservoirs
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.ReSTIRGather.TemporalResampling is to control whether temporal resampling is applied to reservoirs in the Lumen ReSTIR (Resampled Importance Sampling for Real-Time Indirect Illumination) gather process. This setting is part of Unreal Engine 5’s Lumen global illumination system, specifically the ReSTIR implementation for efficient light sampling.
This setting variable is primarily used in the Lumen subsystem of Unreal Engine’s rendering module. Based on the callsites, it’s clear that this variable is utilized in the LumenReSTIRGather.cpp file, which is part of the Renderer module.
The value of this variable is set through the console variable system in Unreal Engine. It’s initialized with a default value of 1 (enabled) and can be changed at runtime using console commands or through project settings.
The associated variable GLumenReSTIRTemporalResampling directly interacts with this setting. They share the same value, with GLumenReSTIRTemporalResampling being the actual integer variable used in the code logic.
Developers should be aware that:
- This setting affects the quality and performance of global illumination in scenes using Lumen.
- Enabling temporal resampling (default) can improve the stability and quality of lighting over time, but may have a performance cost.
- This setting is marked with ECVF_Scalability, indicating it can be adjusted for different scalability presets.
Best practices when using this variable include:
- Leaving it enabled (default) for most scenarios to benefit from temporal stability in lighting.
- Consider disabling it in performance-critical situations where the temporal stability is less important.
- Test the visual impact and performance with this setting enabled and disabled to find the best balance for your specific project.
Regarding the associated variable GLumenReSTIRTemporalResampling:
- Its purpose is to store the actual integer value used in the code logic for enabling or disabling temporal resampling.
- It’s used directly in the rendering code to determine whether to apply temporal resampling (when not equal to 0).
- The value is set by the console variable system, mirroring the r.Lumen.ReSTIRGather.TemporalResampling setting.
- It’s used in conjunction with the View.ViewState check to determine if temporal resampling should be applied.
- Developers should be aware that modifying this variable directly in code is not recommended; instead, they should use the console variable or project settings to change its value.
#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:50
Scope: file
Source code excerpt:
int32 GLumenReSTIRTemporalResampling = 1;
FAutoConsoleVariableRef CVarLumenReSTIRTemporalResampling(
TEXT("r.Lumen.ReSTIRGather.TemporalResampling"),
GLumenReSTIRTemporalResampling,
TEXT("Whether to do a temporal resampling pass on the reservoirs"),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GLumenReSTIRValidateTemporalReservoirsEveryNFrames = 0;
#Associated Variable and Callsites
This variable is associated with another variable named GLumenReSTIRTemporalResampling
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReSTIRGather.cpp:48
Scope: file
Source code excerpt:
);
int32 GLumenReSTIRTemporalResampling = 1;
FAutoConsoleVariableRef CVarLumenReSTIRTemporalResampling(
TEXT("r.Lumen.ReSTIRGather.TemporalResampling"),
GLumenReSTIRTemporalResampling,
TEXT("Whether to do a temporal resampling pass on the reservoirs"),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GLumenReSTIRValidateTemporalReservoirsEveryNFrames = 0;
FAutoConsoleVariableRef CVarLumenReSTIRTemporalResamplingValidate(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReSTIRGather.cpp:1066
Scope (from outer to inner):
file
function FSSDSignalTextures FDeferredShadingSceneRenderer::RenderLumenReSTIRGather
Source code excerpt:
}
const bool bUseTemporalResampling = GLumenReSTIRTemporalResampling != 0 && View.ViewState;
if (bUseTemporalResampling)
{
FReSTIRTemporalResamplingState& TemporalResamplingState = View.ViewState->Lumen.ReSTIRGatherState.TemporalResamplingState;
FReservoirTextures TemporalReservoirTextures = AllocateReservoirTextures(GraphBuilder, ReservoirBufferSize);