r.Lumen.ReSTIRGather.ShortRangeAO.MaxScreenTraceFraction

r.Lumen.ReSTIRGather.ShortRangeAO.MaxScreenTraceFraction

#Overview

name: r.Lumen.ReSTIRGather.ShortRangeAO.MaxScreenTraceFraction

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.MaxScreenTraceFraction is to control the short-range Ambient Occlusion (AO) tracing distance in Lumen’s ReSTIR gather process, specifically for the rendering system. This setting is expressed as a fraction of the screen size.

This setting variable is primarily used in the Lumen subsystem of Unreal Engine’s rendering module. It’s part of the ReSTIR (Reservoir-based Spatiotemporal Importance Resampling) gather process, which is a technique used in real-time global illumination.

The value of this variable is set through the Unreal Engine’s console variable system. It’s initialized with a default value of 0.02 (2% of the screen size) and can be adjusted at runtime.

The associated variable GLumenReSTIRGatherShortRangeAOMaxScreenTraceFraction directly interacts with this console variable. They share the same value, with the console variable acting as an interface for adjusting the internal engine variable.

Developers should be aware that this variable affects the performance-quality tradeoff of the short-range ambient occlusion calculation in Lumen. A higher value will increase the tracing distance, potentially improving quality but at the cost of performance.

Best practices when using this variable include:

  1. Adjusting it based on the specific needs of your scene and performance targets.
  2. Testing different values to find the optimal balance between visual quality and performance.
  3. Considering the impact on different screen resolutions, as it’s a fraction of screen size.

Regarding the associated variable GLumenReSTIRGatherShortRangeAOMaxScreenTraceFraction:

Its purpose is to store the actual value used by the engine for the short-range AO tracing distance.

This variable is used within the Lumen ReSTIR gather process in the rendering subsystem. It’s referenced in the RenderLumenReSTIRGather function of the FDeferredShadingSceneRenderer class.

The value of this variable is set by the console variable r.Lumen.ReSTIRGather.ShortRangeAO.MaxScreenTraceFraction.

It interacts directly with the ScreenSpaceBentNormalParameters calculation in the short-range ambient occlusion computation.

Developers should be aware that changes to the console variable will directly affect this internal variable, and thus the behavior of the short-range AO in Lumen.

Best practices include monitoring this variable’s value when debugging or profiling the Lumen ReSTIR gather process, and understanding its impact on the overall 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:261

Scope: file

Source code excerpt:

float GLumenReSTIRGatherShortRangeAOMaxScreenTraceFraction = .02f;
FAutoConsoleVariableRef CVarLumenReSTIRGatherShortRangeAOMaxScreenTraceFraction(
	TEXT("r.Lumen.ReSTIRGather.ShortRangeAO.MaxScreenTraceFraction"),
	GLumenReSTIRGatherShortRangeAOMaxScreenTraceFraction,
	TEXT("Short range AO tracing distance, as a fraction of the screen size."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

namespace LumenReSTIRGather 

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

float GLumenReSTIRGatherShortRangeAOMaxScreenTraceFraction = .02f;
FAutoConsoleVariableRef CVarLumenReSTIRGatherShortRangeAOMaxScreenTraceFraction(
	TEXT("r.Lumen.ReSTIRGather.ShortRangeAO.MaxScreenTraceFraction"),
	GLumenReSTIRGatherShortRangeAOMaxScreenTraceFraction,
	TEXT("Short range AO tracing distance, as a fraction of the screen size."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

namespace LumenReSTIRGather 
{

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

Scope (from outer to inner):

file
function     FSSDSignalTextures FDeferredShadingSceneRenderer::RenderLumenReSTIRGather

Source code excerpt:

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

	return DenoiserOutputs;
#else
	FSSDSignalTextures DenoiserOutputs;