sg.LandscapeQuality

sg.LandscapeQuality

#Overview

name: sg.LandscapeQuality

The value of this variable can be defined or overridden in .ini config files. 5 .ini config files referencing this setting variable.

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

It is referenced in 8 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of sg.LandscapeQuality is to control the quality level of landscape rendering in Unreal Engine 5. This setting variable is part of the scalability system, which allows developers to adjust various aspects of the game’s visual fidelity and performance.

The Unreal Engine subsystem that primarily relies on this setting variable is the Scalability system, which is part of the Engine module. It’s used to manage different quality presets for various graphical features, including landscape rendering.

The value of this variable is set through multiple mechanisms:

  1. It can be set via configuration files (INI files).
  2. It can be modified at runtime using console commands.
  3. It can be adjusted programmatically through the Scalability API.

The sg.LandscapeQuality variable interacts with several other variables in the scalability system, such as sg.FoliageQuality and sg.ShadingQuality. These variables collectively determine the overall visual quality of the game.

Developers should be aware that:

  1. This variable affects landscape rendering performance and visual quality.
  2. Changes to this variable will trigger callbacks that may affect other parts of the engine.
  3. The variable uses a range of 0 to 4, representing low, medium, high, epic, and cinematic quality levels respectively.

Best practices when using this variable include:

  1. Use it in conjunction with other scalability settings for consistent visual quality.
  2. Test performance impacts at different quality levels to find the right balance for your target hardware.
  3. Consider exposing this setting to end-users for performance optimization on different hardware configurations.

Regarding the associated variable CVarLandscapeQuality:

The purpose of CVarLandscapeQuality is to provide a console variable interface for the sg.LandscapeQuality setting. It allows for easy modification of the landscape quality setting through console commands or programmatically.

CVarLandscapeQuality is used internally by the Scalability system to manage and apply the landscape quality setting. It’s part of the Engine module and is closely tied to the overall scalability framework.

The value of CVarLandscapeQuality is set automatically by the Scalability system based on the sg.LandscapeQuality setting. It can also be modified directly, which will in turn update the sg.LandscapeQuality setting.

CVarLandscapeQuality interacts directly with sg.LandscapeQuality, and changes to one will affect the other. It’s also part of the broader set of scalability console variables that collectively control the game’s visual quality.

Developers should be aware that:

  1. Modifying CVarLandscapeQuality will trigger callbacks that may affect other parts of the engine.
  2. This variable uses the same 0-4 range as sg.LandscapeQuality.

Best practices when using CVarLandscapeQuality include:

  1. Use it for debugging or quick testing of different landscape quality levels.
  2. Be cautious when modifying it directly, as it may override user or system-defined settings.
  3. Consider using the higher-level Scalability API functions instead of modifying this variable directly in most cases.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseDeviceProfiles.ini:314, section: [IOS DeviceProfile]

Location: <Workspace>/Engine/Config/BaseDeviceProfiles.ini:838, section: [Android_Low DeviceProfile]

Location: <Workspace>/Engine/Config/BaseDeviceProfiles.ini:853, section: [Android_Mid DeviceProfile]

Location: <Workspace>/Engine/Config/BaseDeviceProfiles.ini:867, section: [Android_High DeviceProfile]

Location: <Workspace>/Engine/Config/BaseDeviceProfiles.ini:893, section: [Android_Vulkan_SM5 DeviceProfile]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scalability.cpp:108

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarLandscapeQuality(
	TEXT("sg.LandscapeQuality"),
	Scalability::DefaultQualityLevel,
	TEXT("Scalability quality state (internally used by scalability system, ini load/save or using SCALABILITY console command)\n")
	TEXT(" 0:low, 1:med, 2:high, 3:epic, 4:cinematic, default: 3"),
	ECVF_ScalabilityGroup | ECVF_Preview);

static TAutoConsoleVariable<int32> CVarViewDistanceQuality_NumLevels(

#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Private/Graph/Nodes/MovieGraphGlobalGameOverrides.cpp:40

Scope (from outer to inner):

file
function     void UMovieGraphGlobalGameOverridesNode::BuildNewProcessCommandLineArgsImpl

Source code excerpt:

		InOutDeviceProfileCvars.Add(FString::Format(TEXT("sg.FoliageQuality={0}"), {QualityLevels.FoliageQuality}));
		InOutDeviceProfileCvars.Add(FString::Format(TEXT("sg.ShadingQuality={0}"), {QualityLevels.ShadingQuality}));
		InOutDeviceProfileCvars.Add(FString::Format(TEXT("sg.LandscapeQuality={0}"), {QualityLevels.LandscapeQuality}));
	}

	if (bDisableTextureStreaming)
	{
		InOutDeviceProfileCvars.Add(TEXT("r.TextureStreaming=0"));
	}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scalability.cpp:1138

Scope (from outer to inner):

file
namespace    Scalability
function     void LoadState

Source code excerpt:

	GConfig->GetInt(Section, TEXT("sg.FoliageQuality"), State.FoliageQuality, IniName);
	GConfig->GetInt(Section, TEXT("sg.ShadingQuality"), State.ShadingQuality, IniName);
	GConfig->GetInt(Section, TEXT("sg.LandscapeQuality"), State.LandscapeQuality, IniName);

	// If possible apply immediately, else store in backup so we can re-apply later
	if (!GScalabilityUsingTemporaryQualityLevels)
	{
		SetQualityLevels(State);
	}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scalability.cpp:1172

Scope (from outer to inner):

file
namespace    Scalability
function     void SaveState

Source code excerpt:

	GConfig->SetInt(Section, TEXT("sg.FoliageQuality"), State.FoliageQuality, IniName);
	GConfig->SetInt(Section, TEXT("sg.ShadingQuality"), State.ShadingQuality, IniName);
	GConfig->SetInt(Section, TEXT("sg.LandscapeQuality"), State.LandscapeQuality, IniName);
}

void RecordQualityLevelsAnalytics(bool bAutoApplied)
{
	if( FEngineAnalytics::IsAvailable() )
	{

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scalability.cpp:107

Scope: file

Source code excerpt:

	ECVF_ScalabilityGroup | ECVF_Preview);

static TAutoConsoleVariable<int32> CVarLandscapeQuality(
	TEXT("sg.LandscapeQuality"),
	Scalability::DefaultQualityLevel,
	TEXT("Scalability quality state (internally used by scalability system, ini load/save or using SCALABILITY console command)\n")
	TEXT(" 0:low, 1:med, 2:high, 3:epic, 4:cinematic, default: 3"),
	ECVF_ScalabilityGroup | ECVF_Preview);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scalability.cpp:595

Scope (from outer to inner):

file
namespace    Scalability
function     void InitScalabilitySystem

Source code excerpt:

	CVarFoliageQuality.AsVariable()->SetOnChangedCallback(FConsoleVariableDelegate::CreateStatic(&OnChangeFoliageQuality));
	CVarShadingQuality.AsVariable()->SetOnChangedCallback(FConsoleVariableDelegate::CreateStatic(&OnChangeShadingQuality));
	CVarLandscapeQuality.AsVariable()->SetOnChangedCallback(FConsoleVariableDelegate::CreateStatic(&OnChangeLandscapeQuality));

#if WITH_EDITOR
	ScalabilityShaderPlatform = GMaxRHIShaderPlatform;
	bScalabilityShaderPlatformHasBeenChanged = false;
#endif
	// Set defaults

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scalability.cpp:897

Scope (from outer to inner):

file
namespace    Scalability
function     void SetQualityLevels

Source code excerpt:

		SetQualityLevelCVar(CVarFoliageQuality, ClampedLevels.FoliageQuality, GScalabilityQualityLevelsOverride.FoliageQuality, bForce);
		SetQualityLevelCVar(CVarShadingQuality, ClampedLevels.ShadingQuality, GScalabilityQualityLevelsOverride.ShadingQuality, bForce);
		SetQualityLevelCVar(CVarLandscapeQuality, ClampedLevels.LandscapeQuality, GScalabilityQualityLevelsOverride.LandscapeQuality, bForce);

		OnScalabilitySettingsChanged.Broadcast(ClampedLevels);
	}

#if WITH_EDITOR
	if (ScalabilityShaderPlatform != EShaderPlatform::SP_NumPlatforms)

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scalability.cpp:929

Scope (from outer to inner):

file
namespace    Scalability
function     FQualityLevels GetQualityLevels

Source code excerpt:

		Ret.FoliageQuality = CVarFoliageQuality.GetValueOnGameThread();
		Ret.ShadingQuality = CVarShadingQuality.GetValueOnGameThread();
		Ret.LandscapeQuality = CVarLandscapeQuality.GetValueOnGameThread();
	}
	else
	{
		Ret = GScalabilityBackupQualityLevels;
	}