r.Lumen.ScreenProbeGather.ImportanceSample.ProbeRadianceHistory

r.Lumen.ScreenProbeGather.ImportanceSample.ProbeRadianceHistory

#Overview

name: r.Lumen.ScreenProbeGather.ImportanceSample.ProbeRadianceHistory

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.ImportanceSample.ProbeRadianceHistory is to control whether to use importance sampling of incoming lighting from the previous frame’s filtered traces to generate probe trace directions in Lumen’s screen probe gather system.

This setting variable is primarily used in the Lumen rendering system, specifically in the screen probe gather and importance sampling subsystems. It’s part of Unreal Engine 5’s global illumination solution.

The value of this variable is set through the Unreal Engine console variable system, as indicated by the FAutoConsoleVariableRef declaration. It can be changed at runtime or set in configuration files.

The associated variable GLumenScreenProbeImportanceSampleProbeRadianceHistory directly interacts with it, sharing the same value. This C++ variable is used in the actual code logic to determine whether to use the probe radiance history.

Developers should be aware that:

  1. This variable affects the performance and quality of global illumination.
  2. It’s only effective when certain conditions are met (valid history, no camera cut, no reset of previous transforms).
  3. When disabled, the Radiance Cache will be used instead for generating probe trace directions.

Best practices when using this variable:

  1. Enable it for higher quality lighting at the cost of some performance.
  2. Disable it if you notice temporal artifacts or if you need to prioritize performance over lighting quality.
  3. Test your scenes with both settings to find the best balance between visual quality and performance.

Regarding the associated variable GLumenScreenProbeImportanceSampleProbeRadianceHistory:

Developers should use the console variable (r.Lumen.ScreenProbeGather.ImportanceSample.ProbeRadianceHistory) to control this feature, rather than modifying the GLumenScreenProbeImportanceSampleProbeRadianceHistory variable directly in the code.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeImportanceSampling.cpp:40

Scope: file

Source code excerpt:

int32 GLumenScreenProbeImportanceSampleProbeRadianceHistory = 1;
FAutoConsoleVariableRef GVarLumenScreenProbeImportanceSampleProbeRadianceHistory(
	TEXT("r.Lumen.ScreenProbeGather.ImportanceSample.ProbeRadianceHistory"),
	GLumenScreenProbeImportanceSampleProbeRadianceHistory,
	TEXT("Whether to Importance Sample incoming lighting from last frame's filtered traces to generate probe trace directions.  When disabled, the Radiance Cache will be used instead."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

int32 GLumenScreenProbeBRDFOctahedronResolution = 8;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeImportanceSampling.cpp:38

Scope: file

Source code excerpt:

);

int32 GLumenScreenProbeImportanceSampleProbeRadianceHistory = 1;
FAutoConsoleVariableRef GVarLumenScreenProbeImportanceSampleProbeRadianceHistory(
	TEXT("r.Lumen.ScreenProbeGather.ImportanceSample.ProbeRadianceHistory"),
	GLumenScreenProbeImportanceSampleProbeRadianceHistory,
	TEXT("Whether to Importance Sample incoming lighting from last frame's filtered traces to generate probe trace directions.  When disabled, the Radiance Cache will be used instead."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

int32 GLumenScreenProbeBRDFOctahedronResolution = 8;
FAutoConsoleVariableRef CVarLumenScreenProbeBRDFOctahedronResolution(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeImportanceSampling.cpp:311

Scope (from outer to inner):

file
function     void GenerateImportanceSamplingRays

Source code excerpt:

		const FIntPoint ScreenProbeGatherBufferSize = ScreenProbeParameters.ScreenProbeAtlasBufferSize * ScreenProbeParameters.ScreenProbeGatherOctahedronResolution;

		const bool bUseProbeRadianceHistory = GLumenScreenProbeImportanceSampleProbeRadianceHistory != 0 
			&& ScreenProbeGatherState.ImportanceSamplingHistoryScreenProbeRadiance.IsValid()
			&& !View.bCameraCut 
			&& !View.bPrevTransformsReset
			&& ScreenProbeGatherState.ImportanceSamplingHistoryScreenProbeRadiance->GetDesc().Extent == ScreenProbeGatherBufferSize;

		{