r.LumenScene.SurfaceCache.MeshCardsDebugSingleCard

r.LumenScene.SurfaceCache.MeshCardsDebugSingleCard

#Overview

name: r.LumenScene.SurfaceCache.MeshCardsDebugSingleCard

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.SurfaceCache.MeshCardsDebugSingleCard is to facilitate debugging of the Lumen mesh card system by allowing developers to spawn only a specified card on a mesh.

This setting variable is primarily used in the Lumen rendering system, specifically in the mesh cards component of Lumen’s surface cache. It is part of Unreal Engine’s rendering module.

The value of this variable is set through the console variable system, as indicated by the FAutoConsoleVariableRef declaration. It can be changed at runtime using console commands.

The associated variable GLumenMeshCardsDebugSingleCard directly interacts with r.LumenScene.SurfaceCache.MeshCardsDebugSingleCard. They share the same value, with GLumenMeshCardsDebugSingleCard being the actual integer variable used in the code.

Developers must be aware that:

  1. This variable is intended for debugging purposes only and should not be used in production builds.
  2. When set to a non-negative value, it will cause only the specified card to be spawned, which can significantly alter the rendering output.
  3. Changing this value triggers a recreation of render states for global components, which can impact performance.

Best practices when using this variable include:

  1. Use it only during development and debugging phases.
  2. Reset it to -1 (default value) after debugging to restore normal mesh card behavior.
  3. Be prepared for potential performance impacts when changing this value, due to the render state recreation.

Regarding the associated variable GLumenMeshCardsDebugSingleCard:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenMeshCards.cpp:105

Scope: file

Source code excerpt:

int32 GLumenMeshCardsDebugSingleCard = -1;
FAutoConsoleVariableRef CVarLumenMeshCardsDebugSingleCard(
	TEXT("r.LumenScene.SurfaceCache.MeshCardsDebugSingleCard"),
	GLumenMeshCardsDebugSingleCard,
	TEXT("Spawn only a specified card on mesh. Useful for debugging."),
	FConsoleVariableDelegate::CreateLambda([](IConsoleVariable* InVariable)
	{
		FGlobalComponentRecreateRenderStateContext Context;
	}),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenMeshCards.cpp:103

Scope: file

Source code excerpt:

);

int32 GLumenMeshCardsDebugSingleCard = -1;
FAutoConsoleVariableRef CVarLumenMeshCardsDebugSingleCard(
	TEXT("r.LumenScene.SurfaceCache.MeshCardsDebugSingleCard"),
	GLumenMeshCardsDebugSingleCard,
	TEXT("Spawn only a specified card on mesh. Useful for debugging."),
	FConsoleVariableDelegate::CreateLambda([](IConsoleVariable* InVariable)
	{
		FGlobalComponentRecreateRenderStateContext Context;
	}),
	ECVF_RenderThreadSafe

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenMeshCards.cpp:840

Scope (from outer to inner):

file
function     bool MeshCardCullTest

Source code excerpt:

{
#if UE_BUILD_DEBUG || UE_BUILD_DEVELOPMENT
	if (GLumenMeshCardsDebugSingleCard >= 0)
	{
		return GLumenMeshCardsDebugSingleCard == CardIndex;
	}
#endif

	const FVector3f ScaledBoundsSize = 2.0f * CardBuildData.OBB.Extent * LocalToWorldScale;
	const float SurfaceArea = ScaledBoundsSize.X * ScaledBoundsSize.Y;
	const bool bCardPassedCulling = (!GLumenMeshCardsCullFaces || SurfaceArea > MinFaceSurfaceArea);