r.Lumen.ScreenProbeGather.Temporal.FastUpdateModeUseNeighborhoodClamp

r.Lumen.ScreenProbeGather.Temporal.FastUpdateModeUseNeighborhoodClamp

#Overview

name: r.Lumen.ScreenProbeGather.Temporal.FastUpdateModeUseNeighborhoodClamp

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.ScreenProbeGather.Temporal.FastUpdateModeUseNeighborhoodClamp is to control whether to clamp history values to the current frame’s screen space neighborhood in areas around moving objects within the Lumen Screen Probe Gather system.

This setting variable is primarily used in the Lumen rendering system, specifically in the Screen Probe Gather component of Unreal Engine 5. It is part of the Renderer module and is utilized in the temporal reprojection process for screen probes.

The value of this variable is set through the console variable system in Unreal Engine. It is declared as an integer with an initial value of 0, which means the feature is disabled by default.

The associated variable GLumenScreenProbeTemporalFastUpdateModeUseNeighborhoodClamp directly interacts with this console variable. They share the same value, with the console variable controlling the global integer variable.

Developers should be aware that this variable affects the temporal stability and quality of the Lumen Screen Probe Gather results. When enabled (set to non-zero), it will clamp history values to the current frame’s screen space neighborhood in areas around moving objects, which can help reduce temporal artifacts but may also affect the overall lighting quality.

Best practices when using this variable include:

  1. Testing the visual impact with and without the feature enabled to determine the best setting for your specific scene.
  2. Considering the performance impact, as neighborhood clamping may introduce additional computational cost.
  3. Using it in conjunction with other Lumen settings to achieve the desired balance between visual quality and performance.

Regarding the associated variable GLumenScreenProbeTemporalFastUpdateModeUseNeighborhoodClamp:

The purpose of this variable is to store the actual value used by the rendering code to determine whether to apply the neighborhood clamping in the fast update mode of the Lumen Screen Probe Gather system.

This variable is used directly in the Lumen rendering system, specifically in the Screen Probe Temporal Reprojection compute shader permutation setup.

Its value is set by the console variable r.Lumen.ScreenProbeGather.Temporal.FastUpdateModeUseNeighborhoodClamp.

It interacts with the shader permutation system, affecting how the ScreenProbeTemporalReprojectionCS shader is compiled and executed.

Developers should be aware that changes to this variable will only take effect when the shader permutations are regenerated or when the engine recompiles shaders.

Best practices include:

  1. Avoiding direct modification of this variable in code, instead using the console variable to control its value.
  2. Considering the impact on shader compilation times when frequently changing this setting during development.
  3. Profiling the performance impact of enabling this feature in your specific use case.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeGather.cpp:187

Scope: file

Source code excerpt:

int32 GLumenScreenProbeTemporalFastUpdateModeUseNeighborhoodClamp = 0;
FAutoConsoleVariableRef CVarLumenScreenProbeTemporalFastUpdateModeUseNeighborhoodClamp(
	TEXT("r.Lumen.ScreenProbeGather.Temporal.FastUpdateModeUseNeighborhoodClamp"),
	GLumenScreenProbeTemporalFastUpdateModeUseNeighborhoodClamp,
	TEXT("Whether to clamp history values to the current frame's screen space neighborhood, in areas around moving objects."),
	ECVF_Scalability | ECVF_RenderThreadSafe
	);

static TAutoConsoleVariable<int32> CVarLumenScreenProbeTemporalRejectBasedOnNormal(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeGather.cpp:185

Scope: file

Source code excerpt:

	);

int32 GLumenScreenProbeTemporalFastUpdateModeUseNeighborhoodClamp = 0;
FAutoConsoleVariableRef CVarLumenScreenProbeTemporalFastUpdateModeUseNeighborhoodClamp(
	TEXT("r.Lumen.ScreenProbeGather.Temporal.FastUpdateModeUseNeighborhoodClamp"),
	GLumenScreenProbeTemporalFastUpdateModeUseNeighborhoodClamp,
	TEXT("Whether to clamp history values to the current frame's screen space neighborhood, in areas around moving objects."),
	ECVF_Scalability | ECVF_RenderThreadSafe
	);

static TAutoConsoleVariable<int32> CVarLumenScreenProbeTemporalRejectBasedOnNormal(
	TEXT("r.Lumen.ScreenProbeGather.Temporal.RejectBasedOnNormal"),

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeGather.cpp:1449

Scope (from outer to inner):

file
function     void UpdateHistoryScreenProbeGather
lambda-function

Source code excerpt:

						FScreenProbeTemporalReprojectionCS::FPermutationDomain PermutationVector;
						PermutationVector.Set< FScreenProbeTemporalReprojectionCS::FOverflowTile>(bOverflow);
						PermutationVector.Set< FScreenProbeTemporalReprojectionCS::FFastUpdateModeNeighborhoodClamp>(GLumenScreenProbeTemporalFastUpdateModeUseNeighborhoodClamp != 0);
						PermutationVector.Set< FScreenProbeTemporalReprojectionCS::FHistoryRejectBasedOnNormal>(bRejectBasedOnNormal);
						PermutationVector.Set< FScreenProbeTemporalReprojectionCS::FSupportBackfaceDiffuse >(bSupportBackfaceDiffuse);
						auto ComputeShader = View.ShaderMap->GetShader<FScreenProbeTemporalReprojectionCS>(PermutationVector);

						FScreenProbeTemporalReprojectionCS::FParameters* PassParameters = GraphBuilder.AllocParameters<FScreenProbeTemporalReprojectionCS::FParameters>();
						PassParameters->RWNewHistoryDiffuseIndirect = RWNewHistoryDiffuseIndirect;