r.Lumen.ScreenProbeGather.ShortRangeAO

r.Lumen.ScreenProbeGather.ShortRangeAO

#Overview

name: r.Lumen.ScreenProbeGather.ShortRangeAO

This variable is created as a Console Variable (cvar).

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Lumen.ScreenProbeGather.ShortRangeAO is to control whether to compute a short-range, full-resolution ambient occlusion (AO) to add high-frequency occlusion (contact shadows) which Screen Probes lack due to downsampling in Unreal Engine 5’s Lumen global illumination system.

This setting variable is primarily used in the Lumen subsystem of Unreal Engine 5’s rendering module. It specifically affects the Screen Probe Gather component of Lumen, which is responsible for gathering lighting information from screen-space probes.

The value of this variable is set through the Unreal Engine console variable system. It is defined as an int32 with a default value of 1 (enabled) and can be modified at runtime.

The associated variable GLumenShortRangeAmbientOcclusion directly interacts with r.Lumen.ScreenProbeGather.ShortRangeAO. They share the same value and are used interchangeably in the code.

Developers must be aware that this variable affects the visual quality and performance of the Lumen global illumination system. Enabling it (value 1) will produce higher quality contact shadows but may have a performance cost. Disabling it (value 0) might improve performance but could result in less detailed shadows in some scenarios.

Best practices when using this variable include:

  1. Consider the target hardware and performance requirements when deciding whether to enable or disable this feature.
  2. Test the visual impact in various lighting scenarios to ensure the desired quality is achieved.
  3. Be aware of its interaction with other Lumen settings, such as GLumenDiffuseIndirectApplySSAO.

Regarding the associated variable GLumenShortRangeAmbientOcclusion:

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

Scope: file

Source code excerpt:

int32 GLumenShortRangeAmbientOcclusion = 1;
FAutoConsoleVariableRef GVarLumenScreenSpaceShortRangeAO(
	TEXT("r.Lumen.ScreenProbeGather.ShortRangeAO"),
	GLumenShortRangeAmbientOcclusion,
	TEXT("Whether to compute a short range, full resolution AO to add high frequency occlusion (contact shadows) which Screen Probes lack due to downsampling."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

int32 GLumenShortRangeAOApplyDuringIntegration = 0;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenDiffuseIndirect.cpp:289

Scope (from outer to inner):

file
function     bool ShouldRenderAOWithLumenGI

Source code excerpt:

bool ShouldRenderAOWithLumenGI()
{
	extern int32 GLumenShortRangeAmbientOcclusion;
	return GLumenDiffuseIndirectApplySSAO != 0 && GLumenShortRangeAmbientOcclusion == 0;
}

bool ShouldUseStereoLumenOptimizations()
{
	return GLumenShouldUseStereoOptimizations != 0;
}

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

Scope: file

Source code excerpt:

);

int32 GLumenShortRangeAmbientOcclusion = 1;
FAutoConsoleVariableRef GVarLumenScreenSpaceShortRangeAO(
	TEXT("r.Lumen.ScreenProbeGather.ShortRangeAO"),
	GLumenShortRangeAmbientOcclusion,
	TEXT("Whether to compute a short range, full resolution AO to add high frequency occlusion (contact shadows) which Screen Probes lack due to downsampling."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

int32 GLumenShortRangeAOApplyDuringIntegration = 0;
FAutoConsoleVariableRef CVarLumenShortRangeAOApplyDuringIntegration(

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

Scope (from outer to inner):

file
namespace    LumenScreenProbeGather
function     bool UseShortRangeAmbientOcclusion

Source code excerpt:

	bool UseShortRangeAmbientOcclusion(const FEngineShowFlags& ShowFlags)
	{
		return GLumenScreenProbeGatherReferenceMode ? false : (GLumenShortRangeAmbientOcclusion != 0 && ShowFlags.LumenShortRangeAmbientOcclusion);
	}

	bool ApplyShortRangeAODuringIntegration()
	{
		return GLumenShortRangeAOApplyDuringIntegration != 0;
	}