r.Lumen.TranslucencyVolume.SpatialFilter.NumPasses

r.Lumen.TranslucencyVolume.SpatialFilter.NumPasses

#Overview

name: r.Lumen.TranslucencyVolume.SpatialFilter.NumPasses

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.NumPasses is to control the number of spatial filter passes applied to the translucency volume in Lumen, Unreal Engine 5’s global illumination system. This setting is part of the rendering system, specifically the Lumen subsystem responsible for real-time global illumination.

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

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

The associated variable GTranslucencyVolumeSpatialFilterNumPasses directly interacts with r.Lumen.TranslucencyVolume.SpatialFilter.NumPasses. They share the same value, with GTranslucencyVolumeSpatialFilterNumPasses being the actual variable used in the C++ code to control the number of filter passes.

Developers should be aware that this variable affects the quality and performance of translucency lighting in scenes using Lumen. Increasing the number of passes will likely improve the quality of the lighting effect but at the cost of increased rendering time.

Best practices when using this variable include:

  1. Balancing quality and performance by adjusting the number of passes based on the specific needs of the scene and target hardware.
  2. Testing different values to find the optimal setting for your project.
  3. Considering scalability options, as this variable is marked with ECVF_Scalability flag.

Regarding the associated variable GTranslucencyVolumeSpatialFilterNumPasses:

The purpose of GTranslucencyVolumeSpatialFilterNumPasses is to serve as the internal representation of the r.Lumen.TranslucencyVolume.SpatialFilter.NumPasses console variable within the engine’s C++ code.

This variable is used directly in the rendering code, specifically in the ComputeLumenTranslucencyGIVolume function of the FDeferredShadingSceneRenderer class. It controls a loop that applies the spatial filter to the translucency volume multiple times.

The value of this variable is set by the console variable system when r.Lumen.TranslucencyVolume.SpatialFilter.NumPasses is modified.

Developers should be aware that modifying GTranslucencyVolumeSpatialFilterNumPasses directly in C++ code is not recommended. Instead, they should use the console variable r.Lumen.TranslucencyVolume.SpatialFilter.NumPasses to ensure proper synchronization between the two.

Best practices for using GTranslucencyVolumeSpatialFilterNumPasses include:

  1. Accessing its value in rendering code when needed, rather than hardcoding the number of passes.
  2. Avoiding direct modification of this variable, instead using the console variable system to change its value.
  3. Considering the performance implications of the chosen value, especially in performance-critical sections of the rendering pipeline.

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

Scope: file

Source code excerpt:

int32 GTranslucencyVolumeSpatialFilterNumPasses = 2;
FAutoConsoleVariableRef CVarTranslucencyVolumeSpatialFilterNumPasses(
	TEXT("r.Lumen.TranslucencyVolume.SpatialFilter.NumPasses"),
	GTranslucencyVolumeSpatialFilterNumPasses,
	TEXT("How many passes of the spatial filter to do"),
	ECVF_Scalability | ECVF_RenderThreadSafe
	);

int32 GTranslucencyVolumeTemporalReprojection = 1;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	);

int32 GTranslucencyVolumeSpatialFilterNumPasses = 2;
FAutoConsoleVariableRef CVarTranslucencyVolumeSpatialFilterNumPasses(
	TEXT("r.Lumen.TranslucencyVolume.SpatialFilter.NumPasses"),
	GTranslucencyVolumeSpatialFilterNumPasses,
	TEXT("How many passes of the spatial filter to do"),
	ECVF_Scalability | ECVF_RenderThreadSafe
	);

int32 GTranslucencyVolumeTemporalReprojection = 1;
FAutoConsoleVariableRef CVarTranslucencyVolumeTemporalReprojection(

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

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>();
					PassParameters->RWVolumeTraceRadiance = GraphBuilder.CreateUAV(FilteredVolumeTraceRadiance);