landscape.OverrideNonNaniteVirtualShadowMapInvalidationScreenSizeLimit

landscape.OverrideNonNaniteVirtualShadowMapInvalidationScreenSizeLimit

#Overview

name: landscape.OverrideNonNaniteVirtualShadowMapInvalidationScreenSizeLimit

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.OverrideNonNaniteVirtualShadowMapInvalidationScreenSizeLimit is to provide a way to force override the NonNaniteVirtualShadowMapInvalidationScreenSizeLimit property on all landscapes in the rendering system, specifically for Virtual Shadow Map (VSM) invalidation.

This setting variable is primarily used in the Landscape module of Unreal Engine 5, as evidenced by its implementation in the LandscapeRender.cpp file.

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 changed at runtime through console commands or configuration files.

The associated variable GLandscapeNonNaniteVirtualShadowMapInvalidationScreenSizeLimitOverride interacts directly with this setting. It holds the actual value that the setting represents.

Developers must be aware that:

  1. This variable is marked as a cheat (ECVF_Cheat flag), indicating it should not be used in shipping builds.
  2. It only takes effect when its value is greater than 0.
  3. Changing this value will trigger a render state invalidation, which could impact performance.

Best practices when using this variable include:

  1. Use it primarily for debugging or testing purposes, not in production builds.
  2. Be cautious about performance implications when changing this value, especially in complex scenes with many landscapes.
  3. Consider the interaction with Nanite, as this specifically affects non-Nanite landscapes.

Regarding the associated variable GLandscapeNonNaniteVirtualShadowMapInvalidationScreenSizeLimitOverride:

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

float GLandscapeNonNaniteVirtualShadowMapInvalidationScreenSizeLimitOverride = -1.f;
FAutoConsoleVariableRef CVarLandscapeNonNaniteVirtualShadowMapInvalidationScreenSizeLimitOverride(
	TEXT("landscape.OverrideNonNaniteVirtualShadowMapInvalidationScreenSizeLimit"),
	GLandscapeNonNaniteVirtualShadowMapInvalidationScreenSizeLimitOverride,
	TEXT("When > 0, force override the landscape NonNaniteVirtualShadowMapInvalidationScreenSizeLimit property on all landscapes"),
	FConsoleVariableDelegate::CreateStatic(&OnCVarNeedingRenderStateInvalidationChanged),
	ECVF_Cheat
);
#else

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

float GLandscapeNonNaniteVirtualShadowMapInvalidationScreenSizeLimitOverride = -1.f;
FAutoConsoleVariableRef CVarLandscapeNonNaniteVirtualShadowMapInvalidationScreenSizeLimitOverride(
	TEXT("landscape.OverrideNonNaniteVirtualShadowMapInvalidationScreenSizeLimit"),
	GLandscapeNonNaniteVirtualShadowMapInvalidationScreenSizeLimitOverride,
	TEXT("When > 0, force override the landscape NonNaniteVirtualShadowMapInvalidationScreenSizeLimit property on all landscapes"),
	FConsoleVariableDelegate::CreateStatic(&OnCVarNeedingRenderStateInvalidationChanged),
	ECVF_Cheat
);
#else
constexpr float GLandscapeLODBlendRangeOverride = -1.f;

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

Scope (from outer to inner):

file
function     FLandscapeComponentSceneProxy::FLandscapeComponentSceneProxy

Source code excerpt:

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

	// For the display name, some timing issues can lead to a temporarily invalid parent actor, so fallback to the parent actor's name if that's the case, no big deal : 
	const FString& LandscapeName = InComponent->GetLandscapeActor() ? InComponent->GetLandscapeActor()->GetName() : Proxy->GetName();
	const FString& ComponentName = InComponent->GetName();
	DebugName = FName(FString::Printf(TEXT(" Landscape: %s, Component: %s [%s]"), *ComponentName, *LandscapeName, *SectionBase.ToString()));