r.Lumen.Reflections.BilateralFilter.SpatialKernelRadius

r.Lumen.Reflections.BilateralFilter.SpatialKernelRadius

#Overview

name: r.Lumen.Reflections.BilateralFilter.SpatialKernelRadius

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Lumen.Reflections.BilateralFilter.SpatialKernelRadius is to control the spatial kernel radius of the bilateral filter used in Lumen reflections. This setting is part of the Lumen reflections system, which is a component of Unreal Engine 5’s global illumination solution.

The Lumen reflections system relies on this setting variable, as it’s used in the reflection rendering pipeline, specifically in the bilateral filtering step. This variable is part of the Renderer module of Unreal Engine.

The value of this variable is set through the console variable system, as indicated by the FAutoConsoleVariableRef. It can be modified at runtime, allowing for dynamic adjustments to the reflection quality.

This variable interacts with GLumenReflectionBilateralFilterSpatialKernelRadius, which is the C++ variable that directly stores the value. They share the same value, with the console variable providing an interface for runtime modification.

Developers should be aware that this variable affects the quality and performance of Lumen reflections. A larger kernel radius will result in smoother reflections but at the cost of increased computational overhead.

Best practices when using this variable include:

  1. Adjusting it based on the specific needs of your scene and target hardware.
  2. Balancing it with other Lumen reflection settings for optimal quality and performance.
  3. Testing different values to find the sweet spot between visual quality and performance for your specific use case.

Regarding GLumenReflectionBilateralFilterSpatialKernelRadius: This is the C++ variable that stores the actual value used by the rendering system. It’s initialized with a default value of 0.002, which represents the spatial kernel radius as a fraction of the viewport size. This variable is directly used in the reflection rendering pipeline, specifically in the bilateral filtering pass of Lumen reflections. Developers should be aware that modifying this variable directly in code will affect the initial value, but it can still be overridden at runtime through the console variable system.

#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:206

Scope: file

Source code excerpt:

float GLumenReflectionBilateralFilterSpatialKernelRadius = .002f;
FAutoConsoleVariableRef CVarLumenReflectionBilateralFilterSpatialKernelRadius(
	TEXT("r.Lumen.Reflections.BilateralFilter.SpatialKernelRadius"),
	GLumenReflectionBilateralFilterSpatialKernelRadius,
	TEXT("Spatial kernel radius, as a fraction of the viewport size"),
	ECVF_Scalability | ECVF_RenderThreadSafe
	);

int32 GLumenReflectionBilateralFilterNumSamples = 4;

#Associated Variable and Callsites

This variable is associated with another variable named GLumenReflectionBilateralFilterSpatialKernelRadius. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflections.cpp:204

Scope: file

Source code excerpt:

	);

float GLumenReflectionBilateralFilterSpatialKernelRadius = .002f;
FAutoConsoleVariableRef CVarLumenReflectionBilateralFilterSpatialKernelRadius(
	TEXT("r.Lumen.Reflections.BilateralFilter.SpatialKernelRadius"),
	GLumenReflectionBilateralFilterSpatialKernelRadius,
	TEXT("Spatial kernel radius, as a fraction of the viewport size"),
	ECVF_Scalability | ECVF_RenderThreadSafe
	);

int32 GLumenReflectionBilateralFilterNumSamples = 4;
FAutoConsoleVariableRef CVarLumenReflectionBilateralFilterNumSamples(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflections.cpp:1314

Scope (from outer to inner):

file
function     FRDGTextureRef FDeferredShadingSceneRenderer::RenderLumenReflections

Source code excerpt:

			PassParameters->SpecularIndirect = SpecularIndirect;
			PassParameters->ResolveVariance = AccumulatedResolveVariance;
			PassParameters->BilateralFilterSpatialKernelRadius = GLumenReflectionBilateralFilterSpatialKernelRadius;
			PassParameters->BilateralFilterNumSamples = GLumenReflectionBilateralFilterNumSamples;
			PassParameters->BilateralFilterDepthWeightScale = GLumenReflectionBilateralFilterDepthWeightScale;
			PassParameters->BilateralFilterNormalAngleThresholdScale = GLumenReflectionBilateralFilterNormalAngleThresholdScale;
			PassParameters->BilateralFilterStrongBlurVarianceThreshold = GLumenReflectionBilateralFilterStrongBlurVarianceThreshold;
			PassParameters->View = View.ViewUniformBuffer;
			PassParameters->SceneTexturesStruct = SceneTextures.UniformBuffer;