r.Shadow.Virtual.MarkPixelPages

r.Shadow.Virtual.MarkPixelPages

#Overview

name: r.Shadow.Virtual.MarkPixelPages

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.Shadow.Virtual.MarkPixelPages is to control the marking of pages in virtual shadow maps based on depth buffer pixels. This setting is primarily used for the virtual shadow mapping system in Unreal Engine’s rendering pipeline.

The variable is used in the rendering subsystem, specifically in the virtual shadow mapping module. It’s referenced in the VirtualShadowMapArray.cpp file, which is part of the Renderer module.

The value of this variable is set through the console variable system (CVarMarkPixelPages). It defaults to 1, meaning the feature is enabled by default.

This variable interacts closely with other virtual shadow mapping settings, such as CVarMarkPixelPagesMipModeLocal, which controls the mip mode for local lights.

Developers should be aware that:

  1. This setting affects performance and visual quality of virtual shadow maps.
  2. Disabling it (setting to 0) is primarily for profiling and debugging purposes.
  3. It’s part of a larger system of virtual shadow map optimizations and settings.

Best practices when using this variable include:

  1. Keep it enabled (1) for normal use cases to ensure proper shadow map generation.
  2. Only disable it temporarily for debugging or performance analysis.
  3. Consider its interaction with other virtual shadow map settings when tweaking performance.

Regarding the associated variable CVarMarkPixelPages:

The purpose of CVarMarkPixelPages is the same as r.Shadow.Virtual.MarkPixelPages, serving as the actual implementation of the console variable system for this setting.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VirtualShadowMaps/VirtualShadowMapArray.cpp:105

Scope: file

Source code excerpt:


TAutoConsoleVariable<int32> CVarMarkPixelPages(
	TEXT("r.Shadow.Virtual.MarkPixelPages"),
	1,
	TEXT("Marks pages in virtual shadow maps based on depth buffer pixels. Ability to disable is primarily for profiling and debugging."),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarMarkPixelPagesMipModeLocal(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VirtualShadowMaps/VirtualShadowMapArray.cpp:104

Scope: file

Source code excerpt:

);

TAutoConsoleVariable<int32> CVarMarkPixelPages(
	TEXT("r.Shadow.Virtual.MarkPixelPages"),
	1,
	TEXT("Marks pages in virtual shadow maps based on depth buffer pixels. Ability to disable is primarily for profiling and debugging."),
	ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VirtualShadowMaps/VirtualShadowMapArray.cpp:1464

Scope (from outer to inner):

file
function     void FVirtualShadowMapArray::BuildPageAllocations

Source code excerpt:


			// Mark pages based on projected depth buffer pixels
			if (CVarMarkPixelPages.GetValueOnRenderThread() != 0)
			{
				// It's currently safe to overlap these passes that all write to same page request flags
				FRDGBufferUAVRef PageRequestFlagsUAV = GraphBuilder.CreateUAV(PageRequestFlagsRDG, ERDGUnorderedAccessViewFlags::SkipBarrier);

				auto GeneratePageFlags = [&](const EVirtualShadowMapProjectionInputType InputType)
				{