r.Lumen.ScreenProbeGather.MaxRayIntensity

r.Lumen.ScreenProbeGather.MaxRayIntensity

#Overview

name: r.Lumen.ScreenProbeGather.MaxRayIntensity

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.MaxRayIntensity is to control the maximum ray lighting intensity in Lumen’s screen probe gathering process. It is used to clamp the intensity values to reduce fireflies (small, overly bright spots) in the rendered image.

This setting variable is primarily used in the Lumen subsystem of Unreal Engine’s rendering module. Specifically, it’s utilized in the screen probe filtering and gathering process, which is part of Lumen’s global illumination system.

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

The associated variable GLumenScreenProbeGatherMaxRayIntensity directly interacts with r.Lumen.ScreenProbeGather.MaxRayIntensity. They share the same value, with GLumenScreenProbeGatherMaxRayIntensity being the C++ variable that stores the actual value used in the rendering code.

Developers should be aware that this variable affects the visual quality and performance of Lumen’s global illumination. Setting it too low might result in dimmer lighting or loss of bright details, while setting it too high might introduce fireflies or other visual artifacts.

Best practices when using this variable include:

  1. Adjusting it carefully to find a balance between reducing fireflies and maintaining lighting intensity.
  2. Testing the variable’s effects across different lighting scenarios in the game.
  3. Considering performance implications, as very high values might impact rendering speed.

Regarding the associated variable GLumenScreenProbeGatherMaxRayIntensity:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeFiltering.cpp:56

Scope: file

Source code excerpt:

float GLumenScreenProbeGatherMaxRayIntensity = 40;
FAutoConsoleVariableRef GVarLumenScreenProbeGatherMaxRayIntensity(
	TEXT("r.Lumen.ScreenProbeGather.MaxRayIntensity"),
	GLumenScreenProbeGatherMaxRayIntensity,
	TEXT("Clamps the maximum ray lighting intensity (with PreExposure) to reduce fireflies."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

float GLumenScreenProbeTemporalFilterProbesHistoryDistanceThreshold = 30;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeFiltering.cpp:54

Scope: file

Source code excerpt:

);

float GLumenScreenProbeGatherMaxRayIntensity = 40;
FAutoConsoleVariableRef GVarLumenScreenProbeGatherMaxRayIntensity(
	TEXT("r.Lumen.ScreenProbeGather.MaxRayIntensity"),
	GLumenScreenProbeGatherMaxRayIntensity,
	TEXT("Clamps the maximum ray lighting intensity (with PreExposure) to reduce fireflies."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

float GLumenScreenProbeTemporalFilterProbesHistoryDistanceThreshold = 30;
FAutoConsoleVariableRef CVarLumenScreenProbeTemporalFilterProbesHistoryDistanceThreshold(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeFiltering.cpp:442

Scope (from outer to inner):

file
function     void FilterScreenProbes

Source code excerpt:

		PassParameters->View = View.ViewUniformBuffer;
		// This is used to quantize to uint during compositing, prevent poor precision
		PassParameters->MaxRayIntensity = FMath::Min(GLumenScreenProbeGatherMaxRayIntensity, 100000.0f);

		FScreenProbeCompositeTracesWithScatterCS::FPermutationDomain PermutationVector;
		PermutationVector.Set< FScreenProbeCompositeTracesWithScatterCS::FThreadGroupSize >(CompositeScatterThreadGroupSize);
		PermutationVector.Set< FScreenProbeCompositeTracesWithScatterCS::FStructuredImportanceSampling >(LumenScreenProbeGather::UseImportanceSampling(View));
		auto ComputeShader = View.ShaderMap->GetShader<FScreenProbeCompositeTracesWithScatterCS>(PermutationVector);