r.LumenScene.Lighting.Feedback

r.LumenScene.Lighting.Feedback

#Overview

name: r.LumenScene.Lighting.Feedback

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.LumenScene.Lighting.Feedback is to control whether the Lumen lighting system prioritizes surface cache lighting updates based on feedback. This setting is part of Unreal Engine 5’s Lumen global illumination system, which is a key component of the rendering subsystem.

The Lumen scene lighting module in the Renderer subsystem relies on this setting variable. This can be seen from the file location: Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneLighting.cpp.

The value of this variable is set through the Unreal Engine console variable system. It’s initialized with a default value of 1 and can be changed at runtime using console commands or through project settings.

The associated variable GLumenSceneLightingFeedback directly interacts with this setting. It’s an integer variable that holds the actual value used in the code.

Developers must be aware that this setting affects the performance and quality trade-off in the Lumen lighting system. When enabled (value != 0), it may improve the efficiency of lighting updates but could potentially introduce some artifacts or inconsistencies if not properly tuned.

Best practices when using this variable include:

  1. Testing different values to find the optimal balance between performance and visual quality for your specific project.
  2. Considering disabling it (setting to 0) if you notice any visual artifacts related to lighting updates.
  3. Using it in conjunction with other Lumen settings for best results.

Regarding the associated variable GLumenSceneLightingFeedback:

The purpose of GLumenSceneLightingFeedback is to serve as the actual storage for the r.LumenScene.Lighting.Feedback setting within the C++ code.

This variable is used directly in the Lumen scene lighting module of the Renderer subsystem. It’s checked in the UseFeedback function to determine whether to use feedback for lighting updates when hardware ray tracing is enabled.

The value of GLumenSceneLightingFeedback is set by the console variable system when r.LumenScene.Lighting.Feedback is modified.

It interacts directly with the Lumen hardware ray tracing system, as seen in the UseFeedback function where it’s checked alongside the hardware ray tracing status.

Developers should be aware that this variable is used in conditional statements, so its value (0 or non-zero) determines the behavior of the lighting update system.

Best practices include:

  1. Not modifying this variable directly in code, but instead using the r.LumenScene.Lighting.Feedback console variable to change its value.
  2. Being cautious when making changes to the logic that uses this variable, as it could have significant impacts on the Lumen lighting system’s behavior.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneLighting.cpp:22

Scope: file

Source code excerpt:

int32 GLumenSceneLightingFeedback = 1;
FAutoConsoleVariableRef CVarLumenSceneLightingFeedback(
	TEXT("r.LumenScene.Lighting.Feedback"),
	GLumenSceneLightingFeedback,
	TEXT("Whether to prioritize surface cache lighting updates based on the feedback."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

int32 GLumenDirectLightingUpdateFactor = 32;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneLighting.cpp:20

Scope: file

Source code excerpt:

);

int32 GLumenSceneLightingFeedback = 1;
FAutoConsoleVariableRef CVarLumenSceneLightingFeedback(
	TEXT("r.LumenScene.Lighting.Feedback"),
	GLumenSceneLightingFeedback,
	TEXT("Whether to prioritize surface cache lighting updates based on the feedback."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

int32 GLumenDirectLightingUpdateFactor = 32;
FAutoConsoleVariableRef CVarLumenSceneDirectLightingUpdateFactor(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneLighting.cpp:63

Scope (from outer to inner):

file
namespace    LumenSceneLighting
function     bool UseFeedback

Source code excerpt:

	bool UseFeedback(const FSceneViewFamily& ViewFamily)
	{
		return Lumen::UseHardwareRayTracing(ViewFamily) && GLumenSceneLightingFeedback != 0;
	}
}

bool Lumen::UseHardwareRayTracedSceneLighting(const FSceneViewFamily& ViewFamily)
{
	return Lumen::UseHardwareRayTracedDirectLighting(ViewFamily) || Lumen::UseHardwareRayTracedRadiosity(ViewFamily);