CompressedFormatForFloatTextures

CompressedFormatForFloatTextures

#Overview

name: CompressedFormatForFloatTextures

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 CompressedFormatForFloatTextures is to determine the compression format used for newly imported floating-point textures in Unreal Engine 5. This setting variable is part of the texture import and compression system.

This setting variable is primarily used by the TextureUtilitiesCommon module, which is responsible for handling texture import and processing operations. It is specifically utilized in the ApplyDefaultsForNewlyImportedTextures function within this module.

The value of this variable is set in the UTextureImportSettings class, which is derived from UDeveloperSettings. This suggests that the value can be configured through the project settings in the Unreal Engine editor.

CompressedFormatForFloatTextures interacts with the Texture->CompressionSettings property of imported textures. Depending on the chosen format, it affects how HDR (High Dynamic Range) textures are compressed and stored.

Developers must be aware that this setting only applies to newly imported textures and does not affect existing textures in the project. It’s crucial to understand the implications of each compression format on texture quality and performance.

Best practices when using this variable include:

  1. Choose the appropriate format based on the project’s requirements for image quality and performance.
  2. Consider using HDRCompressed_BC6 (BC6H) for better compression while maintaining high quality for HDR textures.
  3. Use HDR_F32_or_F16 when you need to preserve the original precision of the source texture.
  4. Opt for HDR_F16 if you want to maintain compatibility with legacy behavior or when working with older projects.
  5. Be consistent in your choice across the project to ensure uniform texture quality and performance.
  6. Regularly review and update this setting as the project evolves and requirements change.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditor.ini:653, section: [/Script/TextureUtilitiesCommon.TextureImportSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/TextureUtilitiesCommon/Private/TextureImportSettings.cpp:106

Scope (from outer to inner):

file
namespace    UE::TextureUtilitiesCommon
function     void ApplyDefaultsForNewlyImportedTextures

Source code excerpt:

		if ( Texture->CompressionSettings == TC_HDR )
		{
			if ( Settings->CompressedFormatForFloatTextures == ETextureImportFloatingPointFormat::HDRCompressed_BC6 )
			{
				// use BC6H
				Texture->CompressionSettings = TC_HDR_Compressed;
			}
			else if ( Settings->CompressedFormatForFloatTextures == ETextureImportFloatingPointFormat::HDR_F32_or_F16 )
			{
				// set output format to match source format
				ETextureSourceFormat TSF = Texture->Source.GetFormat();
				if ( TSF == TSF_RGBA32F )
				{
					Texture->CompressionSettings = 	TC_HDR_F32;	

#Loc: <Workspace>/Engine/Source/Runtime/TextureUtilitiesCommon/Private/TextureImportSettings.cpp:133

Scope (from outer to inner):

file
namespace    UE::TextureUtilitiesCommon
function     void ApplyDefaultsForNewlyImportedTextures

Source code excerpt:

				}
			}
			else if ( Settings->CompressedFormatForFloatTextures == ETextureImportFloatingPointFormat::HDR_F16 )
			{
				// always use F16 HDR (legacy behavior)
				// leave TC_HDR
				check( Texture->CompressionSettings == TC_HDR );
			}
			else

#Loc: <Workspace>/Engine/Source/Runtime/TextureUtilitiesCommon/Public/TextureImportSettings.h:72

Scope (from outer to inner):

file
class        class UTextureImportSettings : public UDeveloperSettings

Source code excerpt:

		DisplayName = "CompressionFormat to use for new float textures",
		ToolTip = "Optionally use HDRCompressed (BC6H), or 32-bit adaptively, instead of HDR (RGBA16F) for floating point textures.  This setting is applied to newly imported textures, it does not affect existing textures in the project."))
	ETextureImportFloatingPointFormat CompressedFormatForFloatTextures = ETextureImportFloatingPointFormat::PreviousDefault;
	
	UPROPERTY(config, EditAnywhere, Category=ImportSettings, meta = (
		DisplayName = "When to infill RGB in transparent white PNG",
		ToolTip = "Default behavior is to infill only for binary transparency; this setting may change that to always or never.  Will check TextureImporter/FillPNGZeroAlpha if this is not changed from Default.  This setting is applied to newly imported textures, it does not affect existing textures in the project."))
	ETextureImportPNGInfill PNGInfill = ETextureImportPNGInfill::Default;