r.LumenScene.VisualizePrimitiveGroups

r.LumenScene.VisualizePrimitiveGroups

#Overview

name: r.LumenScene.VisualizePrimitiveGroups

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.VisualizePrimitiveGroups is to enable visualization of Lumen GPU Scene Primitive Groups. This setting variable is part of the Lumen rendering system in Unreal Engine 5, which is responsible for dynamic global illumination and reflections.

This setting variable is primarily used in the Lumen subsystem of Unreal Engine’s rendering module. Based on the callsites, it’s specifically utilized in the LumenSceneGPUDrivenUpdate.cpp file, which suggests it’s involved in the GPU-driven updates of the Lumen scene.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 0, meaning the visualization is disabled by default.

The associated variable CVarLumenSceneVisualizePrimitiveGroups directly interacts with r.LumenScene.VisualizePrimitiveGroups. They share the same value and purpose.

Developers must be aware that:

  1. This is a visualization tool, not intended for use in final builds.
  2. Enabling this visualization may have performance implications, as it’s adding debug visualization overhead.
  3. It’s marked with ECVF_Scalability and ECVF_RenderThreadSafe flags, indicating it’s scalable and safe to change on the render thread.

Best practices when using this variable include:

  1. Use it only during development and debugging phases.
  2. Be mindful of potential performance impact when enabled.
  3. Disable it in release builds or when profiling performance unrelated to Lumen primitive groups.

Regarding the associated variable CVarLumenSceneVisualizePrimitiveGroups:

When this variable is set to a non-zero value, it enables shader printing for visualization, allocates space for a large number of debug lines, and sets up parameters for a visualization compute shader (FVisualizePrimitiveGroupsCS). This suggests that the visualization is quite detailed and may have a non-trivial performance cost.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneGPUDrivenUpdate.cpp:48

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarLumenSceneVisualizePrimitiveGroups(
	TEXT("r.LumenScene.VisualizePrimitiveGroups"),
	0,
	TEXT("Visualize Lumen GPU Scene Primitive Groups."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarOrthoLumenSceneMinCardResolution(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneGPUDrivenUpdate.cpp:47

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarLumenSceneVisualizePrimitiveGroups(
	TEXT("r.LumenScene.VisualizePrimitiveGroups"),
	0,
	TEXT("Visualize Lumen GPU Scene Primitive Groups."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneGPUDrivenUpdate.cpp:397

Scope (from outer to inner):

file
function     void LumenScene::GPUDrivenUpdate

Source code excerpt:

	}

	if (CVarLumenSceneVisualizePrimitiveGroups.GetValueOnRenderThread() != 0)
	{
		ShaderPrint::SetEnabled(true);
		ShaderPrint::RequestSpaceForLines(256 * 1024);

		FVisualizePrimitiveGroupsCS::FParameters* PassParameters = GraphBuilder.AllocParameters<FVisualizePrimitiveGroupsCS::FParameters>();
		ShaderPrint::SetParameters(GraphBuilder, Views[0].ShaderPrintData, PassParameters->ShaderPrintUniformBuffer);