landscape.OverrideLODBlendRange
landscape.OverrideLODBlendRange
#Overview
name: landscape.OverrideLODBlendRange
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
When > 0, force the LODBlendRange property on all landscapes
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of landscape.OverrideLODBlendRange is to override the LODBlendRange property for all landscapes in the Unreal Engine 5 rendering system. This setting variable is specifically used for controlling the Level of Detail (LOD) blending range in landscape rendering.
The Unreal Engine subsystem that relies on this setting variable is the Landscape module, particularly the landscape rendering system. This can be seen from the file location where the variable is defined and used: “Engine/Source/Runtime/Landscape/Private/LandscapeRender.cpp”.
The value of this variable is set through a console variable (CVar) system. It’s initialized to -1.f and can be changed at runtime using console commands.
This variable interacts with GLandscapeLODBlendRangeOverride, which is the actual float variable that stores the override value. The console variable (landscape.OverrideLODBlendRange) is linked to GLandscapeLODBlendRangeOverride, so they share the same value.
Developers must be aware that:
- This variable is marked as a cheat (ECVF_Cheat flag), indicating it should not be used in shipping builds.
- It only takes effect when its value is greater than 0.
- Changing this value will trigger a render state invalidation, which could impact performance if changed frequently.
Best practices when using this variable include:
- Use it primarily for debugging or testing purposes, not in production builds.
- Be cautious about performance impacts when changing this value at runtime.
- Consider the interaction with the landscape’s original LODBlendRange property.
Regarding GLandscapeLODBlendRangeOverride: The purpose of GLandscapeLODBlendRangeOverride is to store the actual override value for the landscape LOD blend range. It’s the backend variable that landscape.OverrideLODBlendRange controls.
This variable is used directly in the landscape rendering code, specifically in the FLandscapeComponentSceneProxy constructor, where it affects the calculation of InvLODBlendRange. When GLandscapeLODBlendRangeOverride is greater than 0, it takes precedence over the landscape’s original LODBlendRange property.
The value of GLandscapeLODBlendRangeOverride is set through the console variable system, linked to landscape.OverrideLODBlendRange.
Developers should be aware that in non-shipping builds, GLandscapeLODBlendRangeOverride is a mutable global variable, while in shipping builds, it’s defined as a constant with value -1.f, effectively disabling the override functionality.
Best practices for GLandscapeLODBlendRangeOverride align with those for landscape.OverrideLODBlendRange, as they are tightly coupled.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeRender.cpp:102
Scope: file
Source code excerpt:
float GLandscapeLODBlendRangeOverride = -1.f;
FAutoConsoleVariableRef CVarLandscapeLODBlendRangeOverride(
TEXT("landscape.OverrideLODBlendRange"),
GLandscapeLODBlendRangeOverride,
TEXT("When > 0, force the LODBlendRange property on all landscapes"),
FConsoleVariableDelegate::CreateStatic(&OnCVarNeedingRenderStateInvalidationChanged),
ECVF_Cheat
);
#Associated Variable and Callsites
This variable is associated with another variable named GLandscapeLODBlendRangeOverride
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeRender.cpp:100
Scope: file
Source code excerpt:
);
float GLandscapeLODBlendRangeOverride = -1.f;
FAutoConsoleVariableRef CVarLandscapeLODBlendRangeOverride(
TEXT("landscape.OverrideLODBlendRange"),
GLandscapeLODBlendRangeOverride,
TEXT("When > 0, force the LODBlendRange property on all landscapes"),
FConsoleVariableDelegate::CreateStatic(&OnCVarNeedingRenderStateInvalidationChanged),
ECVF_Cheat
);
float GLandscapeNonNaniteVirtualShadowMapConstantDepthBiasOverride = -1.f;
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeRender.cpp:136
Scope: file
Source code excerpt:
);
#else
constexpr float GLandscapeLODBlendRangeOverride = -1.f;
#endif // !UE_BUILD_SHIPPING
float GLandscapeLOD0DistributionScale = 1.f;
FAutoConsoleVariableRef CVarLandscapeLOD0DistributionScale(
TEXT("r.LandscapeLOD0DistributionScale"),
GLandscapeLOD0DistributionScale,
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeRender.cpp:1313
Scope (from outer to inner):
file
function FLandscapeComponentSceneProxy::FLandscapeComponentSceneProxy
Source code excerpt:
, LastLOD(MaxLOD)
, ComponentMaxExtend(0.0f)
, InvLODBlendRange(1.0f / FMath::Max(0.01f, GLandscapeLODBlendRangeOverride > 0.0f ? GLandscapeLODBlendRangeOverride : InComponent->GetLandscapeProxy()->LODBlendRange))
, NumSubsections(InComponent->NumSubsections)
, SubsectionSizeQuads(InComponent->SubsectionSizeQuads)
, SubsectionSizeVerts(InComponent->SubsectionSizeQuads + 1)
, ComponentSizeQuads(InComponent->ComponentSizeQuads)
, ComponentSizeVerts(InComponent->ComponentSizeQuads + 1)
, SectionBase(InComponent->GetSectionBase())