r.Lumen.Visualize.SurfaceCacheFeedback

r.Lumen.Visualize.SurfaceCacheFeedback

#Overview

name: r.Lumen.Visualize.SurfaceCacheFeedback

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.Visualize.SurfaceCacheFeedback is to control whether the Lumen visualization system should write surface cache feedback requests into the feedback buffer. This setting is part of the Lumen global illumination system in Unreal Engine 5’s rendering pipeline.

This setting variable is primarily used by the Lumen visualization subsystem within the Renderer module of Unreal Engine 5. It’s specifically related to the debugging and visualization features of the Lumen global illumination system.

The value of this variable is set through a console variable (CVar) system. It’s defined as a TAutoConsoleVariable with an initial value of 1, meaning it’s enabled by default.

The associated variable CVarVisualizeLumenSceneSurfaceCacheFeedback directly interacts with this setting. It’s the actual console variable that stores and provides access to the setting’s value.

Developers should be aware that this variable is flagged with ECVF_Scalability and ECVF_RenderThreadSafe. This means it can affect performance scaling and is safe to modify from the render thread.

Best practices when using this variable include:

  1. Use it primarily for debugging and visualization purposes, not in production builds.
  2. Be aware of potential performance impacts when enabled, as it’s writing additional data to the feedback buffer.
  3. Use in conjunction with other Lumen visualization tools for comprehensive debugging.

Regarding the associated variable CVarVisualizeLumenSceneSurfaceCacheFeedback:

The purpose of CVarVisualizeLumenSceneSurfaceCacheFeedback is to provide a programmable interface to control the r.Lumen.Visualize.SurfaceCacheFeedback setting.

This variable is used directly in the LumenVisualize::UseSurfaceCacheFeedback function to determine whether surface cache feedback should be used. It’s accessed using the GetValueOnRenderThread() method, indicating it’s designed for use in render thread contexts.

The value of this variable is set when the console variable is created, with an initial value of 1 (enabled).

Developers should be aware that changes to this variable will immediately affect the behavior of the Lumen visualization system. It’s thread-safe for use in render thread contexts.

Best practices for using this variable include:

  1. Use GetValueOnRenderThread() when accessing from render thread contexts.
  2. Consider exposing this setting in debug UI for easy toggling during development.
  3. Be cautious about changing this value in performance-critical scenarios, as it may impact rendering performance.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenVisualize.cpp:91

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarVisualizeLumenSceneSurfaceCacheFeedback(
	TEXT("r.Lumen.Visualize.SurfaceCacheFeedback"),
	1,
	TEXT("Whether visualization should write surface cache feedback requests into the feedback buffer."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

int32 GVisualizeLumenSceneTraceRadianceCache = 0;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenVisualize.cpp:90

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarVisualizeLumenSceneSurfaceCacheFeedback(
	TEXT("r.Lumen.Visualize.SurfaceCacheFeedback"),
	1,
	TEXT("Whether visualization should write surface cache feedback requests into the feedback buffer."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenVisualize.cpp:270

Scope (from outer to inner):

file
function     bool LumenVisualize::UseSurfaceCacheFeedback

Source code excerpt:

bool LumenVisualize::UseSurfaceCacheFeedback(const FEngineShowFlags& ShowFlags)
{
	return CVarVisualizeLumenSceneSurfaceCacheFeedback.GetValueOnRenderThread() != 0
		&& Lumen::ShouldVisualizeScene(ShowFlags);
}

BEGIN_SHADER_PARAMETER_STRUCT(FLumenVisualizeSceneSoftwareRayTracingParameters, )
	SHADER_PARAMETER_STRUCT_INCLUDE(LumenVisualize::FSceneParameters, CommonParameters)
	SHADER_PARAMETER(float, VisualizeStepFactor)