r.LumenScene.DumpStats

r.LumenScene.DumpStats

#Overview

name: r.LumenScene.DumpStats

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.DumpStats is to control the logging of Lumen scene statistics in the Unreal Engine 5 rendering system. It is specifically used for debugging and performance analysis of the Lumen global illumination system.

This setting variable is primarily used in the Lumen subsystem of Unreal Engine’s rendering module. Based on the callsites, it’s clear that this variable is utilized within the Lumen visualization and scene data components.

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 through console commands.

The associated variable GLumenSceneDumpStats interacts directly with r.LumenScene.DumpStats. They share the same value, with GLumenSceneDumpStats being the actual integer variable used in the C++ code to control the behavior.

Developers should be aware that:

  1. This variable is meant for debugging purposes and should not be left enabled in production builds.
  2. Different values trigger different levels of stat dumping:
    • 1: Logs general Lumen scene stats
    • 2: Dumps mesh distance field information
    • 3: Dumps LumenScene objects

Best practices when using this variable include:

  1. Use it sparingly and only when needed for debugging or performance analysis.
  2. Reset the value to 0 after gathering the required information to avoid unnecessary performance overhead.
  3. Be cautious when using it in large scenes, as dumping extensive stats could potentially cause performance issues.

Regarding the associated variable GLumenSceneDumpStats:

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

Scope: file

Source code excerpt:

int32 GLumenSceneDumpStats = 0;
FAutoConsoleVariableRef CVarLumenSceneDumpStats(
	TEXT("r.LumenScene.DumpStats"),
	GLumenSceneDumpStats,
	TEXT("Whether to log Lumen scene stats on the next frame. 2 - dump mesh DF. 3 - dump LumenScene objects."),
	ECVF_RenderThreadSafe
);

float GVisualizeLumenSceneCardInterpolateInfluenceRadius = 10.0f;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

int32 GLumenSceneDumpStats = 0;
FAutoConsoleVariableRef CVarLumenSceneDumpStats(
	TEXT("r.LumenScene.DumpStats"),
	GLumenSceneDumpStats,
	TEXT("Whether to log Lumen scene stats on the next frame. 2 - dump mesh DF. 3 - dump LumenScene objects."),
	ECVF_RenderThreadSafe
);

float GVisualizeLumenSceneCardInterpolateInfluenceRadius = 10.0f;
FAutoConsoleVariableRef CVarCardInterpolateInfluenceRadius(

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

Scope (from outer to inner):

file
function     void FDeferredShadingSceneRenderer::RenderLumenMiscVisualizations

Source code excerpt:

	RenderLumenRadiosityProbeVisualization(GraphBuilder, SceneTextures, FrameTemporaries);

	if (GLumenSceneDumpStats)
	{
		FLumenSceneData& LumenSceneData = *Scene->GetLumenSceneData(Views[0]);
		const FDistanceFieldSceneData& DistanceFieldSceneData = Scene->DistanceFieldSceneData;

		LumenSceneData.DumpStats(
			DistanceFieldSceneData,
			/*bDumpMeshDistanceFields*/ GLumenSceneDumpStats == 2,
			/*bDumpPrimitiveGroups*/ GLumenSceneDumpStats == 3);

		GLumenSceneDumpStats = 0;
	}
}

LumenRadianceCache::FRadianceCacheInputs GetFinalGatherRadianceCacheInputsForVisualize(const FViewInfo& View)
{
	if (GLumenIrradianceFieldGather)