landscape.AllowNonNaniteVirtualShadowMapInvalidation
landscape.AllowNonNaniteVirtualShadowMapInvalidation
#Overview
name: landscape.AllowNonNaniteVirtualShadowMapInvalidation
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
For non-Nanite landscape, cached virtual shadow map pages need to be invalidated when the vertex morphing introduces a height difference that is too large. This enables or disables this behavior entirely
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of landscape.AllowNonNaniteVirtualShadowMapInvalidation is to control the invalidation of cached virtual shadow map pages for non-Nanite landscapes in Unreal Engine 5. This setting is specifically related to the rendering system, particularly the shadow mapping for landscapes.
This setting variable is primarily used in the Landscape module of Unreal Engine 5, as evidenced by its location in the LandscapeRender.cpp file.
The value of this variable is set to true by default and can be modified at runtime through the console variable system. It is defined as a boolean value and is associated with the GLandscapeAllowNonNaniteVirtualShadowMapInvalidation variable.
The main interaction with this variable occurs in the FLandscapeComponentSceneProxy::ShouldInvalidateShadows function, where it’s used as one of the conditions to determine if shadows should be invalidated.
Developers must be aware that this variable only affects non-Nanite landscapes. When using Nanite, this setting has no effect. Additionally, it’s important to note that this setting is marked as render thread safe and scalable, meaning it can be safely changed at runtime and may affect performance.
Best practices when using this variable include:
- Only disable it if you’re experiencing performance issues related to shadow map invalidation on non-Nanite landscapes.
- Be aware that disabling this might lead to visual artifacts in shadows when landscape geometry changes significantly.
- Use in conjunction with the GLandscapeNonNaniteVirtualShadowMapInvalidationLODAttenuationExponent variable for fine-tuning the invalidation behavior.
Regarding the associated variable GLandscapeAllowNonNaniteVirtualShadowMapInvalidation:
The purpose of GLandscapeAllowNonNaniteVirtualShadowMapInvalidation is to serve as the internal representation of the landscape.AllowNonNaniteVirtualShadowMapInvalidation console variable.
This variable is used directly in the Landscape module’s rendering code, specifically in the FLandscapeComponentSceneProxy::ShouldInvalidateShadows function.
Its value is set by the console variable system when landscape.AllowNonNaniteVirtualShadowMapInvalidation is modified.
It interacts closely with other conditions in the ShouldInvalidateShadows function, such as the presence of WorldSpaceMipToMipMaxDeltas, the active state of Nanite, and the value of VirtualShadowMapInvalidationHeightErrorThreshold.
Developers should be aware that this is an internal variable and should not be modified directly in code. Instead, they should use the console variable landscape.AllowNonNaniteVirtualShadowMapInvalidation to control this behavior.
Best practices for this variable are the same as for the console variable it’s associated with, as they directly reflect each other’s state.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeRender.cpp:184
Scope: file
Source code excerpt:
bool GLandscapeAllowNonNaniteVirtualShadowMapInvalidation = true;
FAutoConsoleVariableRef CVarLandscapeAllowNonNaniteVirtualShadowMapInvalidation(
TEXT("landscape.AllowNonNaniteVirtualShadowMapInvalidation"),
GLandscapeAllowNonNaniteVirtualShadowMapInvalidation,
TEXT("For non-Nanite landscape, cached virtual shadow map pages need to be invalidated when the vertex morphing introduces a height difference that is too large. This enables or disables this behavior entirely"),
ECVF_RenderThreadSafe | ECVF_Scalability
);
float GLandscapeNonNaniteVirtualShadowMapInvalidationLODAttenuationExponent = 2.0f;
#Associated Variable and Callsites
This variable is associated with another variable named GLandscapeAllowNonNaniteVirtualShadowMapInvalidation
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeRender.cpp:182
Scope: file
Source code excerpt:
);
bool GLandscapeAllowNonNaniteVirtualShadowMapInvalidation = true;
FAutoConsoleVariableRef CVarLandscapeAllowNonNaniteVirtualShadowMapInvalidation(
TEXT("landscape.AllowNonNaniteVirtualShadowMapInvalidation"),
GLandscapeAllowNonNaniteVirtualShadowMapInvalidation,
TEXT("For non-Nanite landscape, cached virtual shadow map pages need to be invalidated when the vertex morphing introduces a height difference that is too large. This enables or disables this behavior entirely"),
ECVF_RenderThreadSafe | ECVF_Scalability
);
float GLandscapeNonNaniteVirtualShadowMapInvalidationLODAttenuationExponent = 2.0f;
FAutoConsoleVariableRef CVarLandscapeNonNaniteVirtualShadowMapInvalidationLODAttenuationExponent(
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeRender.cpp:4506
Scope (from outer to inner):
file
function bool FLandscapeComponentSceneProxy::ShouldInvalidateShadows
Source code excerpt:
{
if (WorldSpaceMipToMipMaxDeltas.IsEmpty() // Only apply if we have computed the error estimates
|| !GLandscapeAllowNonNaniteVirtualShadowMapInvalidation // Global switch
|| (bNaniteActive && InView.Family->EngineShowFlags.NaniteMeshes) // Only applies if Nanite is not active
|| (VirtualShadowMapInvalidationHeightErrorThreshold <= 0.0f)) // Only applies if the threshold is valid
{
return false;
}