r.LumenScene.SurfaceCache.MeshCardsMergedCardMinSurfaceArea

r.LumenScene.SurfaceCache.MeshCardsMergedCardMinSurfaceArea

#Overview

name: r.LumenScene.SurfaceCache.MeshCardsMergedCardMinSurfaceArea

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.MeshCardsMergedCardMinSurfaceArea is to set the minimum area threshold for spawning a merged card in the Lumen scene surface cache system. This setting is part of the Lumen global illumination system in Unreal Engine 5’s rendering subsystem.

This setting variable is primarily used by the Lumen rendering module, specifically in the mesh cards generation process for the Lumen scene surface cache. It’s part of the optimization strategy for Lumen’s global illumination calculations.

The value of this variable is set through the Unreal Engine console variable system. It’s initialized with a default value of 0.05f and can be modified at runtime.

The associated variable GLumenMeshCardsMergedCardMinSurfaceArea directly interacts with this console variable. They share the same value, with GLumenMeshCardsMergedCardMinSurfaceArea being the actual variable used in the rendering code.

Developers must be aware that changing this value affects the performance and quality trade-off in Lumen’s global illumination system. A higher value will result in fewer, larger merged cards, potentially improving performance at the cost of lighting detail. A lower value will create more, smaller cards, potentially increasing lighting detail but at a higher performance cost.

Best practices when using this variable include:

  1. Adjusting it based on the specific needs of your scene and target hardware.
  2. Testing thoroughly after changes, as it can impact both performance and visual quality.
  3. Considering it in conjunction with other Lumen settings for optimal results.

Regarding the associated variable GLumenMeshCardsMergedCardMinSurfaceArea:

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

Scope: file

Source code excerpt:

float GLumenMeshCardsMergedCardMinSurfaceArea = 0.05f;
FAutoConsoleVariableRef CVarLumenMeshCardsMergedCardMinSurfaceArea(
	TEXT("r.LumenScene.SurfaceCache.MeshCardsMergedCardMinSurfaceArea"),
	GLumenMeshCardsMergedCardMinSurfaceArea,
	TEXT("Minimum area to spawn a merged card."),
	FConsoleVariableDelegate::CreateLambda([](IConsoleVariable* InVariable)
	{
		FGlobalComponentRecreateRenderStateContext Context;
	}),

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

float GLumenMeshCardsMergedCardMinSurfaceArea = 0.05f;
FAutoConsoleVariableRef CVarLumenMeshCardsMergedCardMinSurfaceArea(
	TEXT("r.LumenScene.SurfaceCache.MeshCardsMergedCardMinSurfaceArea"),
	GLumenMeshCardsMergedCardMinSurfaceArea,
	TEXT("Minimum area to spawn a merged card."),
	FConsoleVariableDelegate::CreateLambda([](IConsoleVariable* InVariable)
	{
		FGlobalComponentRecreateRenderStateContext Context;
	}),
	ECVF_Scalability | ECVF_RenderThreadSafe

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

Scope (from outer to inner):

file
function     void BuildMeshCardsDataForMergedInstances

Source code excerpt:

		const float MergedFaceArea = MergedExtent.X * MergedExtent.Y * MergedExtent.Z;

		if (MergedMeshCards.InstanceCardAreaPerDirection[AxisAlignedDirectionIndex] > GLumenMeshCardsMergedCardMinSurfaceArea * MergedFaceArea)
		{
			AxisAlignedDirectionsToSpawnCards.Add(AxisAlignedDirectionIndex);
		}
	}

	if (MergedMeshCards.MergedBounds.IsValid && AxisAlignedDirectionsToSpawnCards.Num() > 0)