r.Lumen.ReSTIRGather.ShortRangeAO

r.Lumen.ReSTIRGather.ShortRangeAO

#Overview

name: r.Lumen.ReSTIRGather.ShortRangeAO

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.ReSTIRGather.ShortRangeAO is to control whether to compute a short-range, full-resolution ambient occlusion (AO) to add high-frequency occlusion (contact shadows) to the Lumen ReSTIR GI system. This setting is part of Unreal Engine 5’s Lumen global illumination system, specifically the ReSTIR (Reservoir Spatiotemporal Importance Resampling) gather process.

This setting variable is primarily used in the Lumen subsystem of Unreal Engine’s rendering module. It’s referenced in the LumenReSTIRGather.cpp file, which is part of the Renderer module.

The value of this variable is set through the Unreal Engine console system. It’s declared as an FAutoConsoleVariableRef, which means it can be changed at runtime through console commands or configuration files.

The associated variable GLumenReSTIRGatherShortRangeAmbientOcclusion directly interacts with this setting. They share the same value, with GLumenReSTIRGatherShortRangeAmbientOcclusion being the actual variable used in the code logic.

Developers should be aware that this setting affects the visual quality and performance of the Lumen global illumination system. Enabling this feature (set to 1) will provide more detailed shadows and occlusion effects, but may have a performance cost.

Best practices when using this variable include:

  1. Consider the performance impact when enabling this feature, especially on lower-end hardware.
  2. Use in conjunction with other Lumen settings to achieve the desired balance between visual quality and performance.
  3. Test the impact of this setting in various lighting scenarios to ensure it provides the desired visual improvement.

Regarding the associated variable GLumenReSTIRGatherShortRangeAmbientOcclusion:

The purpose of GLumenReSTIRGatherShortRangeAmbientOcclusion is to store the actual value of the r.Lumen.ReSTIRGather.ShortRangeAO setting within the code.

This variable is used in the Lumen ReSTIR gather process within the rendering system. It’s checked in the RenderLumenReSTIRGather function to determine whether to compute the short-range ambient occlusion.

The value of this variable is set by the console variable system when r.Lumen.ReSTIRGather.ShortRangeAO is changed.

It interacts directly with the ViewFamily.EngineShowFlags.LumenShortRangeAmbientOcclusion flag to determine if the short-range AO should be computed.

Developers should be aware that this variable is used as a boolean check (!=0), so any non-zero value will enable the feature.

Best practices include:

  1. Use this variable for conditional logic related to short-range AO in Lumen ReSTIR gather.
  2. Remember that changes to r.Lumen.ReSTIRGather.ShortRangeAO will affect this variable.
  3. Consider the performance implications when this variable is non-zero, as it triggers additional computations in 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/LumenReSTIRGather.cpp:253

Scope: file

Source code excerpt:

int32 GLumenReSTIRGatherShortRangeAmbientOcclusion = 1;
FAutoConsoleVariableRef GVarLumenReSTIRGatherShortRangeAO(
	TEXT("r.Lumen.ReSTIRGather.ShortRangeAO"),
	GLumenReSTIRGatherShortRangeAmbientOcclusion,
	TEXT("Whether to compute a short range, full resolution AO to add high frequency occlusion (contact shadows) which ReSTIR GI lacks due to spatial filtering."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

float GLumenReSTIRGatherShortRangeAOMaxScreenTraceFraction = .02f;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReSTIRGather.cpp:251

Scope: file

Source code excerpt:

);

int32 GLumenReSTIRGatherShortRangeAmbientOcclusion = 1;
FAutoConsoleVariableRef GVarLumenReSTIRGatherShortRangeAO(
	TEXT("r.Lumen.ReSTIRGather.ShortRangeAO"),
	GLumenReSTIRGatherShortRangeAmbientOcclusion,
	TEXT("Whether to compute a short range, full resolution AO to add high frequency occlusion (contact shadows) which ReSTIR GI lacks due to spatial filtering."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

float GLumenReSTIRGatherShortRangeAOMaxScreenTraceFraction = .02f;
FAutoConsoleVariableRef CVarLumenReSTIRGatherShortRangeAOMaxScreenTraceFraction(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReSTIRGather.cpp:1294

Scope (from outer to inner):

file
function     FSSDSignalTextures FDeferredShadingSceneRenderer::RenderLumenReSTIRGather

Source code excerpt:

	DenoiserOutputs.Textures[2] = RoughSpecularIndirect;

	if (GLumenReSTIRGatherShortRangeAmbientOcclusion != 0 && ViewFamily.EngineShowFlags.LumenShortRangeAmbientOcclusion)
	{
		float MaxScreenTraceFraction = GLumenReSTIRGatherShortRangeAOMaxScreenTraceFraction;
		ScreenSpaceBentNormalParameters = ComputeScreenSpaceShortRangeAO(GraphBuilder, Scene, View, SceneTextures, LightingChannelsTexture, BlueNoise, MaxScreenTraceFraction, 1.0f, ComputePassFlags);
	}

	return DenoiserOutputs;