r.Lumen.Reflections.BilateralFilter.DepthWeightScale

r.Lumen.Reflections.BilateralFilter.DepthWeightScale

#Overview

name: r.Lumen.Reflections.BilateralFilter.DepthWeightScale

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.DepthWeightScale is to scale the depth weight of the bilateral filter used in Lumen’s reflection system. This setting is part of Unreal Engine 5’s Lumen global illumination and reflection system, specifically focusing on the reflection component.

This setting variable is primarily used in the Renderer module, particularly within the Lumen subsystem for reflections. The code references are found in the LumenReflections.cpp file, which is part of the runtime renderer.

The value of this variable is set through the Unreal Engine console variable system. It’s initialized with a default value of 10000.0f and can be modified at runtime using console commands or through project settings.

The variable interacts directly with its associated C++ variable GLumenReflectionBilateralFilterDepthWeightScale. This associated variable is used in the RenderLumenReflections function to set the BilateralFilterDepthWeightScale parameter for the reflection rendering pass.

Developers should be aware that this variable affects the quality and performance of Lumen reflections. A higher value will give more weight to depth differences in the bilateral filter, potentially resulting in sharper reflection edges but possibly introducing more noise or artifacts.

Best practices when using this variable include:

  1. Experimenting with different values to find the right balance between reflection quality and performance for your specific scene.
  2. Consider the overall visual impact on your game or application when adjusting this value.
  3. Be mindful of performance implications, especially on lower-end hardware.

Regarding the associated variable GLumenReflectionBilateralFilterDepthWeightScale:

This is the actual C++ variable that stores the value set by the console variable. It’s used directly in the rendering code to pass the depth weight scale to the shader parameters. The variable is declared as a float and initialized with the same default value as the console variable (10000.0f).

Developers should note that modifying this variable directly in C++ code is not recommended, as it would bypass the console variable system. Instead, they should use the console variable (r.Lumen.Reflections.BilateralFilter.DepthWeightScale) to change the value, which will automatically update GLumenReflectionBilateralFilterDepthWeightScale.

The best practice for using this associated variable is to read its value when needed in C++ code, rather than modifying it directly. This ensures consistency with the console variable system and allows for runtime adjustments without code changes.

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

Scope: file

Source code excerpt:

float GLumenReflectionBilateralFilterDepthWeightScale = 10000.0f;
FAutoConsoleVariableRef CVarLumenReflectionBilateralFilterDepthWeightScale(
	TEXT("r.Lumen.Reflections.BilateralFilter.DepthWeightScale"),
	GLumenReflectionBilateralFilterDepthWeightScale,
	TEXT("Scales the depth weight of the bilateral filter"),
	ECVF_Scalability | ECVF_RenderThreadSafe
	);

float GLumenReflectionBilateralFilterNormalAngleThresholdScale = 1.0f;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	);

float GLumenReflectionBilateralFilterDepthWeightScale = 10000.0f;
FAutoConsoleVariableRef CVarLumenReflectionBilateralFilterDepthWeightScale(
	TEXT("r.Lumen.Reflections.BilateralFilter.DepthWeightScale"),
	GLumenReflectionBilateralFilterDepthWeightScale,
	TEXT("Scales the depth weight of the bilateral filter"),
	ECVF_Scalability | ECVF_RenderThreadSafe
	);

float GLumenReflectionBilateralFilterNormalAngleThresholdScale = 1.0f;
FAutoConsoleVariableRef CVarLumenReflectionBilateralFilterNormalAngleThresholdScale(

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

Scope (from outer to inner):

file
function     FRDGTextureRef FDeferredShadingSceneRenderer::RenderLumenReflections

Source code excerpt:

			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);
			PassParameters->ReflectionTracingParameters = ReflectionTracingParameters;