Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Texture compression formats

From Resonite Wiki
(Redirected from Texture Compression Formats)

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

GPU-specific compression methods split the image into blocks (e.g. 4×4 pixels) and encode each one in a fixed amount of space (e.g. 64 bits for BC1), independent from any others. This means that every pixel can still be found in a predictable place in memory, which is necessary for rendering, but it prevents simpler images (e.g. fields of solid colors) from being compressed further like other formats can. To partially restore this ability, Crunch and LZMA compression can be applied to the BCn-compressed data to reduce the size of the downloaded file, though the VRAM usage will stay the same.

Crunch compression is a GPU-specific lossy format that discards data, reducing the file size at the cost of quality. The Non Perceptual variants try to minimize the difference in the linear color space instead of sRGB.[Citation needed]

LZMA compression is a lossless format, meaning no data is discarded during compression. The result is a slightly larger file than crunch, but the result is identical to if only BCn was applied. Note that even though LZMA is lossless, BCn is still 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 Channels Bits per pixel MB per 1K texture MB per 2K texture MB per 4K texture
RawRGBA RGBA 32 4 16 64
RawRGBAHalf RGBA (16-bit) 64 8 32 128
BC1 RGB 4 0.5 2 8
BC3 RGBA 8 1 4 16
BC3nm Normal map 8 1 4 16
BC4 R (16-bit) 4 0.5 2 8
BC6H RGB (16-bit) 8 1 4 16
BC7 RGBA 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 enable the IsNormalMap property and thus convert it 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 with the same VRAM usage as BC3, but takes significantly longer to encode due to its complexity. 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