landscape.OverrideNonNaniteVirtualShadowMapInvalidationHeightErrorThreshold

landscape.OverrideNonNaniteVirtualShadowMapInvalidationHeightErrorThreshold

#Overview

name: landscape.OverrideNonNaniteVirtualShadowMapInvalidationHeightErrorThreshold

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 landscape.OverrideNonNaniteVirtualShadowMapInvalidationHeightErrorThreshold is to control the invalidation threshold for non-Nanite virtual shadow maps in landscape rendering.

This setting variable is primarily used in the Landscape module of Unreal Engine 5, specifically in the rendering system for landscapes. It interacts with the virtual shadow map system, which is part of the engine’s advanced rendering capabilities.

The value of this variable is set through the console variable system in Unreal Engine. It’s defined as an FAutoConsoleVariableRef, which means it can be modified at runtime through console commands or configuration files.

The associated variable GLandscapeNonNaniteVirtualShadowMapInvalidationHeightErrorThresholdOverride is directly linked to this console variable. It’s initialized with a default value of -1.0f and is used to store the actual value set by the console variable.

Developers must be aware of the following when using this variable:

  1. The variable only takes effect when its value is greater than 0.
  2. When active, it overrides the NonNaniteVirtualShadowMapInvalidationHeightErrorThreshold property for all landscapes in the scene.
  3. It’s marked with ECVF_Cheat flag, indicating it’s intended for development and debugging purposes, not for use in shipping builds.

Best practices when using this variable include:

  1. Use it primarily for debugging and performance tuning of landscape shadow rendering.
  2. Be cautious when modifying this value in production environments, as it affects all landscapes globally.
  3. Reset the value to -1 (or below 0) when not actively debugging to ensure normal landscape behavior.

Regarding the associated variable GLandscapeNonNaniteVirtualShadowMapInvalidationHeightErrorThresholdOverride:

This is a float variable that directly stores the value set by the console variable. It’s used in the FLandscapeComponentSceneProxy constructor to override the VirtualShadowMapInvalidationHeightErrorThreshold when its value is greater than 0. This allows for runtime adjustment of the shadow map invalidation threshold, which can be useful for performance tuning and visual quality adjustments in different scenarios.

Developers should be aware that changes to this variable will affect all landscape components in the scene, potentially impacting rendering performance and shadow quality. It should be used judiciously and primarily for debugging and optimization purposes.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeRender.cpp:120

Scope: file

Source code excerpt:

float GLandscapeNonNaniteVirtualShadowMapInvalidationHeightErrorThresholdOverride = -1.f;
FAutoConsoleVariableRef CVarLandscapeNonNaniteVirtualShadowMapInvalidationHeightErrorThresholdOverride(
	TEXT("landscape.OverrideNonNaniteVirtualShadowMapInvalidationHeightErrorThreshold"),
	GLandscapeNonNaniteVirtualShadowMapInvalidationHeightErrorThresholdOverride,
	TEXT("When > 0, force override the landscape NonNaniteVirtualShadowMapInvalidationHeightErrorThreshold property on all landscapes"),
	FConsoleVariableDelegate::CreateStatic(&OnCVarNeedingRenderStateInvalidationChanged),
	ECVF_Cheat
);

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeRender.cpp:118

Scope: file

Source code excerpt:

);

float GLandscapeNonNaniteVirtualShadowMapInvalidationHeightErrorThresholdOverride = -1.f;
FAutoConsoleVariableRef CVarLandscapeNonNaniteVirtualShadowMapInvalidationHeightErrorThresholdOverride(
	TEXT("landscape.OverrideNonNaniteVirtualShadowMapInvalidationHeightErrorThreshold"),
	GLandscapeNonNaniteVirtualShadowMapInvalidationHeightErrorThresholdOverride,
	TEXT("When > 0, force override the landscape NonNaniteVirtualShadowMapInvalidationHeightErrorThreshold property on all landscapes"),
	FConsoleVariableDelegate::CreateStatic(&OnCVarNeedingRenderStateInvalidationChanged),
	ECVF_Cheat
);

float GLandscapeNonNaniteVirtualShadowMapInvalidationScreenSizeLimitOverride = -1.f;

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeRender.cpp:1449

Scope (from outer to inner):

file
function     FLandscapeComponentSceneProxy::FLandscapeComponentSceneProxy

Source code excerpt:

		VirtualShadowMapConstantDepthBias = GLandscapeNonNaniteVirtualShadowMapConstantDepthBiasOverride;
	}
	if (GLandscapeNonNaniteVirtualShadowMapInvalidationHeightErrorThresholdOverride > 0.0)
	{
		VirtualShadowMapInvalidationHeightErrorThreshold = GLandscapeNonNaniteVirtualShadowMapInvalidationHeightErrorThresholdOverride;
	}
	if (GLandscapeNonNaniteVirtualShadowMapInvalidationScreenSizeLimitOverride > 0.0)
	{
		NonNaniteVirtualShadowMapInvalidationScreenSizeLimit = GLandscapeNonNaniteVirtualShadowMapInvalidationScreenSizeLimitOverride;
	}