r.Lumen.TranslucencyVolume.SpatialFilter

r.Lumen.TranslucencyVolume.SpatialFilter

#Overview

name: r.Lumen.TranslucencyVolume.SpatialFilter

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.TranslucencyVolume.SpatialFilter is to control whether a spatial filter is applied to volume traces in the Lumen translucency volume lighting system. This setting is part of Unreal Engine 5’s rendering system, specifically the Lumen global illumination feature.

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

The value of this variable is set using an FAutoConsoleVariableRef, which means it can be changed at runtime through the console or configuration files. It’s initialized with a default value of 1 (enabled).

The associated variable GTranslucencyVolumeSpatialFilter directly interacts with r.Lumen.TranslucencyVolume.SpatialFilter. They share the same value and are used interchangeably in the code.

Developers should be aware that this variable affects the quality and performance of translucency lighting in scenes using Lumen. Enabling the spatial filter (value 1) can improve the visual quality of translucent objects by reducing noise in the lighting, but it may also have a performance cost.

Best practices when using this variable include:

  1. Consider the performance impact when enabling the spatial filter, especially on lower-end hardware.
  2. Use in conjunction with GTranslucencyVolumeSpatialFilterNumPasses to fine-tune the quality-performance tradeoff.
  3. Test the visual impact in different lighting scenarios to ensure it provides the desired effect for your specific use case.

Regarding the associated variable GTranslucencyVolumeSpatialFilter:

The purpose of GTranslucencyVolumeSpatialFilter is the same as r.Lumen.TranslucencyVolume.SpatialFilter - it controls the application of a spatial filter to volume traces in Lumen’s translucency lighting system.

This variable is used directly in the rendering code to determine whether to apply the spatial filter. It’s checked in the ComputeLumenTranslucencyGIVolume function of the FDeferredShadingSceneRenderer class.

The value of GTranslucencyVolumeSpatialFilter is set by the console variable r.Lumen.TranslucencyVolume.SpatialFilter, so changing one will affect the other.

GTranslucencyVolumeSpatialFilter interacts with GTranslucencyVolumeSpatialFilterNumPasses to determine how many passes of the spatial filter should be applied.

Developers should be aware that this variable directly affects the rendering pipeline and should be used cautiously in performance-critical scenarios.

Best practices for using GTranslucencyVolumeSpatialFilter include:

  1. Use it in conjunction with profiling tools to measure its impact on rendering performance.
  2. Consider exposing it as a quality setting in your game’s graphics options if translucency quality is important for your visuals.
  3. Be aware of its interaction with other Lumen settings and test thoroughly when making changes.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyVolumeLighting.cpp:76

Scope: file

Source code excerpt:

int32 GTranslucencyVolumeSpatialFilter = 1;
FAutoConsoleVariableRef CVarTranslucencyVolumeSpatialFilter(
	TEXT("r.Lumen.TranslucencyVolume.SpatialFilter"),
	GTranslucencyVolumeSpatialFilter,
	TEXT("Whether to use a spatial filter on the volume traces."),
	ECVF_Scalability | ECVF_RenderThreadSafe
	);

int32 GTranslucencyVolumeSpatialFilterNumPasses = 2;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyVolumeLighting.cpp:74

Scope: file

Source code excerpt:

);

int32 GTranslucencyVolumeSpatialFilter = 1;
FAutoConsoleVariableRef CVarTranslucencyVolumeSpatialFilter(
	TEXT("r.Lumen.TranslucencyVolume.SpatialFilter"),
	GTranslucencyVolumeSpatialFilter,
	TEXT("Whether to use a spatial filter on the volume traces."),
	ECVF_Scalability | ECVF_RenderThreadSafe
	);

int32 GTranslucencyVolumeSpatialFilterNumPasses = 2;
FAutoConsoleVariableRef CVarTranslucencyVolumeSpatialFilterNumPasses(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyVolumeLighting.cpp:816

Scope (from outer to inner):

file
function     void FDeferredShadingSceneRenderer::ComputeLumenTranslucencyGIVolume

Source code excerpt:

			}

			if (GTranslucencyVolumeSpatialFilter)
			{
				for (int32 PassIndex = 0; PassIndex < GTranslucencyVolumeSpatialFilterNumPasses; PassIndex++)
				{
					FRDGTextureRef FilteredVolumeTraceRadiance = GraphBuilder.CreateTexture(VolumeTraceRadianceDesc, TEXT("Lumen.TranslucencyVolume.FilteredVolumeTraceRadiance"));

					FTranslucencyVolumeSpatialFilterCS::FParameters* PassParameters = GraphBuilder.AllocParameters<FTranslucencyVolumeSpatialFilterCS::FParameters>();