Search Unity

Updated Crunch texture compression library

November 15, 2017 in Technology | 4 min. read
Share

Is this article helpful for you?

Thank you for your feedback!

Crunch is a lossy texture compression format, which is normally used on top of DXT texture compression. Crunch compression helps to reduce the size of the textures in order to use less disk space and to speed up downloads. The original Crunch compression library, maintained by Binominal, is available on GitHub. Support for Crunch texture format was first added in Unity 5.3. In Unity 2017.3, we are introducing an updated version of the Crunch compression library.

Textures compressed with Crunch are first decompressed to DXT and then uploaded to the GPU at runtime. Crunched textures not only use less space, but they can be also decompressed really fast. This makes the Crunch format very efficient for distributing textures. At the same time, Crunched textures can take quite a lot of time to compress, which is a major drawback when using Crunch (for a big project, compression of all the textures into Crunch format can take several hours in the Editor).

The updated Crunch library, introduced in Unity 2017.3, can compress DXT textures up to 2.5 times faster, while providing about 10% better compression ratio. But more importantly, the updated library is now capable of compressing ETC_RGB4 and ETC2_RGBA8 textures, which makes it possible to use Crunch compression on iOS and Android devices. This should help you reduce the build sizes of your mobile games, and thus make it easier to comply with App Store over-the-air size limitations, ultimately letting you reach a wider audience for your content.

In order to use Crunch compression on Android, iOS and tvOS platforms, you can now select either “RGB Crunched ETC” or “RGBA Crunched ETC2” format for your textures in the inspector window. If you enable the “Use Crunch Compression” option in the Default tab, all the textures on Android platform will be compressed with ETC Crunch by default.

In the near future, the Crunch compression library will be improved even further. The latest version of the library, which will reach Beta builds soon, will be able to perform Crunch compression of DXT textures about 5 times faster than the original version, and speed up Crunch compression of ETC textures about 1.3 times. The latest version of the Crunch library can be found in the following GitHub repository: https://github.com/Unity-Technologies/crunch/tree/unity (for those interested in the implementation details: thorough descriptions of the improvements made to the Crunch library can be found in the commit messages of this repository).

Size and performance comparison

The compression performance has been tested on two Unity projects available in the Asset Store: "Adam Character Pack: Adam, Guard, Lu" and "Adam Exterior Environment". Testing has been performed in Windows Editor, running on i7-4790, 3.6GHz, using default Crunch quality settings.

Compressing textures with Crunch using DXT encoding

When using the updated compression library, DXT textures can be compressed significantly faster and with better compression ratio. At the same time, the updated library fully preserves the original compression quality. In fact, decompressed textures, generated by both libraries, are identical bit by bit.

Compressing textures from the "Adam Character Pack: Adam, Guard, Lu" project with Crunch using DXT encoding (93 textures with total size of 652.7 MB in uncompressed DXT format):

Unity 2017.2.0f3Unity 2017.3.0b5
Compressed size142.8 MB128.7 MB
Compression time39.0 minutes15.9 minutes

Compressing textures from the "Adam Exterior Environment" project with Crunch using DXT encoding (227 textures with total size of 717.8 MB in uncompressed DXT format):

Unity 2017.2.0f3Unity 2017.3.0b5
Compressed size156.3 MB138.1 MB
Compression time45.1 minutes19.5 minutes

Compressing textures with Crunch using ETC encoding

Crunch compression of ETC_RGB4 and ETC2_RGBA8 textures is performed in a similar way to compression of DXT textures, except that textures are decompressed into ETC/ETC2 format and then uploaded to the GPU at runtime. ETC and DXT formats have quite a lot in common, which allowed us to modify the original Crunch algorithm in such a way, so that it can now be used for compression of both formats. The default quality parameters for ETC Crunch encoding have been selected in such a way, that ETC Crunch compression gives approximately the same average Luma PSNR as DXT Crunch compression.

The following table shows the performance test results for Crunch compression when using ETC/ETC2 encoding:

ProjectUncompressed size (ETC/ETC2)Compressed size
(Crunched ETC/ETC2)
Compression time
Adam Character Pack: Adam, Guard, Lu (93 textures)541.4 MB112.2 MB23.5 minutes
Adam Exterior Environment (227 textures)588.2 MB118.0 MB25.8 minutes

Quality comparison

Below you can see the examples of the textures compressed with Crunch using default quality settings. Note that the artifacts on the final textures are introduced both by Crunch compression and selected GPU texture format (DXT or ETC).

Original image
24 bits/pixel

DXT
4 bits/pixel

Crunched DXT
1.24 bits/pixel

Original image
24 bits/pixel

ETC
4 bits/pixel

Crunched ETC
1.33 bits/pixel

 

Original image
24 bits/pixel

DXT
4 bits/pixel

Crunched DXT
1.24 bits/pixel

Original image
24 bits/pixel

ETC
4 bits/pixel

Crunched ETC
1.32 bits/pixel

 

Original image
24 bits/pixel

DXT
4 bits/pixel

Crunched DXT
1.20 bits/pixel

Original image
24 bits/pixel

ETC
4 bits/pixel

Crunched ETC
1.21 bits/pixel

 

You can download the 2017.3 beta right now and try the updated compression library out. Let us know what you think on the Unity Beta Forum and please send us a bug report if you run into any issues.

November 15, 2017 in Technology | 4 min. read

Is this article helpful for you?

Thank you for your feedback!