r.Lumen.Reflections.ScreenSpaceReconstruction

r.Lumen.Reflections.ScreenSpaceReconstruction

#Overview

name: r.Lumen.Reflections.ScreenSpaceReconstruction

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.Reflections.ScreenSpaceReconstruction is to control whether the Lumen rendering system uses screen space BRDF reweighting reconstruction for reflections. This setting is part of Unreal Engine 5’s Lumen global illumination and reflection system.

This setting variable is primarily used by the Lumen Reflections subsystem within the Renderer module of Unreal Engine 5. It directly affects how reflections are processed and rendered in the game or application.

The value of this variable is set through the Unreal Engine console or configuration files. It’s defined as an integer with a default value of 1 (enabled).

The associated variable GLumenReflectionScreenSpaceReconstruction interacts directly with this console variable. It’s used in the C++ code to determine whether to apply the screen space reconstruction technique during the reflection rendering process.

Developers should be aware that:

  1. This variable significantly impacts the quality and performance of reflections in Lumen.
  2. Enabling this feature (value = 1) may increase visual quality but could also increase performance overhead.
  3. It works in conjunction with other Lumen reflection settings, such as GLumenReflectionScreenSpaceReconstructionNumSamples.

Best practices when using this variable include:

  1. Test the visual impact and performance with this setting enabled and disabled to find the optimal balance for your project.
  2. Consider exposing this setting to end-users in graphics options if reflection quality is a key aspect of your game’s visuals.
  3. Be mindful of how this setting interacts with other Lumen reflection settings for optimal results.

Regarding the associated variable GLumenReflectionScreenSpaceReconstruction:

This is an internal C++ variable that directly corresponds to the r.Lumen.Reflections.ScreenSpaceReconstruction console variable. It’s used within the rendering code to quickly check whether screen space reconstruction should be applied. The value of this variable is set by the console variable system and is used in conditional statements to determine the reflection rendering path.

Developers should note that modifying this variable directly in code is not recommended. Instead, changes should be made through the console variable system to ensure consistency and proper engine behavior.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflections.cpp:158

Scope: file

Source code excerpt:

int32 GLumenReflectionScreenSpaceReconstruction = 1;
FAutoConsoleVariableRef CVarLumenReflectionScreenSpaceReconstruction(
	TEXT("r.Lumen.Reflections.ScreenSpaceReconstruction"),
	GLumenReflectionScreenSpaceReconstruction,
	TEXT("Whether to use the screen space BRDF reweighting reconstruction"),
	ECVF_RenderThreadSafe
	);

int32 GLumenReflectionScreenSpaceReconstructionNumSamples = 5;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflections.cpp:156

Scope: file

Source code excerpt:

);

int32 GLumenReflectionScreenSpaceReconstruction = 1;
FAutoConsoleVariableRef CVarLumenReflectionScreenSpaceReconstruction(
	TEXT("r.Lumen.Reflections.ScreenSpaceReconstruction"),
	GLumenReflectionScreenSpaceReconstruction,
	TEXT("Whether to use the screen space BRDF reweighting reconstruction"),
	ECVF_RenderThreadSafe
	);

int32 GLumenReflectionScreenSpaceReconstructionNumSamples = 5;
FAutoConsoleVariableRef CVarLumenReflectionScreenSpaceReconstructionNumSamples(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflections.cpp:1235

Scope (from outer to inner):

file
function     FRDGTextureRef FDeferredShadingSceneRenderer::RenderLumenReflections

Source code excerpt:


	const int32 NumReconstructionSamples = FMath::Clamp(FMath::RoundToInt(View.FinalPostProcessSettings.LumenReflectionQuality * GLumenReflectionScreenSpaceReconstructionNumSamples), GLumenReflectionScreenSpaceReconstructionNumSamples, 64);
	const bool bUseSpatialReconstruction = bDenoise && GLumenReflectionScreenSpaceReconstruction != 0;
	const bool bUseBilaterialFilter = bDenoise && GLumenReflectionBilateralFilter != 0;

	{
		FReflectionResolveCS::FParameters* PassParameters = GraphBuilder.AllocParameters<FReflectionResolveCS::FParameters>();
		PassParameters->RWSpecularIndirect = GraphBuilder.CreateUAV(FRDGTextureUAVDesc(ResolvedSpecularIndirect));
		PassParameters->RWSpecularIndirectDepth = GraphBuilder.CreateUAV(FRDGTextureUAVDesc(ResolvedSpecularIndirectDepth));