r.Lumen.ReSTIRGather.TemporalResampling.ResetHistory
r.Lumen.ReSTIRGather.TemporalResampling.ResetHistory
#Overview
name: r.Lumen.ReSTIRGather.TemporalResampling.ResetHistory
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.ReSTIRGather.TemporalResampling.ResetHistory is to control the resetting of history for temporal resampling in Lumen’s ReSTIR (Reservoir Spatio-Temporal Importance Resampling) gather process. This setting is part of Unreal Engine 5’s Lumen global illumination system.
This setting variable is primarily used in the Lumen rendering subsystem, specifically in the ReSTIR gather process. It’s referenced in the Renderer module, within the LumenReSTIRGather.cpp file.
The value of this variable is set through the Unreal Engine console variable system. It’s defined as an integer with an initial value of 0, and it can be modified at runtime.
The associated variable GLumenReSTIRTemporalResamplingResetHistory directly interacts with this console variable. They share the same value, with GLumenReSTIRTemporalResamplingResetHistory being the C++ variable that’s used in the actual code logic.
Developers must be aware that this variable affects the temporal stability of the Lumen ReSTIR gather process. When set to a non-zero value, it triggers a reset of the temporal resampling history, which can cause temporary visual instability but may be necessary in certain scenarios.
Best practices when using this variable include:
- Keeping it at 0 during normal rendering to maintain temporal stability.
- Setting it to a non-zero value only when you need to force a reset of the temporal history, such as after significant scene changes or when debugging temporal artifacts.
- Resetting it back to 0 after the desired reset has occurred to resume normal temporal resampling.
Regarding the associated variable GLumenReSTIRTemporalResamplingResetHistory:
The purpose of GLumenReSTIRTemporalResamplingResetHistory is to provide a C++ accessible version of the console variable for use in the rendering code.
This variable is used in the Lumen ReSTIR gather process within the Renderer module.
Its value is set by the console variable system and is checked in the RenderLumenReSTIRGather function to determine whether to reset the temporal resampling history.
It interacts directly with the console variable r.Lumen.ReSTIRGather.TemporalResampling.ResetHistory, reflecting its value in the C++ code.
Developers should be aware that modifying this variable directly in C++ code might lead to inconsistencies with the console variable system. It’s best to modify the console variable instead.
Best practices include using this variable for read-only checks in the rendering code and relying on the console variable system for modifications.
#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:74
Scope: file
Source code excerpt:
int32 GLumenReSTIRTemporalResamplingResetHistory = 0;
FAutoConsoleVariableRef CVarLumenReSTIRTemporalResamplingResetHistory(
TEXT("r.Lumen.ReSTIRGather.TemporalResampling.ResetHistory"),
GLumenReSTIRTemporalResamplingResetHistory,
TEXT(""),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GLumenReSTIRSpatialResampling = 1;
#Associated Variable and Callsites
This variable is associated with another variable named GLumenReSTIRTemporalResamplingResetHistory
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReSTIRGather.cpp:72
Scope: file
Source code excerpt:
);
int32 GLumenReSTIRTemporalResamplingResetHistory = 0;
FAutoConsoleVariableRef CVarLumenReSTIRTemporalResamplingResetHistory(
TEXT("r.Lumen.ReSTIRGather.TemporalResampling.ResetHistory"),
GLumenReSTIRTemporalResamplingResetHistory,
TEXT(""),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GLumenReSTIRSpatialResampling = 1;
FAutoConsoleVariableRef CVarLumenReSTIRSpatialResampling(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReSTIRGather.cpp:1079
Scope (from outer to inner):
file
function FSSDSignalTextures FDeferredShadingSceneRenderer::RenderLumenReSTIRGather
Source code excerpt:
&& !View.bPrevTransformsReset
&& ReSTIRParameters.ReservoirBufferSize == TemporalResamplingState.HistoryReservoirBufferSize
&& GLumenReSTIRTemporalResamplingResetHistory == 0)
{
FTemporalResamplingCS::FParameters* PassParameters = GraphBuilder.AllocParameters<FTemporalResamplingCS::FParameters>();
PassParameters->RWTemporalReservoirRayDirection = TemporalReservoirUAVs.RWReservoirRayDirection;
PassParameters->RWTemporalReservoirTraceRadiance = TemporalReservoirUAVs.RWReservoirTraceRadiance;
PassParameters->RWTemporalReservoirTraceHitDistance = TemporalReservoirUAVs.RWReservoirTraceHitDistance;
PassParameters->RWTemporalReservoirTraceHitNormal = TemporalReservoirUAVs.RWReservoirTraceHitNormal;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReSTIRGather.cpp:1150
Scope (from outer to inner):
file
function FSSDSignalTextures FDeferredShadingSceneRenderer::RenderLumenReSTIRGather
Source code excerpt:
FComputeShaderUtils::GetGroupCount(ReSTIRParameters.ReservoirViewSize, FTemporalResamplingCS::GetGroupSize()));
GLumenReSTIRTemporalResamplingResetHistory = 0;
}
if (!View.bStatePrevViewInfoIsReadOnly)
{
// Queue updating the view state's render target reference with the new history
TemporalResamplingState.HistoryViewRect = View.ViewRect;