sg.LandscapeQuality.NumLevels
sg.LandscapeQuality.NumLevels
#Overview
name: sg.LandscapeQuality.NumLevels
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Number of settings quality levels in sg.LandscapeQuality\n default: 5 (0..4)
It is referenced in 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of sg.LandscapeQuality.NumLevels is to define the number of quality levels available for landscape rendering in Unreal Engine 5. This setting is crucial for the engine’s scalability system, particularly for landscape rendering.
This setting variable is primarily used by the Scalability subsystem within Unreal Engine’s rendering module. It’s referenced in the Engine/Source/Runtime/Engine/Private/Scalability.cpp file, which handles various quality settings for different aspects of the engine.
The value of this variable is set as a console variable (CVar) with a default value of 5, meaning there are 5 quality levels (0 to 4) for landscape rendering by default. It’s defined as a read-only variable, which means it’s not intended to be changed at runtime.
The associated variable CVarLandscapeQuality_NumLevels directly interacts with sg.LandscapeQuality.NumLevels. They share the same value and purpose, with CVarLandscapeQuality_NumLevels being the actual C++ variable used in the engine code.
Developers must be aware that this variable defines the upper limit for landscape quality settings. When setting landscape quality levels in other parts of the engine or game code, values should always be clamped between 0 and (CVarLandscapeQuality_NumLevels->GetInt() - 1) to ensure they’re within the valid range.
Best practices when using this variable include:
- Always use the associated CVarLandscapeQuality_NumLevels->GetInt() when referencing the number of quality levels, rather than hardcoding the value.
- When setting landscape quality, use FMath::Clamp() to ensure the value is within the valid range.
- Be aware that changing this value could affect performance and visual quality across different hardware configurations.
Regarding the associated variable CVarLandscapeQuality_NumLevels:
The purpose of CVarLandscapeQuality_NumLevels is to provide a programmatic way to access the number of landscape quality levels within the C++ code of Unreal Engine.
This variable is used throughout the Scalability namespace in the Engine module, particularly in functions that handle setting and getting quality levels for various engine aspects, including landscape rendering.
The value of CVarLandscapeQuality_NumLevels is set when it’s defined, mirroring the value of sg.LandscapeQuality.NumLevels. It’s used in multiple functions within the Scalability namespace to clamp quality level values and calculate relative quality settings.
Other variables that interact with CVarLandscapeQuality_NumLevels include similar variables for other quality settings, such as CVarFoliageQuality_NumLevels and CVarShadingQuality_NumLevels.
Developers should be aware that this variable is read-only and should not be modified during runtime. It’s used to define the range of valid landscape quality settings throughout the engine.
Best practices for using CVarLandscapeQuality_NumLevels include always using GetInt() to access its value, and using it in conjunction with FMath::Clamp() when setting landscape quality levels to ensure values remain within the valid range.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scalability.cpp:185
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarLandscapeQuality_NumLevels(
TEXT("sg.LandscapeQuality.NumLevels"),
5,
TEXT("Number of settings quality levels in sg.LandscapeQuality\n")
TEXT(" default: 5 (0..4)"),
ECVF_ReadOnly);
namespace Scalability
#Associated Variable and Callsites
This variable is associated with another variable named CVarLandscapeQuality_NumLevels
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scalability.cpp:184
Scope: file
Source code excerpt:
ECVF_ReadOnly);
static TAutoConsoleVariable<int32> CVarLandscapeQuality_NumLevels(
TEXT("sg.LandscapeQuality.NumLevels"),
5,
TEXT("Number of settings quality levels in sg.LandscapeQuality\n")
TEXT(" default: 5 (0..4)"),
ECVF_ReadOnly);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scalability.cpp:567
Scope (from outer to inner):
file
namespace Scalability
function void OnChangeLandscapeQuality
Source code excerpt:
void OnChangeLandscapeQuality(IConsoleVariable* Var)
{
SetGroupQualityLevel(TEXT("LandscapeQuality"), Var->GetInt(), CVarLandscapeQuality_NumLevels->GetInt());
}
void InitScalabilitySystem()
{
// needed only once
{
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scalability.cpp:1000
Scope (from outer to inner):
file
namespace Scalability
function void FQualityLevels::SetFromSingleQualityLevel
Source code excerpt:
FoliageQuality = FMath::Clamp(Value, 0, CVarFoliageQuality_NumLevels->GetInt() - 1);
ShadingQuality = FMath::Clamp(Value, 0, CVarShadingQuality_NumLevels->GetInt() - 1);
LandscapeQuality = FMath::Clamp(Value, 0, CVarLandscapeQuality_NumLevels->GetInt() - 1);
}
void FQualityLevels::SetFromSingleQualityLevelRelativeToMax(int32 Value)
{
ResolutionQuality = GetRenderScaleLevelFromQualityLevel(Value, EQualityLevelBehavior::ERelativeToMax);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scalability.cpp:1020
Scope (from outer to inner):
file
namespace Scalability
function void FQualityLevels::SetFromSingleQualityLevelRelativeToMax
Source code excerpt:
FoliageQuality = FMath::Max(CVarFoliageQuality_NumLevels->GetInt() - Value, 0);
ShadingQuality = FMath::Max(CVarShadingQuality_NumLevels->GetInt() - Value, 0);
LandscapeQuality = FMath::Max(CVarLandscapeQuality_NumLevels->GetInt() - Value, 0);
}
// Returns the overall value if all settings are set to the same thing
// @param Value -1:custom 0:low, 1:medium, 2:high, 3:epic
int32 FQualityLevels::GetSingleQualityLevel() const
{
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scalability.cpp:1111
Scope (from outer to inner):
file
namespace Scalability
function void FQualityLevels::SetLandscapeQuality
Source code excerpt:
void FQualityLevels::SetLandscapeQuality(int32 Value)
{
LandscapeQuality = FMath::Clamp(Value, 0, CVarLandscapeQuality_NumLevels->GetInt() - 1);
}
void LoadState(const FString& IniName)
{
check(!IniName.IsEmpty());
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scalability.cpp:1216
Scope (from outer to inner):
file
namespace Scalability
function FQualityLevels GetQualityLevelCounts
Source code excerpt:
Result.FoliageQuality = CVarFoliageQuality_NumLevels->GetInt();
Result.ShadingQuality = CVarShadingQuality_NumLevels->GetInt();
Result.LandscapeQuality = CVarLandscapeQuality_NumLevels->GetInt();
return Result;
}
void LoadPlatformScalability(FString PlatformName)
{
}