r.Lumen.Reflections.BilateralFilter.NumSamples

r.Lumen.Reflections.BilateralFilter.NumSamples

#Overview

name: r.Lumen.Reflections.BilateralFilter.NumSamples

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.NumSamples is to control the number of samples used in the bilateral filter for Lumen reflections in Unreal Engine 5’s rendering system.

This setting variable is primarily used in the Lumen reflections subsystem, which is part of Unreal Engine 5’s global illumination solution. It specifically affects the bilateral filtering process applied to reflections.

The value of this variable is set through the Unreal Engine console variable system. It’s defined as an FAutoConsoleVariableRef, which allows it to be modified at runtime through console commands or config files.

The associated C++ variable GLumenReflectionBilateralFilterNumSamples directly interacts with this console variable. They share the same value, with GLumenReflectionBilateralFilterNumSamples being used in the actual rendering code.

Developers should be aware that this variable affects the quality and performance of Lumen reflections. A higher number of samples will generally result in higher quality reflections but at the cost of increased performance overhead.

Best practices when using this variable include:

  1. Balancing quality and performance based on target hardware.
  2. Considering the overall visual impact in relation to other Lumen settings.
  3. Testing different values to find the optimal balance for your specific use case.

Regarding the associated variable GLumenReflectionBilateralFilterNumSamples:

The purpose of GLumenReflectionBilateralFilterNumSamples is to store and provide the actual value used in the rendering code for the number of bilateral filter samples.

This variable is used directly in the Lumen reflections rendering pass, specifically in the FDeferredShadingSceneRenderer::RenderLumenReflections function.

The value of this variable is set by the console variable system, mirroring the value of r.Lumen.Reflections.BilateralFilter.NumSamples.

It interacts closely with other Lumen reflection settings, such as BilateralFilterSpatialKernelRadius and BilateralFilterDepthWeightScale.

Developers should be aware that modifying this variable directly in code would be overridden by the console variable system unless the console variable is also updated.

Best practices include using the console variable for runtime adjustments and only modifying the C++ variable if you need to change the default value or behavior of the setting.

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

Scope: file

Source code excerpt:

int32 GLumenReflectionBilateralFilterNumSamples = 4;
FAutoConsoleVariableRef CVarLumenReflectionBilateralFilterNumSamples(
	TEXT("r.Lumen.Reflections.BilateralFilter.NumSamples"),
	GLumenReflectionBilateralFilterNumSamples,
	TEXT("Number of bilateral filter samples."),
	ECVF_Scalability | ECVF_RenderThreadSafe
	);

float GLumenReflectionBilateralFilterDepthWeightScale = 10000.0f;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	);

int32 GLumenReflectionBilateralFilterNumSamples = 4;
FAutoConsoleVariableRef CVarLumenReflectionBilateralFilterNumSamples(
	TEXT("r.Lumen.Reflections.BilateralFilter.NumSamples"),
	GLumenReflectionBilateralFilterNumSamples,
	TEXT("Number of bilateral filter samples."),
	ECVF_Scalability | ECVF_RenderThreadSafe
	);

float GLumenReflectionBilateralFilterDepthWeightScale = 10000.0f;
FAutoConsoleVariableRef CVarLumenReflectionBilateralFilterDepthWeightScale(

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

Scope (from outer to inner):

file
function     FRDGTextureRef FDeferredShadingSceneRenderer::RenderLumenReflections

Source code excerpt:

			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;
			PassParameters->Substrate = Substrate::BindSubstrateGlobalUniformParameters(View);