sg.EffectsQuality.NumLevels
sg.EffectsQuality.NumLevels
#Overview
name: sg.EffectsQuality.NumLevels
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Number of settings quality levels in sg.EffectsQuality\n default: 5 (0..4)
It is referenced in 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of sg.EffectsQuality.NumLevels is to define the number of quality levels available for the effects system in Unreal Engine 5. This setting variable is part of the scalability system, which allows developers to adjust the visual quality and performance of their game across different hardware configurations.
Based on the Callsites section, this variable is primarily used within the Engine module, specifically in the Scalability namespace. It is referenced in the Scalability.cpp file, which is responsible for managing various quality settings in the engine.
The value of this variable is set using a TAutoConsoleVariable, which means it can be modified at runtime through console commands. By default, it is set to 5, providing 5 quality levels (0 to 4) for effects.
The associated variable CVarEffectsQuality_NumLevels directly interacts with sg.EffectsQuality.NumLevels. They share the same value and are used interchangeably in the code.
Developers should be aware that this variable affects the range of quality settings available for effects. It is used in various functions to clamp quality values and determine the maximum quality level for effects.
Best practices when using this variable include:
- Ensuring that any custom effects quality settings respect the range defined by this variable.
- Using the GetQualityLevelCounts() function to retrieve the current number of levels when needed, rather than hardcoding values.
- Being cautious when modifying this value, as it may affect existing quality presets and scalability settings.
Regarding the associated variable CVarEffectsQuality_NumLevels:
The purpose of CVarEffectsQuality_NumLevels is to provide a programmatic way to access the number of effects quality levels within C++ code. It serves as a console variable wrapper for sg.EffectsQuality.NumLevels.
This variable is used in various functions within the Scalability namespace, such as OnChangeEffectsQuality, SetFromSingleQualityLevel, and GetQualityLevelCounts. It’s primarily used to determine the upper bound when clamping quality settings and to retrieve the number of quality levels for effects.
The value of CVarEffectsQuality_NumLevels is set when the TAutoConsoleVariable is initialized, which occurs when the engine starts up. It shares the same value as sg.EffectsQuality.NumLevels.
Developers should be aware that changes to CVarEffectsQuality_NumLevels will directly affect the behavior of the scalability system for effects. It’s used in quality level calculations and validations throughout the Scalability namespace.
Best practices for using CVarEffectsQuality_NumLevels include:
- Using it consistently when working with effects quality levels in C++ code.
- Avoiding direct modification of this variable unless absolutely necessary, as it could lead to inconsistencies in the scalability system.
- Considering its value when implementing custom effects quality systems to maintain consistency with the engine’s scalability features.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scalability.cpp:164
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarEffectsQuality_NumLevels(
TEXT("sg.EffectsQuality.NumLevels"),
5,
TEXT("Number of settings quality levels in sg.EffectsQuality\n")
TEXT(" default: 5 (0..4)"),
ECVF_ReadOnly);
static TAutoConsoleVariable<int32> CVarFoliageQuality_NumLevels(
#Associated Variable and Callsites
This variable is associated with another variable named CVarEffectsQuality_NumLevels
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scalability.cpp:163
Scope: file
Source code excerpt:
ECVF_ReadOnly);
static TAutoConsoleVariable<int32> CVarEffectsQuality_NumLevels(
TEXT("sg.EffectsQuality.NumLevels"),
5,
TEXT("Number of settings quality levels in sg.EffectsQuality\n")
TEXT(" default: 5 (0..4)"),
ECVF_ReadOnly);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scalability.cpp:552
Scope (from outer to inner):
file
namespace Scalability
function void OnChangeEffectsQuality
Source code excerpt:
void OnChangeEffectsQuality(IConsoleVariable* Var)
{
SetGroupQualityLevel(TEXT("EffectsQuality"), Var->GetInt(), CVarEffectsQuality_NumLevels->GetInt());
}
void OnChangeFoliageQuality(IConsoleVariable* Var)
{
SetGroupQualityLevel(TEXT("FoliageQuality"), Var->GetInt(), CVarFoliageQuality_NumLevels->GetInt());
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scalability.cpp:997
Scope (from outer to inner):
file
namespace Scalability
function void FQualityLevels::SetFromSingleQualityLevel
Source code excerpt:
PostProcessQuality = FMath::Clamp(Value, 0, CVarPostProcessQuality_NumLevels->GetInt() - 1);
TextureQuality = FMath::Clamp(Value, 0, CVarTextureQuality_NumLevels->GetInt() - 1);
EffectsQuality = FMath::Clamp(Value, 0, CVarEffectsQuality_NumLevels->GetInt() - 1);
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)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scalability.cpp:1017
Scope (from outer to inner):
file
namespace Scalability
function void FQualityLevels::SetFromSingleQualityLevelRelativeToMax
Source code excerpt:
PostProcessQuality = FMath::Max(CVarPostProcessQuality_NumLevels->GetInt() - Value, 0);
TextureQuality = FMath::Max(CVarTextureQuality_NumLevels->GetInt() - Value, 0);
EffectsQuality = FMath::Max(CVarEffectsQuality_NumLevels->GetInt() - Value, 0);
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
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scalability.cpp:1096
Scope (from outer to inner):
file
namespace Scalability
function void FQualityLevels::SetEffectsQuality
Source code excerpt:
void FQualityLevels::SetEffectsQuality(int32 Value)
{
EffectsQuality = FMath::Clamp(Value, 0, CVarEffectsQuality_NumLevels->GetInt() - 1);
}
void FQualityLevels::SetFoliageQuality(int32 Value)
{
FoliageQuality = FMath::Clamp(Value, 0, CVarFoliageQuality_NumLevels->GetInt() - 1);
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scalability.cpp:1213
Scope (from outer to inner):
file
namespace Scalability
function FQualityLevels GetQualityLevelCounts
Source code excerpt:
Result.PostProcessQuality = CVarPostProcessQuality_NumLevels->GetInt();
Result.TextureQuality = CVarTextureQuality_NumLevels->GetInt();
Result.EffectsQuality = CVarEffectsQuality_NumLevels->GetInt();
Result.FoliageQuality = CVarFoliageQuality_NumLevels->GetInt();
Result.ShadingQuality = CVarShadingQuality_NumLevels->GetInt();
Result.LandscapeQuality = CVarLandscapeQuality_NumLevels->GetInt();
return Result;
}