r.Lumen.ReSTIRGather.SpatialResampling
r.Lumen.ReSTIRGather.SpatialResampling
#Overview
name: r.Lumen.ReSTIRGather.SpatialResampling
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to use spatial resampling passes on the reservoirs
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.ReSTIRGather.SpatialResampling is to control whether spatial resampling passes are used on the reservoirs in the Lumen ReSTIR (Reservoir Spatiotemporal Importance Resampling) gathering process.
This setting variable is primarily used in the Lumen subsystem of Unreal Engine’s rendering system. Specifically, it’s part of the ReSTIR gathering process, which is a technique used for efficient global illumination.
The value of this variable is set through the Unreal Engine console variable system. It’s defined as an FAutoConsoleVariableRef, which means it can be modified at runtime through console commands or configuration files.
The associated variable GLumenReSTIRSpatialResampling interacts directly with r.Lumen.ReSTIRGather.SpatialResampling. They share the same value, with GLumenReSTIRSpatialResampling being the actual integer variable used in the code.
Developers should be aware that this variable is a boolean-like integer (0 or 1) that determines whether spatial resampling passes are applied. When enabled (set to 1), it allows for the use of GLumenReSTIRNumSpatialResamplingPasses to determine the number of spatial resampling passes.
Best practices when using this variable include:
- Consider the performance impact of enabling spatial resampling, as it may affect rendering times.
- Use in conjunction with GLumenReSTIRNumSpatialResamplingPasses to fine-tune the resampling process.
- Be aware that this setting is marked with ECVF_Scalability, indicating it can be adjusted for different quality settings.
Regarding the associated variable GLumenReSTIRSpatialResampling:
The purpose of GLumenReSTIRSpatialResampling is to serve as the actual integer variable that stores the value of r.Lumen.ReSTIRGather.SpatialResampling.
This variable is used directly in the Lumen ReSTIR gathering process within the rendering system.
Its value is set through the console variable system, mirroring r.Lumen.ReSTIRGather.SpatialResampling.
GLumenReSTIRSpatialResampling interacts with GLumenReSTIRNumSpatialResamplingPasses to determine the number of spatial resampling passes when enabled.
Developers should be aware that this variable is used in conditional statements to enable or disable the spatial resampling process.
Best practices include:
- Treat this variable as a boolean, using 0 for disabled and 1 for enabled.
- When modifying this variable, use the console command for r.Lumen.ReSTIRGather.SpatialResampling rather than directly manipulating GLumenReSTIRSpatialResampling.
- Consider the impact on performance and image quality when enabling or disabling this feature.
#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:82
Scope: file
Source code excerpt:
int32 GLumenReSTIRSpatialResampling = 1;
FAutoConsoleVariableRef CVarLumenReSTIRSpatialResampling(
TEXT("r.Lumen.ReSTIRGather.SpatialResampling"),
GLumenReSTIRSpatialResampling,
TEXT("Whether to use spatial resampling passes on the reservoirs"),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GLumenReSTIRNumSpatialResamplingPasses = 2;
#Associated Variable and Callsites
This variable is associated with another variable named GLumenReSTIRSpatialResampling
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReSTIRGather.cpp:80
Scope: file
Source code excerpt:
);
int32 GLumenReSTIRSpatialResampling = 1;
FAutoConsoleVariableRef CVarLumenReSTIRSpatialResampling(
TEXT("r.Lumen.ReSTIRGather.SpatialResampling"),
GLumenReSTIRSpatialResampling,
TEXT("Whether to use spatial resampling passes on the reservoirs"),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GLumenReSTIRNumSpatialResamplingPasses = 2;
FAutoConsoleVariableRef CVarLumenNumSpatialResamplingPasses(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReSTIRGather.cpp:1170
Scope (from outer to inner):
file
function FSSDSignalTextures FDeferredShadingSceneRenderer::RenderLumenReSTIRGather
Source code excerpt:
}
const int32 NumSpatialResamplingPasses = FMath::Clamp<int32>(GLumenReSTIRSpatialResampling > 0 ? GLumenReSTIRNumSpatialResamplingPasses : 0, 0, 16);
for (int32 SpatialResamplingPassIndex = 0; SpatialResamplingPassIndex < NumSpatialResamplingPasses; SpatialResamplingPassIndex++)
{
FReservoirTextures SpatialReservoirTextures = AllocateReservoirTextures(GraphBuilder, ReservoirBufferSize);
ReSTIRParameters.UAVs = CreateReservoirUAVs(GraphBuilder, SpatialReservoirTextures);