r.Lumen.Reflections.VisualizeTracingCoherency

r.Lumen.Reflections.VisualizeTracingCoherency

#Overview

name: r.Lumen.Reflections.VisualizeTracingCoherency

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.VisualizeTracingCoherency is to provide a debugging tool for visualizing ray tracing coherency in Lumen’s reflection system. It allows developers to capture and display traces from a random wavefront on the screen, which can help in understanding and optimizing the reflection tracing process.

This setting variable is primarily used in the Lumen reflections subsystem of Unreal Engine’s rendering module. It is referenced in the LumenReflections.cpp file, which is part of the Renderer module.

The value of this variable is set through the Unreal Engine console or configuration files. It’s defined as an FAutoConsoleVariableRef, which means it can be changed at runtime.

The associated variable GLumenReflectionsVisualizeTracingCoherency interacts directly with r.Lumen.Reflections.VisualizeTracingCoherency. They share the same value, with GLumenReflectionsVisualizeTracingCoherency being the actual integer used in the code logic.

Developers must be aware of the following when using this variable:

  1. It’s a debugging tool and should be used primarily during development and optimization phases.
  2. Shaders must enable support for this feature first, as indicated by the comment referencing DEBUG_SUPPORT_VISUALIZE_TRACE_COHERENCY.
  3. Setting it to 1 initiates the capture, and setting it to 1 again will re-capture.

Best practices when using this variable include:

  1. Use it in conjunction with other Lumen debugging tools for a comprehensive understanding of the reflection system.
  2. Remember to disable it in release builds to avoid any potential performance impact.
  3. When analyzing results, consider the impact on performance and visual quality to make informed decisions about optimizations.

Regarding the associated variable GLumenReflectionsVisualizeTracingCoherency: The purpose of GLumenReflectionsVisualizeTracingCoherency is to serve as the internal representation of the r.Lumen.Reflections.VisualizeTracingCoherency console variable. It’s used directly in the C++ code to control the behavior of the visualization system.

This variable is used in the Lumen reflection system within the Renderer module. It’s set through the console variable system and is used to control the state of the visualization feature.

The value of GLumenReflectionsVisualizeTracingCoherency is set by the console variable system when r.Lumen.Reflections.VisualizeTracingCoherency is modified. It interacts with the VisualizeTraceCoherency parameter in the FLumenReflectionsVisualizeTracesParameters struct.

Developers should be aware that:

  1. The variable uses a state machine-like approach, where 1 initiates capture, 2 indicates capture is complete, and 0 disables the feature.
  2. It’s used to control both the capture and display of trace data.

Best practices for using GLumenReflectionsVisualizeTracingCoherency include:

  1. Use it in conjunction with the console variable rather than modifying it directly in code.
  2. Be mindful of its state when interpreting visualization results.
  3. Reset it to 0 when visualization is no longer needed to ensure it doesn’t affect performance in non-debugging scenarios.

#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:246

Scope: file

Source code excerpt:

int32 GLumenReflectionsVisualizeTracingCoherency = 0;
FAutoConsoleVariableRef GVarLumenReflectionsVisualizeTracingCoherency(
	TEXT("r.Lumen.Reflections.VisualizeTracingCoherency"),
	GLumenReflectionsVisualizeTracingCoherency,
	TEXT("Set to 1 to capture traces from a random wavefront and draw them on the screen. Set to 1 again to re-capture.  Shaders must enable support first, see DEBUG_SUPPORT_VISUALIZE_TRACE_COHERENCY"),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarLumenReflectionsAsyncCompute(

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	);

int32 GLumenReflectionsVisualizeTracingCoherency = 0;
FAutoConsoleVariableRef GVarLumenReflectionsVisualizeTracingCoherency(
	TEXT("r.Lumen.Reflections.VisualizeTracingCoherency"),
	GLumenReflectionsVisualizeTracingCoherency,
	TEXT("Set to 1 to capture traces from a random wavefront and draw them on the screen. Set to 1 again to re-capture.  Shaders must enable support first, see DEBUG_SUPPORT_VISUALIZE_TRACE_COHERENCY"),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarLumenReflectionsAsyncCompute(
	TEXT("r.Lumen.Reflections.AsyncCompute"),

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

Scope (from outer to inner):

file
function     FRDGBufferRef SetupVisualizeReflectionTraces

Source code excerpt:

	VisualizeTracesParameters.RWVisualizeTracesData = GraphBuilder.CreateUAV(VisualizeTracesData, PF_A32B32G32R32F);

	if (GLumenReflectionsVisualizeTracingCoherency == 1)
	{
		GLumenReflectionsVisualizeTracingCoherency = 2;
		VisualizeTracesParameters.VisualizeTraceCoherency = 1;
	}

	return VisualizeTracesData;
}

void GetReflectionsVisualizeTracesBuffer(TRefCountPtr<FRDGPooledBuffer>& VisualizeTracesData)
{
	if (GVisualizeReflectionTracesData.IsValid() && GLumenReflectionsVisualizeTracingCoherency != 0)
	{
		VisualizeTracesData = GVisualizeReflectionTracesData;
	}
}

// Must match usf RESOLVE_TILE_SIZE