r.Lumen.ReSTIRGather.SpatialResampling.KernelRadius
r.Lumen.ReSTIRGather.SpatialResampling.KernelRadius
#Overview
name: r.Lumen.ReSTIRGather.SpatialResampling.KernelRadius
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Radius of the spatial resampling kernel as a fraction of the screen.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.ReSTIRGather.SpatialResampling.KernelRadius is to control the radius of the spatial resampling kernel used in Lumen’s ReSTIR (Reservoir-based Spatiotemporal Importance Resampling) gathering process. This setting is part of Unreal Engine 5’s advanced rendering system, specifically the Lumen global illumination feature.
This setting variable is primarily used by the Lumen subsystem within 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 core rendering pipeline for Lumen.
The value of this variable is set through the engine’s console variable system. It’s initialized with a default value of 0.05f and can be modified at runtime using the console command system.
The associated variable GLumenReSTIRSpatialResamplingKernelRadius directly interacts with this setting. They share the same value, with GLumenReSTIRSpatialResamplingKernelRadius being the actual variable used in the rendering code.
Developers should be aware that this variable affects the quality and performance of Lumen’s global illumination. A larger kernel radius will result in smoother lighting but may introduce more blur and potentially impact performance. Conversely, a smaller radius will preserve more detail but may lead to noisier results.
Best practices when using this variable include:
- Adjusting it based on the specific needs of your scene and target hardware.
- Testing different values to find the optimal balance between quality and performance.
- Considering the interplay between this setting and other Lumen settings for best results.
Regarding the associated variable GLumenReSTIRSpatialResamplingKernelRadius:
The purpose of GLumenReSTIRSpatialResamplingKernelRadius is to store and provide the actual value used in the rendering calculations for the spatial resampling kernel radius.
This variable is used directly in the rendering code, specifically in the RenderLumenReSTIRGather function of the FDeferredShadingSceneRenderer class. It’s assigned to the SpatialResamplingKernelRadius parameter of the rendering pass.
The value of this variable is set by the r.Lumen.ReSTIRGather.SpatialResampling.KernelRadius console variable.
Other variables that interact with it include other Lumen ReSTIR gather parameters such as SpatialResamplingOcclusionScreenTraceDistance and NumSpatialSamples.
Developers should be aware that modifying the console variable r.Lumen.ReSTIRGather.SpatialResampling.KernelRadius will directly affect this variable and, consequently, the rendering output.
Best practices include monitoring the impact of changes to this variable on both visual quality and performance, and considering its interaction with other Lumen settings for optimal results.
#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:106
Scope: file
Source code excerpt:
float GLumenReSTIRSpatialResamplingKernelRadius = .05f;
FAutoConsoleVariableRef CVarLumenReSTIRSpatialResamplingKernelRadius(
TEXT("r.Lumen.ReSTIRGather.SpatialResampling.KernelRadius"),
GLumenReSTIRSpatialResamplingKernelRadius,
TEXT("Radius of the spatial resampling kernel as a fraction of the screen."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GLumenReSTIRResamplingAngleThreshold = 25.0f;
#Associated Variable and Callsites
This variable is associated with another variable named GLumenReSTIRSpatialResamplingKernelRadius
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReSTIRGather.cpp:104
Scope: file
Source code excerpt:
);
float GLumenReSTIRSpatialResamplingKernelRadius = .05f;
FAutoConsoleVariableRef CVarLumenReSTIRSpatialResamplingKernelRadius(
TEXT("r.Lumen.ReSTIRGather.SpatialResampling.KernelRadius"),
GLumenReSTIRSpatialResamplingKernelRadius,
TEXT("Radius of the spatial resampling kernel as a fraction of the screen."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GLumenReSTIRResamplingAngleThreshold = 25.0f;
FAutoConsoleVariableRef CVarLumenReSTIRResamplingAngleThreshold(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReSTIRGather.cpp:1183
Scope (from outer to inner):
file
function FSSDSignalTextures FDeferredShadingSceneRenderer::RenderLumenReSTIRGather
Source code excerpt:
PassParameters->Substrate = Substrate::BindSubstrateGlobalUniformParameters(View);
PassParameters->SceneTextures = GetSceneTextureParameters(GraphBuilder, SceneTextures.UniformBuffer);
PassParameters->SpatialResamplingKernelRadius = GLumenReSTIRSpatialResamplingKernelRadius;
PassParameters->SpatialResamplingOcclusionScreenTraceDistance = GLumenReSTIRSpatialResamplingOcclusionScreenTraceDistance;
PassParameters->NumSpatialSamples = GLumenReSTIRNumSpatialSamples;
PassParameters->SpatialResamplingPassIndex = SpatialResamplingPassIndex;
FSpatialResamplingCS::FPermutationDomain PermutationVector;
auto ComputeShader = View.ShaderMap->GetShader<FSpatialResamplingCS>(PermutationVector);