landscape.OverrideNonNaniteVirtualShadowMapConstantDepthBiasOverride

landscape.OverrideNonNaniteVirtualShadowMapConstantDepthBiasOverride

#Overview

name: landscape.OverrideNonNaniteVirtualShadowMapConstantDepthBiasOverride

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.OverrideNonNaniteVirtualShadowMapConstantDepthBiasOverride is to force override the landscape NonNaniteVirtualShadowMapConstantDepthBias property on all landscapes when its value is greater than 0.

This setting variable is primarily used in the rendering system, specifically for managing virtual shadow maps for non-Nanite landscapes in Unreal Engine 5.

The Unreal Engine subsystem that relies on this setting variable is the Landscape system, as evident from its usage in the LandscapeRender.cpp file.

The value of this variable is set through a console variable (cvar) using FAutoConsoleVariableRef. It’s initialized with a default value of -1.0f.

This variable interacts with the associated variable GLandscapeNonNaniteVirtualShadowMapConstantDepthBiasOverride. When the console variable is set to a value greater than 0, it overrides the VirtualShadowMapConstantDepthBias property for all landscapes.

Developers must be aware that:

  1. This is a cheat variable (ECVF_Cheat flag), meaning it’s intended for development and debugging purposes.
  2. Changing this value will trigger a render state invalidation, potentially impacting performance.
  3. It affects all landscapes globally when set.

Best practices when using this variable include:

  1. Use it only for debugging or fine-tuning shadow map behavior.
  2. Reset it to its default value (-1.0f) when not actively debugging to ensure normal landscape behavior.
  3. Be cautious when using it in production builds, as it’s marked as a cheat variable.

Regarding the associated variable GLandscapeNonNaniteVirtualShadowMapConstantDepthBiasOverride:

The purpose of this variable is to store the actual value used for overriding the NonNaniteVirtualShadowMapConstantDepthBias property on landscapes.

It’s used in the Landscape rendering system to adjust the constant depth bias for virtual shadow maps on non-Nanite landscapes.

The value of this variable is set through the console variable landscape.OverrideNonNaniteVirtualShadowMapConstantDepthBiasOverride.

It interacts directly with the VirtualShadowMapConstantDepthBias property of landscape components.

Developers should be aware that this variable directly affects shadow mapping for landscapes and can impact visual quality and performance.

Best practices for this variable include using it judiciously and in conjunction with visual inspection of the resulting shadows to achieve the desired shadow quality without introducing artifacts.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

float GLandscapeNonNaniteVirtualShadowMapConstantDepthBiasOverride = -1.f;
FAutoConsoleVariableRef CVarLandscapeNonNaniteVirtualShadowMapConstantDepthBiasOverrideOverride(
	TEXT("landscape.OverrideNonNaniteVirtualShadowMapConstantDepthBiasOverride"),
	GLandscapeNonNaniteVirtualShadowMapConstantDepthBiasOverride,
	TEXT("When > 0, force override the landscape NonNaniteVirtualShadowMapConstantDepthBias property on all landscapes"),
	FConsoleVariableDelegate::CreateStatic(&OnCVarNeedingRenderStateInvalidationChanged),
	ECVF_Cheat
);

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

float GLandscapeNonNaniteVirtualShadowMapConstantDepthBiasOverride = -1.f;
FAutoConsoleVariableRef CVarLandscapeNonNaniteVirtualShadowMapConstantDepthBiasOverrideOverride(
	TEXT("landscape.OverrideNonNaniteVirtualShadowMapConstantDepthBiasOverride"),
	GLandscapeNonNaniteVirtualShadowMapConstantDepthBiasOverride,
	TEXT("When > 0, force override the landscape NonNaniteVirtualShadowMapConstantDepthBias property on all landscapes"),
	FConsoleVariableDelegate::CreateStatic(&OnCVarNeedingRenderStateInvalidationChanged),
	ECVF_Cheat
);

float GLandscapeNonNaniteVirtualShadowMapInvalidationHeightErrorThresholdOverride = -1.f;

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

Scope (from outer to inner):

file
function     FLandscapeComponentSceneProxy::FLandscapeComponentSceneProxy

Source code excerpt:

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