Subscribe:

Ads 468x60px

Labels

Efficient Game Textures with Hardware Compression

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:















ETC1Supported on all Android devices with OpenGL ES 2.0 and above. Does not support alpha channel.
ETC2Requires OpenGL ES 3.0 and above.
ASTCHigher 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:



















ATCAvailable with Adreno GPU.
PVRTCAvailable with a PowerVR GPU.
DXT1S3 DXT1 texture compression. Supported on devices running Nvidia Tegra platform.
S3TCS3 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 Footprint4x46x68x8
Memory262KB119KB70KB
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 and declaring 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.




Learn to make Lollipop apps with Bitfountain Android Course [DEALS]

Almost everyone nowadays has an idea for the next great mobile app, but not everyone follows through with them, mostly because of lack of knowledge if not the lack of time. Fortunately for Android lovers, Google is making things easier with the Android Studio suite of tools. And to help you get familiar with the new tool, Bitfountain has a rather extensive course that will take you from beginner to expert when it comes to Android app development. And best of all, it's now offered with a rather hefty discount!



Programming and app development is becoming en vogue and some schools are integrating such courses into their regular curricula. But let's face it, it's not exactly a walk in the park and not everyone has the luxury of going to school for it. The next best thing, then, would be for someone to personally guide you by proxy, and that is where instructional videos and lectures come in. Bitfountain's Android course takes you through from beginning to end, starting with Java all the way to more advanced topics like Google's API and SQLite, all using the shiny new Android Studio 1.0 integrated development environment (IDE).


And don't think that this is some outdated material. The course also covers the latest Android 5.0 version, including instructions in that fancy Material Design language. As a bonus, it even teaches some good programming practice by introducing you to Git source code version management. All these, delivered in over 30 hours of video lectures and more than 10 app building exercises, can be yours for only $89, a fraction of its original $499. Get the Bitfountain Android Lollipop course now at Android Community Deals.


Android Community Deals is brought to you in cooperation with StackSocial. Generated revenue helps fund this site. Deals are curated by StackSocial and are not representative of the opinions of the Android Community staff.


Samsung reportedly buying BlackBerry

Samsung is reportedly buying Blackberry. According to sources familiar with the matter who opted remain anonymous, Samsung would be looking to gain access to Blackberry’s patent portfolio. If the deal were to go down, the company would be bought for as much as $7.5 billion. It’ll cost $13.35 to $15.49 per share, or 38-60% over what Blackberry currently trades at.



The executives from Samsung and Blackberry reportedly met last week with advisors to negotiate terms of a potential transaction. Reports say the conversations were to be private.


Having access to Blackberry’s patent portfolio will give Samsung better leverage to develop patent technology that doesn’t interfere with what could be a potential lawsuit.


Blackberry was working with Samsung back in November combining both companies security platforms into a single effort. Blackberry would utilize their enterprise mobility management (EMM) whlie Samsung's KNOX safeguards your files underneath stacks of hardware and software protection. Samsung has been in talks to acquire Blackberry before.


Lets just hope that if this deal does go through, Samsung won’t be nerfing any of the new potential or classic Blackberry products by adding TouchWiz.


UPDATE: BlackBerry's official response to the rumored Samsung takeover:


"BlackBerry Limited (NASDAQ:BBRY)(TSX:BB) (“BlackBerry”) is aware of certain press reports published today with respect to a possible offer by Samsung to purchase BlackBerry. BlackBerry has not engaged in discussions with Samsung with respect to any possible offer to purchase BlackBerry. BlackBerry’s policy is not to comment on rumors or speculation, and accordingly it does not intend to comment further."


SOURCE: Reuters



Google’s Project Ara hands-on: modular plug-and-play smartphone action

The modular smartphone you're about to take a peek at goes by the name Project Ara. It's a modular smartphone concept, coming from Google ATAP and actually - eventually - coming to the market with its own hardware store. Where you may have purchased your own custom Moto X in the past, you get one shot - the device stays as it is. With Project Ara, you've got the option of updating the smartphone's hardware - new pieces can be added whenever you like.



This device uses physical pin contacts to connect each module to the device's skeletal innards. While the video you're about to see shows the pieces sliding in and out with ease, you'll need to do a bit of fiddling to make certain you're connected here.


OLYMPUS DIGITAL CAMERA

The "Spiral 2" model we're seeing here isn't the final delivery vehicle for Project Ara, of course - so not to worry about any less-than-perfect bits in the hardware so far. If this were the final project, we might be a bit concerned about the hold.


OLYMPUS DIGITAL CAMERA

In the Spiral 3 model we'll be seeing Google's electro-permanent magnets taking hold.


OLYMPUS DIGITAL CAMERA

The models we're seeing today come in several custom colors and designs - they aren't by any means the final designs or colors for the device lineup. We're expecting a whole lot of options for colors, designs, and customization - including personalized customization - in aesthetics in the near future.


OLYMPUS DIGITAL CAMERA

The camera module you're seeing here is a mere 5-megapixels. In the future we'll see a 13-megapixel camera from Toshiba as well as a number of other modules from other 3rd-party manufacturers. This system is all about changing each individual part out for the manufacturer you like best.


OLYMPUS DIGITAL CAMERA

Around the back you'll have far more modules than you'll have up front. This device setup still relies on the standard smartphone setup - big touchscreen display up front with one or two other components - likely a speaker at least.


OLYMPUS DIGITAL CAMERA

With the units we're seeing here, we're being shown the hardware, mainly. You can see the lock screen on more than one model, but nothing much beyond that. This is a hands-on for Google's advancements in hardware for the most part.


OLYMPUS DIGITAL CAMERA

Once we're able to roll with more than just a set of modules and a lock screen, we'll let you know. For now - this device feels nice to hold, isn't too light and isn't too heavy, and is certainly a device we'd love to work with in the near future.


OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA OLYMPUS DIGITAL CAMERA