r.LumenScene.SurfaceCache.NaniteMultiView

r.LumenScene.SurfaceCache.NaniteMultiView

#Overview

name: r.LumenScene.SurfaceCache.NaniteMultiView

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.NaniteMultiView is to control the multi-view Lumen Nanite Card capture functionality for debugging purposes in the Lumen rendering system of Unreal Engine 5.

This setting variable is primarily used by the Lumen subsystem within the Renderer module of Unreal Engine 5. It specifically affects the Lumen Scene Surface Cache and Nanite rendering pipeline.

The value of this variable is set through a console command, as indicated by the TAutoConsoleVariable declaration. It is initialized with a default value of 1, meaning the multi-view Lumen Nanite Card capture is enabled by default.

The associated variable CVarLumenSceneSurfaceCacheNaniteMultiView interacts directly with this setting. They share the same value and are used interchangeably in the code.

Developers must be aware that changing this variable’s value will trigger a reset of the Lumen Surface Cache. This is implemented through a lambda function that calls Lumen::DebugResetSurfaceCache() whenever the console variable is modified.

Best practices when using this variable include:

  1. Use it primarily for debugging purposes, as indicated by its description.
  2. Be mindful that toggling this setting will reset the Lumen Surface Cache, which may impact performance temporarily.
  3. When disabling this feature (setting to 0), be prepared for potential changes in the rendering output, as it affects the Nanite Card capture process.

Regarding the associated variable CVarLumenSceneSurfaceCacheNaniteMultiView:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneRendering.cpp:193

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarLumenSceneSurfaceCacheNaniteMultiView(
	TEXT("r.LumenScene.SurfaceCache.NaniteMultiView"),
	1,
	TEXT("Toggle multi view Lumen Nanite Card capture for debugging."),
	FConsoleVariableDelegate::CreateLambda([](IConsoleVariable* InVariable)
		{
			Lumen::DebugResetSurfaceCache();
		}),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneRendering.cpp:192

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarLumenSceneSurfaceCacheNaniteMultiView(
	TEXT("r.LumenScene.SurfaceCache.NaniteMultiView"),
	1,
	TEXT("Toggle multi view Lumen Nanite Card capture for debugging."),
	FConsoleVariableDelegate::CreateLambda([](IConsoleVariable* InVariable)
		{
			Lumen::DebugResetSurfaceCache();

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneRendering.cpp:2335

Scope (from outer to inner):

file
function     void FDeferredShadingSceneRenderer::UpdateLumenScene

Source code excerpt:

				NaniteRenderer->ExtractResults( RasterResults );

				if (CVarLumenSceneSurfaceCacheNaniteMultiView.GetValueOnRenderThread() != 0)
				{
					Nanite::DrawLumenMeshCapturePass(
						GraphBuilder,
						*Scene,
						SharedView,
						TArrayView<const FCardPageRenderData>(CardPagesToRender),