r.Lumen.StereoOptimizations

r.Lumen.StereoOptimizations

#Overview

name: r.Lumen.StereoOptimizations

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.StereoOptimizations is to control whether certain Lumen state should be shared between views during instanced stereo rendering. This setting is part of Unreal Engine 5’s Lumen global illumination system, which is a component of the rendering subsystem.

The Lumen rendering module relies on this setting variable, as evidenced by its usage in the LumenDiffuseIndirect.cpp file within the Renderer’s private source code.

The value of this variable is set through the console variable system, with a default value of 1 (enabled). It can be changed at runtime using console commands or through configuration files.

This variable interacts directly with GLumenShouldUseStereoOptimizations, which is the actual integer variable used in the code to determine if the optimizations should be applied.

Developers must be aware that this setting affects performance and potentially visual quality in stereoscopic rendering scenarios, such as VR applications. Enabling this optimization (which is the default) may improve performance but could potentially introduce subtle differences between the left and right eye views.

Best practices when using this variable include:

  1. Testing the impact on both performance and visual quality in stereoscopic scenarios.
  2. Considering disabling it if perfect view parity between eyes is critical for your application.
  3. Documenting any project-specific settings related to this variable for consistent development and debugging.

Regarding the associated variable GLumenShouldUseStereoOptimizations:

The purpose of GLumenShouldUseStereoOptimizations is to serve as the actual flag checked by the renderer to determine if Lumen stereo optimizations should be applied.

This variable is used directly in the Lumen rendering code, specifically in the ShouldUseStereoLumenOptimizations() function, which likely gates various optimizations throughout the Lumen pipeline.

The value of this variable is set by the r.Lumen.StereoOptimizations console variable, ensuring that changes to the console variable are reflected in the actual rendering behavior.

GLumenShouldUseStereoOptimizations interacts directly with the r.Lumen.StereoOptimizations console variable and is used by other parts of the Lumen system to conditionally apply optimizations.

Developers should be aware that this is an internal variable and should not be modified directly. Instead, they should use the r.Lumen.StereoOptimizations console variable to control this setting.

Best practices for this variable include:

  1. Treating it as read-only in custom engine modifications.
  2. Using the ShouldUseStereoLumenOptimizations() function to check its state rather than accessing it directly, to maintain consistency with the engine’s design.
  3. Being aware of its potential impact on stereo rendering when debugging or optimizing Lumen-related systems.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

int32 GLumenShouldUseStereoOptimizations = 1;
FAutoConsoleVariableRef CVarLumenShouldUseStereoOptimizations(
	TEXT("r.Lumen.StereoOptimizations"),
	GLumenShouldUseStereoOptimizations,
	TEXT("Whether to to share certain Lumen state between views during the instanced stereo rendering."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarOrthoOverrideMeshDFTraceDistances(

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

int32 GLumenShouldUseStereoOptimizations = 1;
FAutoConsoleVariableRef CVarLumenShouldUseStereoOptimizations(
	TEXT("r.Lumen.StereoOptimizations"),
	GLumenShouldUseStereoOptimizations,
	TEXT("Whether to to share certain Lumen state between views during the instanced stereo rendering."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarOrthoOverrideMeshDFTraceDistances(
	TEXT("r.Lumen.Ortho.OverrideMeshDFTraceDistances"),

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

Scope (from outer to inner):

file
function     bool ShouldUseStereoLumenOptimizations

Source code excerpt:

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

void SetupLumenDiffuseTracingParameters(const FViewInfo& View, FLumenIndirectTracingParameters& OutParameters)
{
	OutParameters.StepFactor = FMath::Clamp(GDiffuseTraceStepFactor, .1f, 10.0f);