Texture optimization in Unity 2021.1
A key focus area for Unity 2021.1, now available in beta, is Editor performance, helping you iterate faster on your project. Texture import and compression optimization is a key part of this.
Compared to other game assets, textures typically take up the majority of hard disk space – and approximately two thirds of the total import time. When working on a complex project, waiting for textures to import or compress costs you valuable time. While Unity tools for teams, such as Unity Accelerator, help alleviate this issue, we know that we can always do more. That’s why we’ve started working on optimizing the texture import and compression process.
The timing below reflects a project on a PC with AMD ThreadRipper 1950X CPU with the project folder on an SSD disk. Speedups on other configurations (e.g., Mac) are similar. We are comparing an earlier version of Unity 2020.2 (alpha 21) with the Unity 2021.1 beta 5 version.
Here’s how long it takes to import all textures from the Boat Attack project (118 textures, 720MB):
- PC platform: 102 → 94 seconds (1.1x speedup)
- Android platform, ETC2 compression: 203 → 101 seconds (2.0x speedup)
- Android platform, ASTC compression: 536 → 172 seconds (3.1x speedup)
- PC platform, same texture size settings as Android: 30 → 22 seconds (1.4x speedup) Many textures in the project use larger texture sizes on PC compared to on the Android platform.
On a larger project, such as Book of the Dead: Environment, importing all the textures (425 textures, 1.9 GB) takes:
- PC platform: 161 → 133 seconds (1.2x speedup)
- Android platform, ETC2 compression: 1140 → 494 seconds (2.3x speedup)
- Android platform, ASTC compression: 3162 → 1204 seconds (2.6x speedup)
We achieved these speedups by focusing on optimizing the following two areas:
1) pixel data conversions and copies done during the texture import process, as well as adding SIMD or threading optimizations to the slow parts (e.g., sRGB conversion, panoramic layout cubemap processing, etc.)
2) texture compression, by updating to the latest versions of compression libraries or optimizing the compression libraries themselves
Low-risk parts of the ETC format compression optimizations (1.4x speedup) are already backported to 2020.2.0, 2020.1.15 and 2019.4.16 versions.
Unity 2021.1 beta
We hope this helps and that as a Unity 2021.1 user, you’ll spend way less time waiting for import progress bars to finish. You can get the latest beta from the Unity Hub or on our download page. As of today, it includes over 1,900 fixes and more than 260 features and changes. Try it out, and if you run into any issues, submit a bug report to qualify for your chance to win one of four ultrawide IPS 34” 144 Hz monitors (see the full rules here). Remember, the beta is not intended for use in production-stage projects. You should always make sure to back up your existing projects if you plan to use them with the beta.
That being said, we would love to know if you experience similar texture import time improvements in Unity 2021.1. Tell us what you think in this forum thread.