landscape.OverrideLOD0ScreenSize

landscape.OverrideLOD0ScreenSize

#Overview

name: landscape.OverrideLOD0ScreenSize

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.OverrideLOD0ScreenSize is to force override the landscape LOD0ScreenSize property on all landscapes when its value is greater than 0. This setting variable is primarily used for the landscape rendering system in Unreal Engine 5.

This setting variable is relied upon by the Landscape module in Unreal Engine 5. It is specifically used in the LandscapeRender.cpp file, which is part of the Landscape rendering system.

The value of this variable is set through the console variable system. It is defined as an FAutoConsoleVariableRef, which means it can be changed at runtime through console commands or configuration files.

The associated variable GLandscapeLOD0ScreenSizeOverride interacts directly with landscape.OverrideLOD0ScreenSize. They share the same value, and GLandscapeLOD0ScreenSizeOverride is used in the actual code logic to override the LOD0ScreenSize.

Developers must be aware of several special considerations when using this variable:

  1. It’s marked as a cheat variable (ECVF_Cheat), indicating it should not be used in shipping builds.
  2. It’s only active in non-shipping builds (#if !UE_BUILD_SHIPPING).
  3. When set to a value greater than 0, it will override the LOD0ScreenSize for all landscapes, potentially affecting performance and visual quality.

Best practices when using this variable include:

  1. Use it only for debugging or testing purposes, not in production builds.
  2. Be cautious when setting values, as it affects all landscapes and may have performance implications.
  3. Reset the value to -1 (or below 0) when not needed to ensure normal LOD behavior.

Regarding the associated variable GLandscapeLOD0ScreenSizeOverride:

The purpose of GLandscapeLOD0ScreenSizeOverride is to store the actual value used to override the LOD0ScreenSize for landscapes. It’s initialized to -1.f, which means no override by default.

This variable is used directly in the LandscapeRender.cpp file, specifically in the FLandscapeComponentSceneProxy constructor. When its value is greater than 0, it overrides the calculated LOD0ScreenSize for the landscape component.

The value of GLandscapeLOD0ScreenSizeOverride is set through the console variable system, sharing the same value as landscape.OverrideLOD0ScreenSize.

Developers should be aware that this variable is only used in non-shipping builds and directly affects the LOD calculation for landscape components. It should be used carefully and primarily for debugging or testing purposes.

Best practices for GLandscapeLOD0ScreenSizeOverride align with those of landscape.OverrideLOD0ScreenSize, as they are essentially two sides of the same functionality.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

float GLandscapeLOD0ScreenSizeOverride = -1.f;
FAutoConsoleVariableRef CVarLandscapeLOD0ScreenSizeOverride(
	TEXT("landscape.OverrideLOD0ScreenSize"),
	GLandscapeLOD0ScreenSizeOverride,
	TEXT("When > 0, force override the landscape LOD0ScreenSize property on all landscapes"),
	FConsoleVariableDelegate::CreateStatic(&OnCVarNeedingRenderStateInvalidationChanged),
	ECVF_Cheat
);

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:


#if !UE_BUILD_SHIPPING
float GLandscapeLOD0ScreenSizeOverride = -1.f;
FAutoConsoleVariableRef CVarLandscapeLOD0ScreenSizeOverride(
	TEXT("landscape.OverrideLOD0ScreenSize"),
	GLandscapeLOD0ScreenSizeOverride,
	TEXT("When > 0, force override the landscape LOD0ScreenSize property on all landscapes"),
	FConsoleVariableDelegate::CreateStatic(&OnCVarNeedingRenderStateInvalidationChanged),
	ECVF_Cheat
);

float GLandscapeLOD0DistributionOverride = -1.f;

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

Scope (from outer to inner):

file
function     FLandscapeComponentSceneProxy::FLandscapeComponentSceneProxy

Source code excerpt:


#if !UE_BUILD_SHIPPING
	if (GLandscapeLOD0ScreenSizeOverride > 0.0)
	{
		LOD0ScreenSize = GLandscapeLOD0ScreenSizeOverride;
	}
	if (GLandscapeLOD0DistributionOverride > 0.0)
	{
		LOD0Distribution = GLandscapeLOD0DistributionOverride;
	}
	if (GLandscapeLODDistributionOverride > 0.0)