r.Lumen.RadianceCache.SpatialFilterProbes

r.Lumen.RadianceCache.SpatialFilterProbes

#Overview

name: r.Lumen.RadianceCache.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.Lumen.RadianceCache.SpatialFilterProbes is to control whether to filter probe radiance between neighbors in the Lumen Radiance Cache system. This setting is part of Unreal Engine 5’s global illumination solution, specifically the Lumen system.

This setting variable is primarily used in the Lumen subsystem, which is part of Unreal Engine 5’s rendering module. Based on the callsites, it’s implemented in the LumenRadianceCache.cpp file, which suggests it’s specifically related to the Radiance Cache component of Lumen.

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 variable interacts directly with GRadianceCacheFilterProbes, which is the actual integer variable used in the code to determine whether filtering should occur. They share the same value, with r.Lumen.RadianceCache.SpatialFilterProbes being the console-accessible name.

Developers should be aware that this variable is render thread safe (ECVF_RenderThreadSafe), meaning it can be changed safely during rendering without causing thread-related issues. The default value is set to 1, indicating that probe radiance filtering is enabled by default.

Best practices when using this variable include:

  1. Understanding the performance implications of enabling or disabling this feature.
  2. Testing the visual quality differences with it on and off in various lighting scenarios.
  3. Considering the impact on different hardware configurations, as filtering may have different performance costs on different GPUs.

Regarding the associated variable GRadianceCacheFilterProbes:

The purpose of GRadianceCacheFilterProbes is to serve as the actual runtime variable that controls whether probe radiance filtering occurs in the Lumen Radiance Cache system.

This variable is used directly in the rendering code, specifically in the UpdateRadianceCaches function within the LumenRadianceCache namespace. When GRadianceCacheFilterProbes is true (non-zero), additional filtering steps are performed on the radiance probe atlas texture.

The value of GRadianceCacheFilterProbes is set by the console variable system through r.Lumen.RadianceCache.SpatialFilterProbes.

This variable doesn’t directly interact with other variables, but its value determines whether certain rendering passes are executed.

Developers should be aware that changing this variable will directly affect the Lumen Radiance Cache rendering pipeline. Enabling it (value = 1) will result in additional filtering computations, which may impact performance but potentially improve visual quality.

Best practices for using GRadianceCacheFilterProbes include:

  1. Profiling the performance impact of enabling and disabling this feature in your specific scenes.
  2. Considering the balance between visual quality and performance when deciding whether to use this feature.
  3. Being cautious about changing this value during gameplay, as it could cause noticeable changes in lighting appearance.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCache.cpp:52

Scope: file

Source code excerpt:

int32 GRadianceCacheFilterProbes = 1;
FAutoConsoleVariableRef CVarRadianceCacheFilterProbes(
	TEXT("r.Lumen.RadianceCache.SpatialFilterProbes"),
	GRadianceCacheFilterProbes,
	TEXT("Whether to filter probe radiance between neighbors"),
	ECVF_RenderThreadSafe
);

int32 GRadianceCacheSortTraceTiles = 0;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCache.cpp:50

Scope: file

Source code excerpt:

);

int32 GRadianceCacheFilterProbes = 1;
FAutoConsoleVariableRef CVarRadianceCacheFilterProbes(
	TEXT("r.Lumen.RadianceCache.SpatialFilterProbes"),
	GRadianceCacheFilterProbes,
	TEXT("Whether to filter probe radiance between neighbors"),
	ECVF_RenderThreadSafe
);

int32 GRadianceCacheSortTraceTiles = 0;
FAutoConsoleVariableRef CVarRadianceCacheSortTraceTiles(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCache.cpp:2073

Scope (from outer to inner):

file
namespace    LumenRadianceCache
function     void UpdateRadianceCaches

Source code excerpt:

			RadianceProbeAtlasTexture[RadianceCacheIndex] = Setup.RadianceProbeAtlasTextureSource;

			if (GRadianceCacheFilterProbes)
			{
				FRDGTextureRef FilteredRadianceProbeAtlasTexture = GraphBuilder.CreateTexture(RadianceProbeAtlasTexture[RadianceCacheIndex]->Desc, TEXT("Lumen.RadianceCache.FilteredRadianceProbeAtlasTexture"));

				{
					FFilterProbeRadianceWithGatherCS::FParameters* PassParameters = GraphBuilder.AllocParameters<FFilterProbeRadianceWithGatherCS::FParameters>();
					PassParameters->RWRadianceProbeAtlasTexture = GraphBuilder.CreateUAV(FRDGTextureUAVDesc(FilteredRadianceProbeAtlasTexture));