r.Lumen.Reflections.BilateralFilter
r.Lumen.Reflections.BilateralFilter
#Overview
name: r.Lumen.Reflections.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 Reflections.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.Reflections.BilateralFilter is to control whether a bilateral filter is applied as a final step in denoising Lumen Reflections in Unreal Engine 5.
This setting variable is primarily used in the rendering system, specifically for the Lumen Reflections feature. It’s part of the Lumen global illumination system in Unreal Engine 5.
The Unreal Engine subsystem that relies on this variable is the Renderer, particularly the Lumen Reflections module. This can be seen from the file path “Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflections.cpp”.
The value of this variable is set through the FAutoConsoleVariableRef system, which allows it to be changed at runtime through console commands. It’s initialized with a default value of 1 (enabled).
This variable interacts with GLumenReflectionBilateralFilter, which is the associated C++ variable that directly controls the feature in the code.
Developers should be aware that:
- This setting affects the final quality of reflections in scenes using Lumen.
- Enabling this filter (default) may improve the visual quality of reflections but at a performance cost.
- It’s part of the scalability options, so it can be adjusted based on performance requirements.
Best practices when using this variable include:
- Consider disabling it on lower-end hardware for performance gains.
- Test scenes with and without the filter to determine the best balance of quality and performance.
- Use in conjunction with other Lumen reflection settings for optimal results.
Regarding the associated variable GLumenReflectionBilateralFilter:
- It’s the C++ implementation of the console variable.
- It’s used in the rendering code to determine whether to apply the bilateral filter.
- The bilateral filter is applied as a post-processing step to smooth and denoise the reflection results.
- When using this variable, developers should consider its interaction with other denoising steps in the reflection pipeline.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflections.cpp:198
Scope: file
Source code excerpt:
int32 GLumenReflectionBilateralFilter = 1;
FAutoConsoleVariableRef CVarLumenReflectionBilateralFilter(
TEXT("r.Lumen.Reflections.BilateralFilter"),
GLumenReflectionBilateralFilter,
TEXT("Whether to do a bilateral filter as a last step in denoising Lumen Reflections."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GLumenReflectionBilateralFilterSpatialKernelRadius = .002f;
#Associated Variable and Callsites
This variable is associated with another variable named GLumenReflectionBilateralFilter
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflections.cpp:196
Scope: file
Source code excerpt:
);
int32 GLumenReflectionBilateralFilter = 1;
FAutoConsoleVariableRef CVarLumenReflectionBilateralFilter(
TEXT("r.Lumen.Reflections.BilateralFilter"),
GLumenReflectionBilateralFilter,
TEXT("Whether to do a bilateral filter as a last step in denoising Lumen Reflections."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GLumenReflectionBilateralFilterSpatialKernelRadius = .002f;
FAutoConsoleVariableRef CVarLumenReflectionBilateralFilterSpatialKernelRadius(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflections.cpp:1236
Scope (from outer to inner):
file
function FRDGTextureRef FDeferredShadingSceneRenderer::RenderLumenReflections
Source code excerpt:
const int32 NumReconstructionSamples = FMath::Clamp(FMath::RoundToInt(View.FinalPostProcessSettings.LumenReflectionQuality * GLumenReflectionScreenSpaceReconstructionNumSamples), GLumenReflectionScreenSpaceReconstructionNumSamples, 64);
const bool bUseSpatialReconstruction = bDenoise && GLumenReflectionScreenSpaceReconstruction != 0;
const bool bUseBilaterialFilter = bDenoise && GLumenReflectionBilateralFilter != 0;
{
FReflectionResolveCS::FParameters* PassParameters = GraphBuilder.AllocParameters<FReflectionResolveCS::FParameters>();
PassParameters->RWSpecularIndirect = GraphBuilder.CreateUAV(FRDGTextureUAVDesc(ResolvedSpecularIndirect));
PassParameters->RWSpecularIndirectDepth = GraphBuilder.CreateUAV(FRDGTextureUAVDesc(ResolvedSpecularIndirectDepth));
PassParameters->RWResolveVariance = GraphBuilder.CreateUAV(FRDGTextureUAVDesc(ResolveVariance));