Texture compression formats: Difference between revisions

From Resonite Wiki
formatting & word niceties
Corrected BC3nm information and added a reference
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Textures imported into Resonite will have BCn compression to them applied by default. While the defaults are fine in most cases, understanding each format can help you determine a better format for specific situations.
Textures imported into Resonite will have BCn compression to them applied by default. While the defaults are fine in most cases, understanding each format can help you determine a better format for specific situations.


Every compression format here can be found through the PreferredFormat option on [[StaticTexture2D (Component)|StaticTexture2D]].
Every compression format here can be found through the PreferredFormat option on the [[Component:StaticTexture2D|StaticTexture2D]] component.


== Difference between BCn_Crunched, BCn_Crunched_Non_Perceptual, and BCn_LZMA ==
== Difference between BCn_Crunched, BCn_Crunched_Non_Perceptual, and BCn_LZMA ==
Line 51: Line 51:
=== RawRGBAHalf ===
=== RawRGBAHalf ===


Uncompressed RGBA with a Half Precision Float per channel.
Uncompressed RGBA with [[Type:Half|half precision float]] values per channel.


Best used for high precision textures, such as normal maps or light cookies, but under the same caution as mentioned in RawRGBA. This format should not be used unless a texture is encoded with a higher bit depth.
Best used for high precision textures, such as normal maps or light cookies, but under the same caution as mentioned in RawRGBA. This format should not be used unless a texture is encoded with a higher bit depth.
Line 71: Line 71:
=== BC3nm ===
=== BC3nm ===


Compressed RGBA with 8 bits per channel. The red and green channel are swapped to the green and alpha channel respectively.
Compressed RGBA with 8 bits per channel. The red channel is swapped with the alpha channel, while the green channel is copied to the blue channel to [https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/5858#issuecomment-3535014744| achieve additional precision]. The red channel is cleared after channels are modified.


This format is for normal maps exclusively. Textures added to the <code>NormalMap</code> field on a material will automatically convert to BC3nm.
This format is for normal maps exclusively. Textures added to the <code>NormalMap</code> field on a material will automatically convert to BC3nm.


Normal Maps are more prone to visual artifacts caused by compression; this format helps to minimize that by shifting the data to the green and alpha channel, which are less compressed than the red and blue channel.
Normal Maps are more prone to visual artifacts caused by compression; this format helps to minimize that by organizing data so less data is discarded overall.
 
This format is exclusive to Resonite.


=== BC4 ===
=== BC4 ===
Line 85: Line 87:
=== BC6H ===
=== BC6H ===


Compressed RGB with [[Type:Half|half precision float]] values per channel.
Compressed RGB with half precision float values per channel.


This format is for HDR textures, reflection probes with HDR, Light Cookies, and high precision textures that do not require the alpha channel. Reflection probes with HDR enabled will bake textures into BC6H by default, but they may still be compressed to BC1 in darker scenes [https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/1851 due to a bug.]
This format is for HDR textures, reflection probes with HDR, Light Cookies, and high precision textures that do not require the alpha channel. Reflection probes with HDR enabled will bake textures into BC6H by default, but they may still be compressed to BC1 in darker scenes [https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/1851 due to a bug.]
Line 102: Line 104:
* https://www.reedbeta.com/blog/understanding-bcn-texture-compression-formats/
* https://www.reedbeta.com/blog/understanding-bcn-texture-compression-formats/
* https://en.wikipedia.org/wiki/S3_Texture_Compression
* https://en.wikipedia.org/wiki/S3_Texture_Compression
* http://wiki.polycount.com/wiki/DXT
* http://wiki.polycount.com/wiki/Normal_Map_Compression
* https://en.wikipedia.org/wiki/Ericsson_Texture_Compression
* https://en.wikipedia.org/wiki/Ericsson_Texture_Compression
* https://en.wikipedia.org/wiki/Adaptive_scalable_texture_compression
* https://en.wikipedia.org/wiki/Adaptive_scalable_texture_compression

Latest revision as of 23:41, 14 November 2025

Textures imported into Resonite will have BCn compression to them applied by default. While the defaults are fine in most cases, understanding each format can help you determine a better format for specific situations.

Every compression format here can be found through the PreferredFormat option on the StaticTexture2D component.

Difference between BCn_Crunched, BCn_Crunched_Non_Perceptual, and BCn_LZMA

Formats may be listed as BC3_Crunched or BC3_LZMA, this is a difference in the storage compression method.

BCn formats are a method of compression optimized for GPUs, not file size. Additional compression is applied on top of BCn compressed textures to save on file size.

Crunch compression is a lossy format that discards data to reduce the file size of textures (but not their VRAM usage) with a trade off of visual quality. The Non Perceptual variants are compressed without considering sRGB color space information.

LZMA compression is a lossless format, meaning no data is discarded during compression. The result is less file size reduction but visual quality is retained. Even though LZMA is lossless, BCn is lossy, so switching a texture to LZMA can only prevent quality loss caused by crunch compression.

Size comparison

The following table lists how many bits each format dedicates per pixel, as well as how much VRAM a 1024x1024, 2048x2048, and 4096x4096 texture would take up. Note that the actual size will be about 36% larger by default due to mipmaps (smaller versions of the texture for smoother rendering from far away).

Format Bits per pixel MB per 1K texture MB per 2k texture MB per 4k texture
RawRGBA 32 4 16 64
RawRGBAHalf 64 8 32 128
BC1 4 0.5 2 8
BC3 8 1 4 16
BC3nm 8 1 4 16
BC4 4 0.5 2 8
BC6H 8 1 4 16
BC7 8 1 4 16

Compression formats

RawRGBA

Uncompressed RGBA with 8 bits per channel.

Best used when compression significantly diminishes the quality of a texture (such as low-resolution images or very gradual gradients), but at a massive increase to file size and memory usage. RawRGBA should generally be avoided in favor of formats like BC7 for high quality compression.

Low-resolution textures, such as 128x128 or lower, may additionally benefit from RawRGBA as the cost of the BCn and file compression may outweigh the cost of the texture itself.

Images imported with the Pixel Art option have the Uncompressed checkbox toggled on in the texture component, which is equivalent to selecting this format.

RawRGBAHalf

Uncompressed RGBA with half precision float values per channel.

Best used for high precision textures, such as normal maps or light cookies, but under the same caution as mentioned in RawRGBA. This format should not be used unless a texture is encoded with a higher bit depth.

BC1

Compressed RGB with 8 bits per channel. Should be "good enough" for most albedo textures.

This is the default format used for textures without an alpha channel, and is a well-rounded format balancing speed and quality.

BC3

Compressed RGBA with 8 bits per channel.

This is the default format used for textures with an alpha channel, and like BC1, is a well-rounded format balancing speed and quality.

Although BC3 contains only 1 more channel than BC1, the memory usage will be double that of BC1. If a texture is BC3 but you are sure that it does not require the alpha channel, you can use the Remove Alpha option on the StaticTexture2D component.

BC3nm

Compressed RGBA with 8 bits per channel. The red channel is swapped with the alpha channel, while the green channel is copied to the blue channel to achieve additional precision. The red channel is cleared after channels are modified.

This format is for normal maps exclusively. Textures added to the NormalMap field on a material will automatically convert to BC3nm.

Normal Maps are more prone to visual artifacts caused by compression; this format helps to minimize that by organizing data so less data is discarded overall.

This format is exclusive to Resonite.

BC4

Compressed red channel with 16 bits.

Due to limitations with the existing shaders, BC4 is rarely practical. A shader would need texture fields that exclusively read data from the red channel, which currently only exists in PBS variants and Xiexe Toon due to inconsistencies in channel packing. See: Github bug #2218.

BC6H

Compressed RGB with half precision float values per channel.

This format is for HDR textures, reflection probes with HDR, Light Cookies, and high precision textures that do not require the alpha channel. Reflection probes with HDR enabled will bake textures into BC6H by default, but they may still be compressed to BC1 in darker scenes due to a bug.

BC7

Compressed RGBA with 8 bits per channel. Very high quality compression at equal VRAM usage compared to BC3, but takes significantly longer to encode. Use if you really need close-to-lossless quality compression or can spare the time waiting.

ETC2 & ASTC

Formats intended for mobile devices. While the option is available, these formats cannot be utilized as mobile platforms are currently not supported by Resonite.

References