r.Lumen.ScreenProbeGather.RoughSpecularSamplingMode

r.Lumen.ScreenProbeGather.RoughSpecularSamplingMode

#Overview

name: r.Lumen.ScreenProbeGather.RoughSpecularSamplingMode

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.RoughSpecularSamplingMode is to control the sampling method for rough specular reflections in Lumen’s screen probe gather process. This setting is part of Unreal Engine 5’s Lumen global illumination system, specifically the screen probe gathering component.

This setting variable is primarily used in the Lumen rendering subsystem, which is part of Unreal Engine 5’s advanced rendering capabilities. Based on the callsites, it’s clear that this variable is utilized in the screen probe integration process within the Lumen system.

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, allowing for dynamic adjustments to the rendering behavior.

The associated variable GLumenScreenProbeRoughSpecularSamplingMode directly interacts with this console variable. They share the same value, with GLumenScreenProbeRoughSpecularSamplingMode being the actual variable used in the C++ code.

Developers should be aware that this variable has two modes:

  1. Mode 0 (default): Uses the diffuse Spherical Harmonics (SH) sample as specular.
  2. Mode 1: Samples the SH along the main GGX specular reflection vector.

The best practices when using this variable include:

  1. Understanding the visual and performance implications of each mode.
  2. Testing both modes in various lighting scenarios to determine which works best for your specific use case.
  3. Being aware that changing this setting may affect the appearance of rough specular reflections in your scene.

Regarding the associated variable GLumenScreenProbeRoughSpecularSamplingMode:

When working with this variable, it’s important to consider its impact on both the visual fidelity of reflections and the overall performance 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/LumenScreenProbeGather.cpp:314

Scope: file

Source code excerpt:

int32 GLumenScreenProbeRoughSpecularSamplingMode = 0;
FAutoConsoleVariableRef GVarLumenScreenProbeRoughSpecularSamplingMode(
	TEXT("r.Lumen.ScreenProbeGather.RoughSpecularSamplingMode"),
	GLumenScreenProbeRoughSpecularSamplingMode,
	TEXT("Mode 0: use the diffuse SH sample as specular. Mode 1: sample the SH along the main GGX specular reflection vector."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

int32 GLumenScreenProbeTileDebugMode = 0;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

int32 GLumenScreenProbeRoughSpecularSamplingMode = 0;
FAutoConsoleVariableRef GVarLumenScreenProbeRoughSpecularSamplingMode(
	TEXT("r.Lumen.ScreenProbeGather.RoughSpecularSamplingMode"),
	GLumenScreenProbeRoughSpecularSamplingMode,
	TEXT("Mode 0: use the diffuse SH sample as specular. Mode 1: sample the SH along the main GGX specular reflection vector."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

int32 GLumenScreenProbeTileDebugMode = 0;
FAutoConsoleVariableRef GVarLumenScreenProbeTileDebugMode(

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

Scope (from outer to inner):

file
function     void InterpolateAndIntegrate

Source code excerpt:

	const bool bUseTileClassification = GLumenScreenProbeIntegrationTileClassification != 0 && LumenScreenProbeGather::GetDiffuseIntegralMethod() != 2;
	const bool bSupportBackfaceDiffuse = BackfaceDiffuseIndirect != nullptr;
	const int32 RoughSpecularSamplingMode = GLumenScreenProbeRoughSpecularSamplingMode > 0 ? 1 : 0;

	LumenReflections::FCompositeParameters ReflectionsCompositeParameters;
	LumenReflections::SetupCompositeParameters(View, ReflectionsCompositeParameters);

	if (bSSREnabled)
	{