Posted by Shanee Nishry, Developer Advocate
As you may know, high resolution textures contribute to better graphics and a more impressive game experience. Adaptive Scalable Texture Compression (ASTC) helps solve many of the challenges involved including reducing memory footprint and loading time and even increase performance and battery life.
If you have a lot of textures, you are probably already compressing them. Unfortunately, not all compression algorithms are made equal. PNG, JPG and other common formats are not GPU friendly. Some of the highest-quality algorithms today are proprietary and limited to certain GPUs. Until recently, the only broadly supported GPU accelerated formats were relatively primitive and produced poor results.
With the introduction of ASTC, a new compression technique invented by ARM and standardized by the Khronos group, we expect to see dramatic changes for the better. ASTC promises to be both high quality and broadly supported by future Android devices. But until devices with ASTC support become widely available, it’s important to understand the variety of legacy formats that exist today.
We will examine preferable compression formats which are supported on the GPU to help you reduce .apk size and loading times of your game.
Texture Compression
Popular compressed formats include PNG and JPG, which can’t be decoded directly by the GPU. As a consequence, they need to be decompressed before copying them to the GPU memory. Decompressing the textures takes time and leads to increased loading times.
A better option is to use hardware accelerated formats. These formats are lossy but have the advantage of being designed for the GPU.
This means they do not need to be decompressed before being copied and result in decreased loading times for the player and may even lead to increased performance due to hardware optimizations.
Hardware Accelerated Formats
Hardware accelerated formats have many benefits. As mentioned before, they help improve loading times and the runtime memory footprint.
Additionally, these formats help improve performance, battery life and reduce heating of the device, requiring less bandwidth while also consuming less energy.
There are two categories of hardware accelerated formats, standard and proprietary. This table shows the standard formats:
ETC1 | Supported on all Android devices with OpenGL ES 2.0 and above. Does not support alpha channel. |
ETC2 | Requires OpenGL ES 3.0 and above. |
ASTC | Higher quality than ETC1 and ETC2. Supported with the Android Extension Pack. |
As you can see, with higher OpenGL support you gain access to better formats. There are proprietary formats to replace ETC1, delivering higher quality and alpha channel support. These are shown in the following table:
ATC | Available with Adreno GPU. |
PVRTC | Available with a PowerVR GPU. |
DXT1 | S3 DXT1 texture compression. Supported on devices running Nvidia Tegra platform. |
S3TC | S3 texture compression, nonspecific to DXT variant. Supported on devices running Nvidia Tegra platform. |
That’s a lot of formats, revealing a different problem. How do you choose which format to use?
To best support all devices you need to create multiple apks using different texture formats. The Google Play developer console allows you to add multiple apks and will deliver the right one to the user based on their device. For more information check this page.
When a device only supports OpenGL ES 2.0 it is recommended to use a proprietary format to get the best results possible, this means making an apk for each hardware.
On devices with access to OpenGL ES 3.0 you can use ETC2. The GL_COMPRESSED_RGBA8_ETC2_EAC format is an improved version of ETC1 with added alpha support.
The best case is when the device supports the Android Extension Pack. Then you should use the ASTC format which has better quality and is more efficient than the other formats.
Adaptive Scalable Texture Compression (ASTC)
The Android Extension Pack has ASTC as a standard format, removing the need to have different formats for different devices.
In addition to being supported on modern hardware, ASTC also offers improved quality over other GPU formats by having full alpha support and better quality preservation.
ASTC is a block based texture compression algorithm developed by ARM. It offers multiple block footprints and bitrate options to lower the size of the final texture. The higher the block footprint, the smaller the final file but possibly more quality loss.
Note that some images compress better than others. Images with similar neighboring pixels tend to have better quality compared to images with vastly different neighboring pixels.
Let’s examine a texture to better understand ASTC:
This bitmap is 1.1MB uncompressed and 299KB when compressed as PNG.
Compressing the Android jellybean jar texture into ASTC through the Mali GPU Texture Compression Tool yields the following results.
Block Footprint | 4x4 | 6x6 | 8x8 |
Memory | 262KB | 119KB | 70KB |
Image Output | |||
Difference Map | |||
5x Enhanced Difference Map |
As you can see, the highest quality (4x4) bitrate for ASTC already gains over PNG in memory size. Unlike PNG, this gain stays even after copying the image to the GPU.
The tradeoff comes in the detail, so it is important to carefully examine textures when compressing them to see how much compression is acceptable.
Conclusion
Using hardware accelerated textures in your games will help you reduce the size of your .apk, runtime memory use as well as loading times.
Improve performance on a wider range of devices by uploading multiple apks with different GPU texture formats anddeclaring the texture type in the AndroidManifest.xml.
If you are aiming for high end devices, make sure to use ASTC which is included in the Android Extension Pack.
相关推荐
Mastering Android Game Development with Unity by Wajahat Karim English | 6 Jun. 2017 | ASIN: B01M68DBRU | 352 Pages | AZW3 | 11.27 MB Key Features Develop complex Android games with the help of ...
本文使用 Modeling Textures with Total Variation Minimization and Oscillating Patterns in Image Processing的算法,能对图像进行分解,希望对大家有用
Metal by Tutorials: Beginning game engine development with Metal by Caroline Begbie English | 2019 | ISBN: 1942878544 | 659 Pages | True PDF, EPUB, CODE | 790 MB Build your own low-level game engine ...
3D Game Textures Create Professional Game Art Using Photoshop(4th) 英文无水印pdf 第4版 pdf使用FoxitReader和PDF-XChangeViewer测试可以打开
Towards the end of the book, you will polish your game with fun menus, integrate with Apple Game Center for leaderboards and achievements, and then finally, learn how to publish your finished games ...
3D Game Textures Create Professional Game-Art-Using-Photosho.
This book presents an introduction to programming interactive computer graphics, with an emphasis on game development, using real-time shaders with DirectX 9.0c. It teaches the fundamentals of Direct...
Metal by Tutorials: Beginning game engine development with Metal by Caroline Begbie English | 2019 | ISBN: 1942878544 | 659 Pages | True PDF, EPUB, CODE | 790 MB Build your own low-level game engine ...
Chapter 2: Taking the First Steps Chapter 3: Going Mobile Part II: Creating the Basic Game Chapter 4: Building the Game Chapter 5: Delegating Tasks to Web Workers Chapter 6: Creating Graphics with ...
Metal by Tutorials: Beginning game engine development with Metal by Caroline Begbie English | 2019 | ISBN: 1942878544 | 659 Pages | True PDF, EPUB, CODE | 790 MB Build your own low-level game engine ...
Introduction to 3D Game Programming with DirectX 9.0c Shader Approach 源代码 This book presents an introduction to programming interactive computer graphics, with an emphasis on game development, ...
Unity默认不支持播放gif文件,这是Unity播放GIF所需的dll库文件Gif2Textures
This library is primarily designed to load images as background (buttons, forms, toolbars) and textures (DirectX, OpenGL) or for image browsing and editing purposes as long as you don't need to save ...
This book presents an introduction to programming interactive computer graphics, with an emphasis on game development, using Direct3D 10. It teaches the fundamentals of Direct3D and shader programming...
This book presents an introduction to programming interactive computer graphics, with an emphasis on game development, using Direct3D 10. It teaches the fundamentals of Direct3D and shader programming...
《Introduction to 3D Game Programming with DirectX11》是一本专为游戏开发人员设计的教程,深入介绍了如何使用DirectX 11这一图形库来创建3D游戏。这本书旨在帮助初学者和有经验的程序员掌握DirectX 11的基础知识...
BC1(DXT1):完成BC2(DXT3):完成BC3(DXT5):完成BC4:完成BC5:完成BC6H:实验性BC7:完成ETC1:完成ETC2 RGB:完整ETC2 RGBA:完整具有穿KongAlpha的ETC2:完整11位EAC:实验性PVRTC:不支持ASTC:...
Swift is the perfect choice for game development. Developers are intrigued by Swift and want to make use of new features to develop their best games yet. Packed with best practices and easy-to-use ...