r.LandscapeLOD0DistributionScale

r.LandscapeLOD0DistributionScale

#Overview

name: r.LandscapeLOD0DistributionScale

This variable is created as a Console Variable (cvar).

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.LandscapeLOD0DistributionScale is to act as a multiplier for the landscape LOD0DistributionSetting property. This setting is used to control the distribution of Level of Detail (LOD) for landscape rendering in Unreal Engine 5.

Key points about r.LandscapeLOD0DistributionScale:

  1. Unreal Engine subsystem: This variable is primarily used in the Landscape rendering system.

  2. Value setting: The value is set through a console variable, allowing for runtime adjustment. It’s initialized with a default value of 1.0f.

  3. Interaction with other variables: It directly interacts with the LOD0DistributionSetting property of landscape components. The final LOD0 distribution value is calculated by multiplying these two values.

  4. Usage awareness: Developers should be aware that this variable affects the LOD distribution of landscapes, which can impact both visual quality and performance.

  5. Best practices:

    • Use this variable for fine-tuning landscape LOD behavior without modifying individual landscape components.
    • Consider performance implications when adjusting this value, as it affects draw distances and detail levels.
  6. Associated variable: GLandscapeLOD0DistributionScale is the internal global variable that stores the value set by r.LandscapeLOD0DistributionScale.

Regarding GLandscapeLOD0DistributionScale:

  1. Purpose: It’s the internal representation of r.LandscapeLOD0DistributionScale, used directly in the code to modify LOD calculations.

  2. Usage: It’s used in the FLandscapeComponentSceneProxy constructor to calculate the final LOD0 distribution value.

  3. Setting: Its value is set by the console variable system when r.LandscapeLOD0DistributionScale is modified.

  4. Best practices:

    • Don’t modify GLandscapeLOD0DistributionScale directly in code; use the r.LandscapeLOD0DistributionScale console variable instead.
    • When debugging landscape LOD issues, check both the console variable and this internal variable to ensure they match.

Both variables are crucial for fine-tuning landscape rendering performance and quality, allowing developers to adjust LOD distribution without modifying individual landscape components.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

float GLandscapeLOD0DistributionScale = 1.f;
FAutoConsoleVariableRef CVarLandscapeLOD0DistributionScale(
	TEXT("r.LandscapeLOD0DistributionScale"),
	GLandscapeLOD0DistributionScale,
	TEXT("Multiplier for the landscape LOD0DistributionSetting property"),
	FConsoleVariableDelegate::CreateStatic(&OnCVarNeedingRenderStateInvalidationChanged),
	ECVF_Scalability
);

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Classes/LandscapeProxy.h:490

Scope: file

Source code excerpt:

	FPerQualityLevelFloat ScalableLODDistributionSetting = 3.0f;

	/** Allows to specify LOD distribution settings per quality level. Using this will ignore the r.LandscapeLOD0DistributionScale CVar. */
	UPROPERTY(EditAnywhere, Category = "LOD Distribution", meta = (LandscapeInherited))
	bool bUseScalableLODSettings = false;

	/** This controls the area that blends LOD between neighboring sections. At 1.0 it blends across the entire section, and lower numbers reduce the blend region to be closer to the boundary. */
	UPROPERTY(EditAnywhere, Category = "LOD Distribution", meta = (DisplayName = "Blend Range", ClampMin = "0.01", ClampMax = "1.0", UIMin = "0.01", UIMax = "1.0", LandscapeInherited))
	float LODBlendRange = 1.0f;

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

Scope (from outer to inner):

file
function     static TArray<float> GetLODScreenSizeArray

Source code excerpt:

	else
	{
		static IConsoleVariable* CVarLSLOD0DistributionScale = IConsoleManager::Get().FindConsoleVariable(TEXT("r.LandscapeLOD0DistributionScale"));
		
		LOD0ScreenSize = InLandscapeProxy->LOD0ScreenSize;
		LOD0Distribution = InLandscapeProxy->LOD0DistributionSetting * CVarLSLOD0DistributionScale->GetFloat();
	}
	
	static TConsoleVariableData<float>* CVarSMLODDistanceScale = IConsoleManager::Get().FindTConsoleVariableDataFloat(TEXT("r.StaticMeshLODDistanceScale"));

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

#endif // !UE_BUILD_SHIPPING

float GLandscapeLOD0DistributionScale = 1.f;
FAutoConsoleVariableRef CVarLandscapeLOD0DistributionScale(
	TEXT("r.LandscapeLOD0DistributionScale"),
	GLandscapeLOD0DistributionScale,
	TEXT("Multiplier for the landscape LOD0DistributionSetting property"),
	FConsoleVariableDelegate::CreateStatic(&OnCVarNeedingRenderStateInvalidationChanged),
	ECVF_Scalability
);

float GLandscapeLODDistributionScale = 1.f;

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

Scope (from outer to inner):

file
function     FLandscapeComponentSceneProxy::FLandscapeComponentSceneProxy

Source code excerpt:

	{
		LOD0ScreenSize = Proxy->LOD0ScreenSize;
		LOD0Distribution = Proxy->LOD0DistributionSetting * GLandscapeLOD0DistributionScale;
		LODDistribution = Proxy->LODDistributionSetting * GLandscapeLODDistributionScale;
	}

#if !UE_BUILD_SHIPPING
	if (GLandscapeLOD0ScreenSizeOverride > 0.0)
	{