r.Lumen.ScreenProbeGather.Temporal.FractionOfLightingMovingForFastUpdateMode

r.Lumen.ScreenProbeGather.Temporal.FractionOfLightingMovingForFastUpdateMode

#Overview

name: r.Lumen.ScreenProbeGather.Temporal.FractionOfLightingMovingForFastUpdateMode

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.FractionOfLightingMovingForFastUpdateMode is to control the threshold for determining when to use the fast update mode in Lumen’s screen probe gathering process. This setting is part of Unreal Engine 5’s Lumen global illumination system, specifically for the screen probe gathering component.

This setting variable is primarily used in the Lumen subsystem of Unreal Engine 5’s rendering module. Based on the callsites, it’s clear that this variable is utilized in the LumenScreenProbeGather.cpp file, which is part of the Renderer’s private implementation.

The value of this variable is set through the Unreal Engine’s console variable system. It’s initialized with a default value of 0.1f and can be modified at runtime using the console command system.

The associated variable GLumenScreenProbeFractionOfLightingMovingForFastUpdateMode directly interacts with this console variable. They share the same value, with the console variable acting as an interface for runtime modification.

Developers should be aware that this variable affects the performance and quality trade-off in Lumen’s screen probe gathering process. A lower value will make the system more sensitive to lighting changes, potentially increasing quality but at the cost of performance. Conversely, a higher value might improve performance but could lead to less accurate lighting updates.

Best practices when using this variable include:

  1. Adjusting it based on the specific needs of your scene and performance targets.
  2. Testing different values to find the optimal balance between lighting update speed and performance.
  3. Considering the interaction with other Lumen settings, especially those related to temporal accumulation and update speed.

Regarding the associated variable GLumenScreenProbeFractionOfLightingMovingForFastUpdateMode:

The purpose of this variable is to store the actual value used in the rendering code for determining when to use the fast update mode in Lumen’s screen probe gathering.

It’s used directly in the UpdateHistoryScreenProbeGather function, where its inverse is calculated and passed to the shader parameters. This suggests that it’s a crucial part of the algorithm that determines how quickly the lighting information is updated in response to changes in the scene.

The value of this variable is set by the console variable system, allowing for runtime adjustments.

It interacts closely with other variables like GLumenScreenProbeTemporalMaxFastUpdateModeAmount and View.FinalPostProcessSettings.LumenFinalGatherLightingUpdateSpeed, which together control the temporal aspects of Lumen’s screen probe gathering.

Developers should be aware that modifying this variable will directly impact the behavior of the screen probe gathering process. It’s particularly important in scenes with dynamic lighting or moving objects.

Best practices include:

  1. Profiling the impact of different values on both visual quality and performance.
  2. Considering the nature of your scene (static vs. dynamic) when setting this value.
  3. Balancing this setting with other Lumen temporal settings for optimal results.

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

Scope: file

Source code excerpt:

float GLumenScreenProbeFractionOfLightingMovingForFastUpdateMode = .1f;
FAutoConsoleVariableRef CVarLumenScreenProbeFractionOfLightingMovingForFastUpdateMode(
	TEXT("r.Lumen.ScreenProbeGather.Temporal.FractionOfLightingMovingForFastUpdateMode"),
	GLumenScreenProbeFractionOfLightingMovingForFastUpdateMode,
	TEXT(""),
	ECVF_Scalability | ECVF_RenderThreadSafe
	);

float GLumenScreenProbeTemporalMaxFastUpdateModeAmount = .9f;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	);

float GLumenScreenProbeFractionOfLightingMovingForFastUpdateMode = .1f;
FAutoConsoleVariableRef CVarLumenScreenProbeFractionOfLightingMovingForFastUpdateMode(
	TEXT("r.Lumen.ScreenProbeGather.Temporal.FractionOfLightingMovingForFastUpdateMode"),
	GLumenScreenProbeFractionOfLightingMovingForFastUpdateMode,
	TEXT(""),
	ECVF_Scalability | ECVF_RenderThreadSafe
	);

float GLumenScreenProbeTemporalMaxFastUpdateModeAmount = .9f;
FAutoConsoleVariableRef CVarLumenScreenProbeTemporalMaxFastUpdateModeAmount(

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

Scope (from outer to inner):

file
function     void UpdateHistoryScreenProbeGather
lambda-function

Source code excerpt:

						PassParameters->HistoryDistanceThreshold = GLumenScreenProbeHistoryDistanceThreshold;
						PassParameters->PrevSceneColorPreExposureCorrection = View.PreExposure / View.PrevViewInfo.SceneColorPreExposure;
						PassParameters->InvFractionOfLightingMovingForFastUpdateMode = 1.0f / FMath::Max(GLumenScreenProbeFractionOfLightingMovingForFastUpdateMode, .001f);
						PassParameters->MaxFastUpdateModeAmount = GLumenScreenProbeTemporalMaxFastUpdateModeAmount;
						PassParameters->bIsSubstrateTileHistoryValid = bOverflowTileHistoryValid ? 1u : 0u;

						const float MaxFramesAccumulatedScale = 1.0f / FMath::Sqrt(FMath::Clamp(View.FinalPostProcessSettings.LumenFinalGatherLightingUpdateSpeed, .5f, 8.0f));
						const float EditingScale = View.Family->bCurrentlyBeingEdited ? .5f : 1.0f;
						PassParameters->MaxFramesAccumulated = FMath::RoundToInt(GLumenScreenProbeTemporalMaxFramesAccumulated * MaxFramesAccumulatedScale * EditingScale);