r.Lumen.ReSTIRGather.BilateralFilter
r.Lumen.ReSTIRGather.BilateralFilter
#Overview
name: r.Lumen.ReSTIRGather.BilateralFilter
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to do a bilateral filter as a last step in denoising Lumen ReSTIRGathers.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.ReSTIRGather.BilateralFilter is to control whether a bilateral filter is applied as the final step in denoising Lumen ReSTIRGathers. This setting variable is part of Unreal Engine 5’s Lumen global illumination system, specifically for the ReSTIR (Resampled Importance Sampling for Real-Time Ray Tracing) gather process.
This setting variable is primarily used in the Lumen subsystem of Unreal Engine’s rendering module. It’s referenced in the LumenReSTIRGather.cpp file, which is part of the Renderer module.
The value of this variable is set using an FAutoConsoleVariableRef, which means it can be changed at runtime through the console or configuration files. Its default value is 1, indicating that the bilateral filter is enabled by default.
The associated variable GLumenReSTIRGatherBilateralFilter directly interacts with r.Lumen.ReSTIRGather.BilateralFilter. They share the same value, with GLumenReSTIRGatherBilateralFilter being the actual integer variable used in the code.
Developers should be aware that this variable affects the final quality of the Lumen global illumination. Enabling the bilateral filter (value 1) can help reduce noise in the final render, but it may also introduce some blurring. Disabling it (value 0) might preserve more detail but could result in noisier output.
Best practices when using this variable include:
- Testing different settings to find the optimal balance between noise reduction and detail preservation for your specific scene.
- Considering performance implications, as applying the bilateral filter adds some computational cost.
- Using it in conjunction with other Lumen settings to achieve the desired visual quality and performance.
Regarding the associated variable GLumenReSTIRGatherBilateralFilter:
The purpose of GLumenReSTIRGatherBilateralFilter is to store the actual value of the bilateral filter setting within the C++ code. It’s an integer variable that directly controls whether the bilateral filter is applied in the Lumen ReSTIRGather process.
This variable is used in the Lumen subsystem of the rendering module, specifically in the ReSTIRGather functionality.
Its value is set by the console variable r.Lumen.ReSTIRGather.BilateralFilter, allowing for runtime configuration.
It interacts directly with the console variable r.Lumen.ReSTIRGather.BilateralFilter, and is used in conditional statements to determine whether to apply the bilateral filter.
Developers should be aware that this variable is the actual control point for the bilateral filter in the code. Changes to the console variable will be reflected in this variable.
Best practices include:
- Not modifying this variable directly in code, but rather using the console variable for configuration.
- Using this variable in conditional statements when implementing Lumen ReSTIRGather related functionality.
- Considering the performance and visual impact when deciding whether to apply the bilateral filter based on this variable’s 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:205
Scope: file
Source code excerpt:
int32 GLumenReSTIRGatherBilateralFilter = 1;
FAutoConsoleVariableRef CVarLumenReSTIRGatherBilateralFilter(
TEXT("r.Lumen.ReSTIRGather.BilateralFilter"),
GLumenReSTIRGatherBilateralFilter,
TEXT("Whether to do a bilateral filter as a last step in denoising Lumen ReSTIRGathers."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GLumenReSTIRGatherBilateralFilterSpatialKernelRadius = .002f;
#Associated Variable and Callsites
This variable is associated with another variable named GLumenReSTIRGatherBilateralFilter
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReSTIRGather.cpp:203
Scope: file
Source code excerpt:
);
int32 GLumenReSTIRGatherBilateralFilter = 1;
FAutoConsoleVariableRef CVarLumenReSTIRGatherBilateralFilter(
TEXT("r.Lumen.ReSTIRGather.BilateralFilter"),
GLumenReSTIRGatherBilateralFilter,
TEXT("Whether to do a bilateral filter as a last step in denoising Lumen ReSTIRGathers."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GLumenReSTIRGatherBilateralFilterSpatialKernelRadius = .002f;
FAutoConsoleVariableRef CVarLumenReSTIRGatherBilateralFilterSpatialKernelRadius(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReSTIRGather.cpp:1211
Scope (from outer to inner):
file
function FSSDSignalTextures FDeferredShadingSceneRenderer::RenderLumenReSTIRGather
Source code excerpt:
FRDGTextureRef ResolveVariance = GraphBuilder.CreateTexture(ResolveVarianceDesc, TEXT("Lumen.ReSTIRGather.ResolveVariance"));
const bool bBilateralFilter = GLumenReSTIRGatherBilateralFilter != 0;
{
FUpsampleAndIntegrateCS::FParameters* PassParameters = GraphBuilder.AllocParameters<FUpsampleAndIntegrateCS::FParameters>();
PassParameters->RWDiffuseIndirect = GraphBuilder.CreateUAV(FRDGTextureUAVDesc(DiffuseIndirect));
PassParameters->RWRoughSpecularIndirect = GraphBuilder.CreateUAV(FRDGTextureUAVDesc(RoughSpecularIndirect));
PassParameters->RWResolveVariance = GraphBuilder.CreateUAV(FRDGTextureUAVDesc(ResolveVariance));