DefaultASTCQualityBySpeed

DefaultASTCQualityBySpeed

#Overview

name: DefaultASTCQualityBySpeed

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 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of DefaultASTCQualityBySpeed is to control the quality versus speed trade-off for ASTC texture compression in Unreal Engine 5. ASTC (Adaptive Scalable Texture Compression) is a texture compression format, and this setting allows developers to balance between compression speed and resulting texture quality.

This setting variable is primarily used in the texture compression and cooking systems of Unreal Engine. It is referenced in the CookerSettings module and the TextureFormatASTC module, which are responsible for managing cooking settings and ASTC texture compression, respectively.

The value of this variable is initially set in the UCookerSettings constructor (CookerSettings.cpp) with a default value of 2, which represents a medium preset. However, it can be overridden by values specified in the engine configuration file (GEngineIni) or through command-line arguments.

DefaultASTCQualityBySpeed interacts closely with DefaultASTCQualityBySize, another setting that controls ASTC compression quality in terms of block size. Together, these variables provide fine-grained control over ASTC texture compression.

Developers should be aware that:

  1. The value range is 0-3, where 0 is the fastest but lowest quality, and 3 is the best quality but slowest.
  2. This setting affects the cooking process and can impact both build times and final texture quality in the game.
  3. The value can be overridden via command-line arguments, which is useful for build automation.

Best practices when using this variable include:

  1. Balance between quality and build time based on project needs. For rapid iteration, a lower value might be preferred, while for final builds, a higher quality setting could be used.
  2. Consider using different values for development and shipping builds.
  3. Test the visual impact of different settings on your specific textures, as the optimal value may vary depending on the nature of your game’s art assets.
  4. Use in conjunction with DefaultASTCQualityBySize to fine-tune texture compression for your project’s needs.
  5. Document the chosen setting in your project guidelines to ensure consistency across the development team.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:3109, section: [/Script/UnrealEd.CookerSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Developer/DeveloperToolSettings/Classes/CookerSettings.h:174

Scope (from outer to inner):

file
class        class UCookerSettings : public UDeveloperSettings

Source code excerpt:

	/** Quality of 0 means fastest, 3 means best quality */
	UPROPERTY(GlobalConfig, EditAnywhere, Category = Textures, meta = (DisplayName = "ASTC Compression Quality vs Speed (0-3, 0 is fastest)"))
	int32 DefaultASTCQualityBySpeed;

	/** 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 */

#Loc: <Workspace>/Engine/Source/Developer/DeveloperToolSettings/Private/CookerSettings.cpp:24

Scope (from outer to inner):

file
function     UCookerSettings::UCookerSettings

Source code excerpt:

	SectionName = TEXT("Cooker");
	
	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:182

Scope (from outer to inner):

file
function     static int32 GetDefaultCompressionBySpeedValue
lambda-function

Source code excerpt:

			// start at default quality, then lookup in .ini file
			int32 CompressionModeValue = 0;
			GConfig->GetInt(TEXT("/Script/UnrealEd.CookerSettings"), TEXT("DefaultASTCQualityBySpeed"), CompressionModeValue, GEngineIni);
	
			FParse::Value(FCommandLine::Get(), TEXT("-astcqualitybyspeed="), CompressionModeValue);
			
			return FMath::Min<uint32>(CompressionModeValue, MAX_QUALITY_BY_SPEED);
		};