Improve Your Game with Texture Compression Format Targeting
Posted by Yafit Becher, Product Manager & Dan Galpin, Developer Advocate
Play Asset Delivery downloads the best supported texture for the device
Google Play Asset Delivery allows you to publish an Android App Bundle to Google Play containing all the resources your game needs. It offers multiple delivery modes, auto-updates, compression, and delta patching, all hosted at no cost to you.
As of today, you can use Google Play Asset Delivery to include textures in multiple texture compression formats in your Android App Bundle and Google Play will automatically deliver the assets with the best supported texture compression format for each device. With Texture Compression Format Targeting, you can start using ASTC for devices that support it while falling back to ETC2/ETC1 to devices that don’t. The Adaptive Scalable Texture Compression (ASTC) format offers advantages, such as improved rendering performance, faster load times, a smaller in-memory footprint, better battery life, and improved visual quality. You can even dramatically reduce your download size and on-device footprint by optimizing the tradeoff between size and quality.
Higher bandwidth version of much of this information
Android App Bundle will be the required publishing format for all new games and apps as of August 2021, which means that Google Play Asset Delivery will be required for new games that want Google Play to host more than 150MB of assets. Texture format targeting provides value even for smaller games due to the advantages of newer texture compression formats.
Texture compression
Texture compression is a form of lossy image compression that allows the GPU to render directly from the compressed texture using specialized silicon blocks, reducing the texture memory and memory bandwidth required to render the texture. As GPUs have gotten more advanced, more sophisticated texture compression formats have been developed, but not all GPUs can take advantage of them.
ASTC was released in 2012 to give developers more flexibility in trading compression size vs image quality. It compresses using fixed 128-bit block sizes, but allows for variable block footprints from 4x4 (8 bits per texel) to 12x12 (.89 bits per texel).
Googleplex from Google Earth at 12x12 (.89 BPT), 6x5 (4.27 BPT), 4x4 (8 BPT)
This allows almost any type of texture to be used in compressed form, and allows for textures to occupy much less space in RAM — up to 36x less space compared to uncompressed 2D textures depending on quality. Smaller textures also take less time to load, making games start faster.
Memory bandwidth
Since the GPU needs to do fewer reads from texture memory in order to render the texture, the memory bandwidth required to render the scene is reduced, often substantially when texture caches are taken into account.
Texture compression formats in Android
The top compression formats in Android are ETC1, ETC2, and ASTC.
Top texture compression formats with device penetration as of September 2020
ETC1 is supported on practically all devices. It has no transparency support; games can use a second texture for the alpha component. It has quality issues with sharp transitions such as edges and text.
ETC2 is supported by all devices that support GLES3. It supports multiple transparency modes and improves quality compared to ETC1.
ASTC is a more recent format that's more flexible; it supports many different kinds of textures, allowing for just about any texture in your game to benefit from compression. In addition, it supports various block sizes with different associated compression ratios. Using this format is a good way to optimize the size, image quality, and performance of your game.
When experimenting with ASTC on Asphalt Xtreme Gameloft found that they could reduce the size of their game by up to 30%
Using texture compression format targeting
Once you've implemented Google Play Asset Delivery in your game, adding texture format targeting is an incremental step. Inside your asset packs, make sure you have a directory that holds just your textures, such as [assetpackname]/textures
. This directory will be used to hold default textures (probably in ETC1 or ETC2 format).
Then, create additional texture directories with a suffix representing the additional formats you wish to support.
[assetpackname]/textures#tcf_etc2
[assetpackname]/textures#tcf_astc
Finally, update your app build.gradle
file to enable texture splits in asset packs:
// In the app build.gradle file:
android {
...
bundle {
texture {
enableSplit true
}
}
}
Google Play strips off the texture suffixes so your game reads its assets from the default directory, regardless of what textures are delivered to the device.
If you're using Unity, our Play Asset Delivery plugin for Unity is ready to create app bundles with texture-targeted packs.
Texture compression format targeting is available now
We're committed to helping you serve your entire game through Play with customized dynamic delivery and features such as texture compression format targeting. Documentation at d.android.com will walk you through the integration process depending on the game engine you use, and we also have codelabs ready for both C/C++ and Unity games. We have more information on all of our game related developer resources at d.android.com/games and stay up to date with Google Play Asset Delivery and other game developer tools by signing up for the games quarterly newsletter.
Komentar
Posting Komentar