DefaultASTCQualityBySize
DefaultASTCQualityBySize
#Overview
name: DefaultASTCQualityBySize
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of DefaultASTCQualityBySize is to control the quality and size of ASTC (Adaptive Scalable Texture Compression) textures in Unreal Engine 5. It is used to set the default compression quality for ASTC textures, balancing between texture quality and file size.
This setting variable is primarily used by the texture compression system, specifically for ASTC texture compression. Based on the callsites, it is utilized in the DeveloperToolSettings module and the TextureFormatASTC and TextureFormatIntelISPCTexComp plugins.
The value of this variable is set in multiple places:
- It has a default value of 3 in the UCookerSettings constructor.
- It can be configured in the project settings under the CookerSettings category.
- It can be overridden via command-line arguments using “-astcqualitybysize=”.
The DefaultASTCQualityBySize interacts with other variables related to texture compression, such as DefaultASTCQualityBySpeed and DefaultASTCCompressor.
Developers must be aware that:
- The value range is from 0 to 4, where 0 represents the smallest file size (12x12 block size) and 4 represents the best quality (4x4 block size).
- Changes to this variable may require a restart of the editor to take effect, as indicated by the “ConfigRestartRequired = true” meta tag.
Best practices when using this variable include:
- Consider the target platform and device capabilities when setting the ASTC quality.
- Balance between texture quality and file size based on the project requirements.
- Test different settings to find the optimal balance for your specific use case.
- Be aware that higher quality settings may increase build times and final package size.
- Use project-specific overrides in the project settings rather than modifying engine defaults.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:3110, section: [/Script/UnrealEd.CookerSettings]
- INI Section:
/Script/UnrealEd.CookerSettings
- Raw value:
3
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Developer/DeveloperToolSettings/Classes/CookerSettings.h:178
Scope (from outer to inner):
file
class class UCookerSettings : public UDeveloperSettings
Source code excerpt:
/** Quality of 0 means smallest (12x12 block size), 4 means best (4x4 block size) */
UPROPERTY(GlobalConfig, EditAnywhere, Category = Textures, meta = (DisplayName = "ASTC Compression Quality vs Size (0-4, 0 is smallest)"))
int32 DefaultASTCQualityBySize;
/** Allows opening cooked assets in the editor */
UPROPERTY(GlobalConfig, EditAnywhere, Category = Textures, meta = (
ConsoleVariable = "cook.ASTCTextureCompressor", DisplayName = "ASTC Texture Compressor",
ToolTip = "which compressor to use for ASTC textures",
ConfigRestartRequired = true))
#Loc: <Workspace>/Engine/Source/Developer/DeveloperToolSettings/Private/CookerSettings.cpp:25
Scope (from outer to inner):
file
function UCookerSettings::UCookerSettings
Source code excerpt:
DefaultASTCQualityBySpeed = 2; // Medium preset
DefaultASTCQualityBySize = 3; // 6x6
{
static IConsoleVariable* ASTCTextureCompressorCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("cook.ASTCTextureCompressor"));
DefaultASTCCompressor = (ASTCTextureCompressorCVar && ASTCTextureCompressorCVar->GetInt() != 0) ? ETextureFormatASTCCompressor::Arm : ETextureFormatASTCCompressor::IntelISPC;
}
}
#Loc: <Workspace>/Engine/Source/Developer/TextureFormatASTC/Private/TextureFormatASTC.cpp:145
Scope (from outer to inner):
file
function static int32 GetDefaultCompressionBySizeValue
Source code excerpt:
{
// default of 0 == 12x12 ?
// BaseEngine.ini sets DefaultASTCQualityBySize to 3 == 6x6
auto GetCompressionModeValue = []() {
// start at default quality, then lookup in .ini file
int32 CompressionModeValue = 0;
GConfig->GetInt(TEXT("/Script/UnrealEd.CookerSettings"), TEXT("DefaultASTCQualityBySize"), CompressionModeValue, GEngineIni);
FParse::Value(FCommandLine::Get(), TEXT("-astcqualitybysize="), CompressionModeValue);
return FMath::Min<uint32>(CompressionModeValue, MAX_QUALITY_BY_SIZE);
};
#Loc: <Workspace>/Engine/Source/Developer/TextureFormatIntelISPCTexComp/Private/TextureFormatIntelISPCTexComp.cpp:430
Scope (from outer to inner):
file
function static uint16 GetDefaultCompressionBySizeValue
Source code excerpt:
{
// default of 0 == 12x12 ?
// BaseEngine.ini sets DefaultASTCQualityBySize to 3 == 6x6
auto GetCompressionModeValue = []() {
// start at default quality, then lookup in .ini file
int32 CompressionModeValue = 0;
GConfig->GetInt(TEXT("/Script/UnrealEd.CookerSettings"), TEXT("DefaultASTCQualityBySize"), CompressionModeValue, GEngineIni);
FParse::Value(FCommandLine::Get(), TEXT("-astcqualitybysize="), CompressionModeValue);
return FMath::Min<uint32>(CompressionModeValue, MAX_QUALITY_BY_SIZE);
};