crunch_更新了Crunch纹理压缩库
crunch
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.
紧缩是一种有损纹理压缩格式,通常在DXT纹理压缩之上使用。 紧缩压缩有助于减小纹理的大小,以便使用更少的磁盘空间并加快下载速度。 由Binominal维护的原始Crunch压缩库可 在GitHub上获得 。 对Crunch纹理格式的支持最初是在Unity 5.3中添加的。 在 Unity 2017.3中 ,我们引入了Crunch压缩库的更新版本。
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).
使用Crunch压缩的纹理首先被解压缩为DXT,然后在运行时上载到GPU。 粗糙的纹理不仅占用更少的空间,而且还可以非常快速地将其解压缩。 这使得Crunch格式非常有效地分布纹理。 同时,压缩纹理需要花费大量时间来压缩,这在使用压缩时是一个主要缺点(对于大型项目,在编辑器中将所有纹理压缩为压缩格式可能需要几个小时)。
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.
Unity 2017.3中 引入的更新后的Crunch库 可以将DXT纹理压缩速度提高多达2.5倍,同时压缩率提高了约10%。 但更重要的是,更新后的库现在可以压缩ETC_RGB4和ETC2_RGBA8纹理,从而可以在iOS和Android设备上使用Crunch压缩。 这应该可以帮助您减少手机游戏的构建尺寸,从而使遵守App Store无线下载限制变得更容易,最终使您可以覆盖更多内容的受众。
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.
为了在Android,iOS和tvOS平台上使用Crunch压缩,您现在可以在检查器窗口中为纹理选择“ RGB Crunched ETC”或“ RGBA Crunched ETC2”格式。 如果启用“默认”选项卡中的“使用紧缩压缩”选项,则默认情况下,Android平台上的所有纹理将使用ETC紧缩压缩。
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).
在不久的将来,Crunch压缩库将得到进一步的改进。 该库的最新版本即将发布Beta版,它将能够对DXT纹理执行Crunch压缩,速度约为原始版本的5倍,并且对ETC纹理进行Crunch压缩的速度约为1.3倍。 可以在以下GitHub存储库中找到最新版本的Crunch库: https : //github.com/Unity-Technologies/crunch/tree/unity (对于那些对实现细节感兴趣的人:对该实现所做的改进的详尽描述)可以在此存储库的提交消息中找到Crunch库)。
尺寸和性能比较 (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.
压缩性能已经在Asset Store中提供的两个Unity项目中进行了测试:“ Adam Character Pack:Adam,Guard,Lu”和“ Adam Exterior Environment”。 已使用默认的Crunch质量设置在运行于3.6 GHz i7-4790的Windows编辑器中执行了测试。
使用DXT编码使用Crunch压缩纹理 (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.
使用更新的压缩库时,可以显着更快地以更好的压缩率压缩DXT纹理。 同时,更新的库完全保留了原始压缩质量。 实际上,两个库生成的解压缩纹理一点一点地相同。
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):
使用DXT编码使用Crunch压缩“ Adam Character Pack:Adam,Guard,Lu”项目中的纹理(未压缩DXT格式的93个纹理,总大小为652.7 MB):
Unity 2017.2.0f3 | Unity 2017.3.0b5 | |
Compressed size | 142.8 MB | 128.7 MB |
Compression time | 39.0 minutes | 15.9 minutes |
Unity 2017.2.0f3 | Unity 2017.3.0b5 | |
压缩尺寸 | 142.8兆字节 | 128.7兆字节 |
压缩时间 | 39.0分 | 15.9分 |
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):
使用DXT编码使用Crunch压缩“亚当外部环境”项目中的纹理(未压缩DXT格式的227个纹理,总大小为717.8 MB):
Unity 2017.2.0f3 | Unity 2017.3.0b5 | |
Compressed size | 156.3 MB | 138.1 MB |
Compression time | 45.1 minutes | 19.5 minutes |
Unity 2017.2.0f3 | Unity 2017.3.0b5 | |
压缩尺寸 | 156.3兆字节 | 138.1兆字节 |
压缩时间 | 45.1分 | 19.5分 |
使用ETC编码使用Crunch压缩纹理 (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.
ETC_RGB4和ETC2_RGBA8纹理的紧缩压缩与DXT纹理的压缩相似,只是将纹理解压缩为ETC / ETC2格式,然后在运行时上载到GPU。 ETC和DXT格式有很多共同点,这使我们能够以这种方式修改原始的Crunch算法,以便现在可以将其用于两种格式的压缩。 已选择ETC Crunch编码的默认质量参数,以使ETC Crunch压缩可提供与DXT Crunch压缩大致相同的平均Luma PSNR。
The following table shows the performance test results for Crunch compression when using ETC/ETC2 encoding:
下表显示了使用ETC / ETC2编码时Crunch压缩的性能测试结果:
Project | Uncompressed size (ETC/ETC2) | Compressed size (Crunched ETC/ETC2) |
Compression time |
Adam Character Pack: Adam, Guard, Lu (93 textures) | 541.4 MB | 112.2 MB | 23.5 minutes |
Adam Exterior Environment (227 textures) | 588.2 MB | 118.0 MB | 25.8 minutes |
项目 | 未压缩大小(ETC / ETC2) | 压缩尺寸 (压缩的ETC / ETC2) | 压缩时间 |
亚当角色包:亚当,警卫队,陆(93个纹理) | 541.4兆字节 | 112.2兆字节 | 23.5分 |
亚当外部环境(227个纹理) | 588.2兆字节 | 118.0兆字节 | 25.8分 |
质量比较 (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).
在下面,您可以看到使用默认质量设置通过Crunch压缩的纹理的示例。 请注意,最终纹理上的伪像是通过Crunch压缩和选定的GPU纹理格式(DXT或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 |
原始图像 24位/像素 |
DXT 4位/像素 |
压缩DXT 1.24位/像素 |
原始图像 24位/像素 |
ETC 4位/像素 |
压缩的ETC 1.33位/像素 |
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 |
原始图像 24位/像素 |
DXT 4位/像素 |
压缩DXT 1.24位/像素 |
原始图像 24位/像素 |
ETC 4位/像素 |
压缩的ETC 1.32位/像素 |
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 |
原始图像 24位/像素 |
DXT 4位/像素 |
压缩DXT 1.20位/像素 |
原始图像 24位/像素 |
ETC 4位/像素 |
压缩的ETC 1.21位/像素 |
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.
您可以立即 下载2017.3 Beta, 然后尝试更新的压缩库。 让我们知道您在 Unity Beta论坛 上的想法, 如果遇到任何问题,请向我们发送错误报告。
翻译自: https://blogs.unity3d.com/2017/11/15/updated-crunch-texture-compression-library/
crunch