landscape.OverrideLODDistribution

landscape.OverrideLODDistribution

#Overview

name: landscape.OverrideLODDistribution

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.OverrideLODDistribution is to force override the landscape LODDistributionSetting property on all landscapes, ignoring the r.LandscapeLODDistributionScale setting. This variable is used for controlling the Level of Detail (LOD) distribution in the landscape rendering system.

This setting variable is primarily used by the Landscape rendering system within Unreal Engine 5. It’s part of the engine’s landscape rendering optimization features.

The value of this variable is set through the console variable system, as indicated by the FAutoConsoleVariableRef declaration. It can be changed at runtime using console commands or through configuration files.

The associated variable GLandscapeLODDistributionOverride directly interacts with landscape.OverrideLODDistribution. They share the same value, with GLandscapeLODDistributionOverride being the actual float variable used in the code.

Developers must be aware that:

  1. This variable is marked as a cheat (ECVF_Cheat flag), meaning it’s intended for debugging and testing purposes, not for use in shipping builds.
  2. Changing this value will trigger a render state invalidation, which can impact performance if done frequently.
  3. The default value is -1.f, which means the override is not active. Values greater than 0 will activate the override.

Best practices when using this variable include:

  1. Use it primarily for debugging and testing LOD distribution issues.
  2. Be cautious about using it in shipping builds, as it’s marked as a cheat variable.
  3. Be aware of the performance implications of changing this value frequently, due to render state invalidation.
  4. When activating the override, consider the impact on all landscapes in the scene, as it affects all of them globally.

Regarding the associated variable GLandscapeLODDistributionOverride: The purpose of GLandscapeLODDistributionOverride is to store the actual value used for overriding the LOD distribution setting. It’s a global float variable that directly influences the LOD distribution calculation in the landscape rendering system.

This variable is used within the Landscape module of Unreal Engine 5, specifically in the rendering code for landscape components.

The value is set through the console variable system and is accessed directly in the C++ code where LOD calculations are performed.

Developers should be aware that this variable directly affects the LOD distribution of all landscapes when its value is greater than 0. It can significantly impact the visual quality and performance of landscape rendering.

Best practices for GLandscapeLODDistributionOverride include:

  1. Use it judiciously, as it affects all landscapes globally.
  2. Monitor its impact on performance and visual quality when adjusting its value.
  3. Reset it to its default value (-1.f) when not actively debugging or testing to ensure normal LOD behavior.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

float GLandscapeLODDistributionOverride = -1.f;
FAutoConsoleVariableRef CVarLandscapeLODDistributionOverride(
	TEXT("landscape.OverrideLODDistribution"),
	GLandscapeLODDistributionOverride,
	TEXT("When > 0, force override the landscape LODDistributionSetting property on all landscapes, and ignore r.LandscapeLODDistributionScale"),
	FConsoleVariableDelegate::CreateStatic(&OnCVarNeedingRenderStateInvalidationChanged),
	ECVF_Cheat
);

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

float GLandscapeLODDistributionOverride = -1.f;
FAutoConsoleVariableRef CVarLandscapeLODDistributionOverride(
	TEXT("landscape.OverrideLODDistribution"),
	GLandscapeLODDistributionOverride,
	TEXT("When > 0, force override the landscape LODDistributionSetting property on all landscapes, and ignore r.LandscapeLODDistributionScale"),
	FConsoleVariableDelegate::CreateStatic(&OnCVarNeedingRenderStateInvalidationChanged),
	ECVF_Cheat
);

float GLandscapeLODBlendRangeOverride = -1.f;

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

Scope (from outer to inner):

file
function     FLandscapeComponentSceneProxy::FLandscapeComponentSceneProxy

Source code excerpt:

		LOD0Distribution = GLandscapeLOD0DistributionOverride;
	}
	if (GLandscapeLODDistributionOverride > 0.0)
	{
		LODDistribution = GLandscapeLODDistributionOverride;
	}
	if (GLandscapeNonNaniteVirtualShadowMapConstantDepthBiasOverride > 0.0)
	{
		VirtualShadowMapConstantDepthBias = GLandscapeNonNaniteVirtualShadowMapConstantDepthBiasOverride;
	}
	if (GLandscapeNonNaniteVirtualShadowMapInvalidationHeightErrorThresholdOverride > 0.0)