r.LumenScene.Radiosity.SpatialFilterProbes

r.LumenScene.Radiosity.SpatialFilterProbes

#Overview

name: r.LumenScene.Radiosity.SpatialFilterProbes

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.LumenScene.Radiosity.SpatialFilterProbes is to control spatial filtering of Radiosity probes in Unreal Engine 5’s Lumen global illumination system. This setting is part of the rendering system, specifically the Lumen radiosity component.

This setting variable is primarily used in the Lumen radiosity subsystem of Unreal Engine 5’s rendering module. It’s referenced in the LumenRadiosity.cpp file, which is part of the Renderer module.

The value of this variable is set through the Unreal Engine console variable system. It’s defined as an FAutoConsoleVariableRef, which means it can be changed at runtime through console commands or configuration files.

The associated variable GLumenRadiositySpatialFilterProbes interacts directly with this setting. They share the same value, with GLumenRadiositySpatialFilterProbes being the actual integer variable used in the code logic.

Developers should be aware that this variable is a boolean (0 or 1) that determines whether spatial filtering is applied to Radiosity probes. Enabling this (value 1) reduces noise in the global illumination but may increase light leaking.

Best practices when using this variable include:

  1. Understanding the trade-off between noise reduction and light leaking.
  2. Testing the visual impact in different lighting scenarios.
  3. Considering performance implications, as spatial filtering may have a performance cost.

Regarding the associated variable GLumenRadiositySpatialFilterProbes:

The purpose of GLumenRadiositySpatialFilterProbes is to serve as the actual integer variable that controls the spatial filtering of Radiosity probes in the code logic.

This variable is used directly in the rendering code, specifically in the Lumen radiosity calculations. It’s checked in conditional statements to determine whether to apply spatial filtering.

The value of GLumenRadiositySpatialFilterProbes is set by the console variable system, mirroring the value of r.LumenScene.Radiosity.SpatialFilterProbes.

It interacts with another variable, GLumenRadiositySpatialFilterProbesKernelSize, which likely determines the size of the spatial filter when applied.

Developers should be aware that this variable directly affects the rendering pipeline. Changes to its value will immediately impact the radiosity calculations in the Lumen system.

Best practices include:

  1. Avoiding direct modification of GLumenRadiositySpatialFilterProbes in code; instead, use the console variable system to ensure consistency.
  2. Considering the interaction with GLumenRadiositySpatialFilterProbesKernelSize when adjusting radiosity settings.
  3. Profiling the performance impact when enabling or disabling this feature, especially in complex scenes.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadiosity.cpp:41

Scope: file

Source code excerpt:

int32 GLumenRadiositySpatialFilterProbes = 1;
FAutoConsoleVariableRef CVarLumenRadiositySpatialFilterProbes(
	TEXT("r.LumenScene.Radiosity.SpatialFilterProbes"),
	GLumenRadiositySpatialFilterProbes,
	TEXT("Whether to spatially filter Radiosity probes.  Filtering reduces noise but increases leaking."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

int32 GLumenRadiositySpatialFilterProbesKernelSize = 1;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadiosity.cpp:39

Scope: file

Source code excerpt:

);

int32 GLumenRadiositySpatialFilterProbes = 1;
FAutoConsoleVariableRef CVarLumenRadiositySpatialFilterProbes(
	TEXT("r.LumenScene.Radiosity.SpatialFilterProbes"),
	GLumenRadiositySpatialFilterProbes,
	TEXT("Whether to spatially filter Radiosity probes.  Filtering reduces noise but increases leaking."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

int32 GLumenRadiositySpatialFilterProbesKernelSize = 1;
FAutoConsoleVariableRef CVarLumenRadiositySpatialFilterProbesKernelSize(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadiosity.cpp:870

Scope: file

Source code excerpt:

	}

	if (GLumenRadiositySpatialFilterProbes && GLumenRadiositySpatialFilterProbesKernelSize > 0)
	{
		//@todo - use temporary buffer based off of CardUpdateContext.UpdateAtlasSize which is smaller
		FRDGTextureRef FilteredTraceRadianceAtlas = GraphBuilder.CreateTexture(
			FRDGTextureDesc::Create2D(RadiosityFrameTemporaries.ProbeTracingAtlasSize, PF_FloatRGB, FClearValueBinding::Black, TexCreate_ShaderResource | TexCreate_UAV),
			TEXT("Lumen.Radiosity.FilteredTraceRadianceAtlas"));