sg.TextureQuality

sg.TextureQuality

#Overview

name: sg.TextureQuality

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

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

It is referenced in 10 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of sg.TextureQuality is to control the quality level of textures in the Unreal Engine 5 rendering system. It is part of the scalability system, which allows developers to adjust various visual quality settings to optimize performance across different hardware configurations.

This setting variable is primarily used by the Unreal Engine’s rendering system and the scalability subsystem. It’s also utilized by the MovieRenderPipeline plugin for high-quality offline rendering.

The value of this variable is set through several means:

  1. It can be initialized with a default value (Scalability::DefaultQualityLevel).
  2. It can be loaded from configuration files (INI files).
  3. It can be set programmatically through the scalability system.
  4. It can be adjusted via console commands.

The sg.TextureQuality variable interacts with other scalability settings like sg.ReflectionQuality, sg.PostProcessQuality, sg.EffectsQuality, etc. These settings collectively define the overall visual quality of the game.

Developers should be aware that:

  1. This variable affects the game’s performance and visual quality.
  2. Changes to this variable trigger callbacks that may affect other systems.
  3. The value ranges from 0 (low) to 4 (cinematic), with 3 (epic) being the default.

Best practices when using this variable include:

  1. Provide user-facing options to adjust this setting for performance optimization.
  2. Consider hardware capabilities when setting default values.
  3. Test thoroughly across different quality levels to ensure visual consistency and performance.

Regarding the associated variable CVarTextureQuality:

Developers should treat CVarTextureQuality and sg.TextureQuality as two interfaces to the same underlying setting. When working directly with engine internals, CVarTextureQuality might be more appropriate, while sg.TextureQuality is typically used for external control (like console commands or config files).

#Setting Variables

#References In INI files

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

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

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

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

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

Location: <Workspace>/Projects/Lyra/Config/DefaultDeviceProfiles.ini:45, section: [Mobile DeviceProfile]

Location: <Workspace>/Projects/Lyra/Config/DefaultDeviceProfiles.ini:92, section: [IOS_Low DeviceProfile]

Location: <Workspace>/Projects/Lyra/Config/DefaultDeviceProfiles.ini:105, section: [IOS_Mid DeviceProfile]

Location: <Workspace>/Projects/Lyra/Config/DefaultDeviceProfiles.ini:132, section: [IOS_High DeviceProfile]

Location: <Workspace>/Projects/Lyra/Config/DefaultDeviceProfiles.ini:149, section: [IOS_Epic DeviceProfile]

Location: <Workspace>/Projects/Lyra/Config/DefaultDeviceProfiles.ini:505, section: [Android_Low DeviceProfile]

Location: <Workspace>/Projects/Lyra/Config/DefaultDeviceProfiles.ini:518, section: [Android_Mid DeviceProfile]

Location: <Workspace>/Projects/Lyra/Config/DefaultDeviceProfiles.ini:545, section: [Android_High DeviceProfile]

Location: <Workspace>/Projects/Lyra/Config/DefaultDeviceProfiles.ini:561, section: [Android_Epic 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:80

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarTextureQuality(
	TEXT("sg.TextureQuality"),
	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> CVarEffectsQuality(

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

Scope (from outer to inner):

file
function     void UMovieGraphGlobalGameOverridesNode::BuildNewProcessCommandLineArgsImpl

Source code excerpt:

		InOutDeviceProfileCvars.Add(FString::Format(TEXT("sg.ReflectionQuality={0}"), {QualityLevels.ReflectionQuality}));
		InOutDeviceProfileCvars.Add(FString::Format(TEXT("sg.PostProcessQuality={0}"), {QualityLevels.PostProcessQuality}));
		InOutDeviceProfileCvars.Add(FString::Format(TEXT("sg.TextureQuality={0}"), {QualityLevels.TextureQuality}));
		InOutDeviceProfileCvars.Add(FString::Format(TEXT("sg.EffectsQuality={0}"), {QualityLevels.EffectsQuality}));
		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}));
	}

#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Private/MoviePipelineGameOverrideSetting.cpp:168

Scope (from outer to inner):

file
function     void UMoviePipelineGameOverrideSetting::BuildNewProcessCommandLineArgsImpl

Source code excerpt:

		InOutDeviceProfileCvars.Add(TEXT("sg.ReflectionQuality=4"));
		InOutDeviceProfileCvars.Add(TEXT("sg.PostProcessQuality=4"));
		InOutDeviceProfileCvars.Add(TEXT("sg.TextureQuality=4"));
		InOutDeviceProfileCvars.Add(TEXT("sg.EffectsQuality=4"));
		InOutDeviceProfileCvars.Add(TEXT("sg.FoliageQuality=4"));
		InOutDeviceProfileCvars.Add(TEXT("sg.ShadingQuality=4"));
	}

	switch (TextureStreaming)

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

Scope (from outer to inner):

file
namespace    Scalability
function     void LoadState

Source code excerpt:

	GConfig->GetInt(Section, TEXT("sg.ReflectionQuality"), State.ReflectionQuality, IniName);
	GConfig->GetInt(Section, TEXT("sg.PostProcessQuality"), State.PostProcessQuality, IniName);
	GConfig->GetInt(Section, TEXT("sg.TextureQuality"), State.TextureQuality, IniName);
	GConfig->GetInt(Section, TEXT("sg.EffectsQuality"), State.EffectsQuality, IniName);
	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

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

Scope (from outer to inner):

file
namespace    Scalability
function     void SaveState

Source code excerpt:

	GConfig->SetInt(Section, TEXT("sg.ReflectionQuality"), State.ReflectionQuality, IniName);
	GConfig->SetInt(Section, TEXT("sg.PostProcessQuality"), State.PostProcessQuality, IniName);
	GConfig->SetInt(Section, TEXT("sg.TextureQuality"), State.TextureQuality, IniName);
	GConfig->SetInt(Section, TEXT("sg.EffectsQuality"), State.EffectsQuality, IniName);
	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);
}

#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/Settings/LyraSettingsLocal.cpp:274

Scope (from outer to inner):

file
namespace    LyraSettingsHelpers
function     void FillScalabilitySettingsFromDeviceProfile

Source code excerpt:

		Mode.bHasOverrides |= UDeviceProfileManager::GetScalabilityCVar(FString::Printf(TEXT("sg.ReflectionQuality%s"), *Suffix), Mode.Qualities.ReflectionQuality);
		Mode.bHasOverrides |= UDeviceProfileManager::GetScalabilityCVar(FString::Printf(TEXT("sg.PostProcessQuality%s"), *Suffix), Mode.Qualities.PostProcessQuality);
		Mode.bHasOverrides |= UDeviceProfileManager::GetScalabilityCVar(FString::Printf(TEXT("sg.TextureQuality%s"), *Suffix), Mode.Qualities.TextureQuality);
		Mode.bHasOverrides |= UDeviceProfileManager::GetScalabilityCVar(FString::Printf(TEXT("sg.EffectsQuality%s"), *Suffix), Mode.Qualities.EffectsQuality);
		Mode.bHasOverrides |= UDeviceProfileManager::GetScalabilityCVar(FString::Printf(TEXT("sg.FoliageQuality%s"), *Suffix), Mode.Qualities.FoliageQuality);
		Mode.bHasOverrides |= UDeviceProfileManager::GetScalabilityCVar(FString::Printf(TEXT("sg.ShadingQuality%s"), *Suffix), Mode.Qualities.ShadingQuality);
	}

	TMobileQualityWrapper<int32> OverallQualityLimits(-1, CVarMobileQualityLimits);

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	ECVF_ScalabilityGroup | ECVF_Preview);

static TAutoConsoleVariable<int32> CVarTextureQuality(
	TEXT("sg.TextureQuality"),
	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:591

Scope (from outer to inner):

file
namespace    Scalability
function     void InitScalabilitySystem

Source code excerpt:

	CVarReflectionQuality.AsVariable()->SetOnChangedCallback(FConsoleVariableDelegate::CreateStatic(&OnChangeReflectionQuality));
	CVarPostProcessQuality.AsVariable()->SetOnChangedCallback(FConsoleVariableDelegate::CreateStatic(&OnChangePostProcessQuality));
	CVarTextureQuality.AsVariable()->SetOnChangedCallback(FConsoleVariableDelegate::CreateStatic(&OnChangeTextureQuality));
	CVarEffectsQuality.AsVariable()->SetOnChangedCallback(FConsoleVariableDelegate::CreateStatic(&OnChangeEffectsQuality));
	CVarFoliageQuality.AsVariable()->SetOnChangedCallback(FConsoleVariableDelegate::CreateStatic(&OnChangeFoliageQuality));
	CVarShadingQuality.AsVariable()->SetOnChangedCallback(FConsoleVariableDelegate::CreateStatic(&OnChangeShadingQuality));
	CVarLandscapeQuality.AsVariable()->SetOnChangedCallback(FConsoleVariableDelegate::CreateStatic(&OnChangeLandscapeQuality));

#if WITH_EDITOR

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

Scope (from outer to inner):

file
namespace    Scalability
function     void SetQualityLevels

Source code excerpt:

		SetQualityLevelCVar(CVarReflectionQuality, ClampedLevels.ReflectionQuality, GScalabilityQualityLevelsOverride.ReflectionQuality, bForce);
		SetQualityLevelCVar(CVarPostProcessQuality, ClampedLevels.PostProcessQuality, GScalabilityQualityLevelsOverride.PostProcessQuality, bForce);
		SetQualityLevelCVar(CVarTextureQuality, ClampedLevels.TextureQuality, GScalabilityQualityLevelsOverride.TextureQuality, bForce);
		SetQualityLevelCVar(CVarEffectsQuality, ClampedLevels.EffectsQuality, GScalabilityQualityLevelsOverride.EffectsQuality, bForce);
		SetQualityLevelCVar(CVarFoliageQuality, ClampedLevels.FoliageQuality, GScalabilityQualityLevelsOverride.FoliageQuality, bForce);
		SetQualityLevelCVar(CVarShadingQuality, ClampedLevels.ShadingQuality, GScalabilityQualityLevelsOverride.ShadingQuality, bForce);
		SetQualityLevelCVar(CVarLandscapeQuality, ClampedLevels.LandscapeQuality, GScalabilityQualityLevelsOverride.LandscapeQuality, bForce);

		OnScalabilitySettingsChanged.Broadcast(ClampedLevels);

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

Scope (from outer to inner):

file
namespace    Scalability
function     FQualityLevels GetQualityLevels

Source code excerpt:

		Ret.ReflectionQuality = CVarReflectionQuality.GetValueOnGameThread();
		Ret.PostProcessQuality = CVarPostProcessQuality.GetValueOnGameThread();
		Ret.TextureQuality = CVarTextureQuality.GetValueOnGameThread();
		Ret.EffectsQuality = CVarEffectsQuality.GetValueOnGameThread();
		Ret.FoliageQuality = CVarFoliageQuality.GetValueOnGameThread();
		Ret.ShadingQuality = CVarShadingQuality.GetValueOnGameThread();
		Ret.LandscapeQuality = CVarLandscapeQuality.GetValueOnGameThread();
	}
	else