r.Lumen.Visualize.CardGenerationCluster

r.Lumen.Visualize.CardGenerationCluster

#Overview

name: r.Lumen.Visualize.CardGenerationCluster

This variable is created as a Console Variable (cvar).

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Lumen.Visualize.CardGenerationCluster is to enable visualization of card generation clusters in Unreal Engine 5’s Lumen global illumination system. This setting variable is part of the rendering system, specifically the Lumen subsystem, which is responsible for real-time global illumination.

The Lumen subsystem within Unreal Engine’s rendering module relies on this setting variable. It is primarily used in the LumenVisualize.cpp file, which suggests its role in debugging and visualizing the Lumen system’s internals.

The value of this variable is set through the Unreal Engine console variable system. It is declared as an FAutoConsoleVariableRef, which means it can be modified at runtime through console commands or configuration files.

This variable interacts closely with GVisualizeLumenCardGenerationCluster, which is the associated C++ variable that stores the actual value. They share the same value, with the console variable acting as an interface to modify the C++ variable.

Developers must be aware that this is a visualization tool, primarily used for debugging and understanding the Lumen system’s card generation process. It should not be enabled in production builds or used for gameplay purposes.

Best practices when using this variable include:

  1. Use it only during development and debugging phases.
  2. Combine it with other Lumen visualization tools for a comprehensive understanding of the system.
  3. Be aware that enabling visualization may impact performance, so use it judiciously.

Regarding the associated variable GVisualizeLumenCardGenerationCluster:

The purpose of GVisualizeLumenCardGenerationCluster is to store the actual value that determines whether card generation cluster visualization is enabled.

This variable is used directly in the Lumen visualization code to control the rendering of card generation clusters. It’s checked in multiple places within the VisualizeCardGeneration function to determine if and how to visualize the clusters.

The value of this variable is set through the r.Lumen.Visualize.CardGenerationCluster console variable.

It interacts with other visualization variables like GVisualizeLumenCardGenerationSurfels and is often used in conjunction with them to provide a comprehensive visualization of the Lumen system.

Developers should be aware that this variable directly affects the visualization process and should be used carefully to avoid performance impacts in non-development scenarios.

Best practices for using this variable include:

  1. Use it in conjunction with other Lumen visualization tools for a complete picture of the system.
  2. Reset it to 0 when visualization is not needed to ensure optimal performance.
  3. Be aware of its impact on rendering performance when enabled.

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

Scope: file

Source code excerpt:

int32 GVisualizeLumenCardGenerationCluster = 0;
FAutoConsoleVariableRef CVarVisualizeLumenSceneCardGenerationCluster(
	TEXT("r.Lumen.Visualize.CardGenerationCluster"),
	GVisualizeLumenCardGenerationCluster,
	TEXT(""),
	ECVF_RenderThreadSafe
);

int32 GVisualizeLumenCardGenerationMaxSurfel = -1;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

int32 GVisualizeLumenCardGenerationCluster = 0;
FAutoConsoleVariableRef CVarVisualizeLumenSceneCardGenerationCluster(
	TEXT("r.Lumen.Visualize.CardGenerationCluster"),
	GVisualizeLumenCardGenerationCluster,
	TEXT(""),
	ECVF_RenderThreadSafe
);

int32 GVisualizeLumenCardGenerationMaxSurfel = -1;
FAutoConsoleVariableRef CVarVisualizeLumenSceneCardGenerationMaxSurfel(

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

Scope (from outer to inner):

file
function     void VisualizeCardGeneration

Source code excerpt:

{
	if (GVisualizeLumenCardGenerationSurfels == 0 
		&& GVisualizeLumenCardGenerationCluster == 0)
	{
		return;
	}

	// VisualizeCardGeneration runs before LumenSceneUpdate and LumenScene may contain deleted proxies
	if (LumenSceneData.PendingRemoveOperations.Num() > 0)

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

Scope (from outer to inner):

file
function     void VisualizeCardGeneration

Source code excerpt:


						if (GVisualizeLumenCardGenerationSurfels == 0
							&& GVisualizeLumenCardGenerationCluster != 0
							&& PrimitiveGroup.MeshCardsIndex >= 0)
						{
							const FLumenMeshCards& MeshCardsEntry = LumenSceneData.MeshCards[PrimitiveGroup.MeshCardsIndex];
							for (uint32 CardIndex = MeshCardsEntry.FirstCardIndex; CardIndex < MeshCardsEntry.FirstCardIndex + MeshCardsEntry.NumCards; ++CardIndex)
							{
								const FLumenCard& Card = LumenSceneData.Cards[CardIndex];

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

Scope (from outer to inner):

file
function     void FDeferredShadingSceneRenderer::LumenScenePDIVisualization

Source code excerpt:

		if (GVisualizeLumenCardPlacement != 0
			|| GVisualizeLumenRayTracingGroups != 0
			|| GVisualizeLumenCardGenerationCluster != 0
			|| GVisualizeLumenCardGenerationSurfels != 0)
		{
			FViewElementPDI ViewPDI(&Views[0], nullptr, &Views[0].DynamicPrimitiveCollector);
			VisualizeRayTracingGroups(Views[0], LumenSceneData, ViewPDI);
			VisualizeCardPlacement(Allocator, Views[0], LumenSceneData, ViewPDI);
			VisualizeCardGeneration(Allocator, Views[0], LumenSceneData, ViewPDI);