Warning: count(): Parameter must be an array or an object that implements Countable in /home/digizomb/domains/digizomb.com/public_html/wp-includes/post-template.php on line 284

ATF

Beware that ATF textures can only be used in Flash Player versions 11.4 / AIR 3.4 and above.

 

Advantages:

  • They use lossy compression, requiring only a fraction of the otherwise used texture memory
  • Uploading to texture memory will be faster
  • The decompression is done directly by the GPU
  • Automatic generation of all required mipmaps
  • Higher resolution textures with the same memory footprint (when using compressed textures)
  • They even render faster!

ATF format

Compressed textures can be loaded directly by the GPU. Depending on the compression settings and the actual image data, this means that you can use up to ten times as many textures!  Unfortunately there are several different formats for compressed textures. The problem: depending on where your game is running, it will need a different kind of texture.

This where the ATF format comes to the rescue. It is a brand new file format that Adobe created especially for stage3D; actually, it is a container file that can include up to three different versions of a texture.

  • PVRTC (PowerVR Texture Compression) is used in PowerVR GPUs. It is supported by all generations of the iPhone, iPod Touch, and iPad.
  • ETC (Ericsson Texture Compression) is used in many mobile phones, most notably Android phones.
  • DXT1/5 (S3 Texture Compression) was originally developed by S3 Graphics. It is now supported by both Nvidia and AMD GPUs, and is thus available in most desktop computers, as well as some Android phones.

ATF is a container format. That means that it can include one, two, or all of the above formats.

The difference between DXT1 and DXT5 is just that the latter supports an alpha channel. Don’t worry about this, though: the ATF tools will choose the right format automatically.

Adobe provides a set of command line tools to convert to and from ATF, and to display ATF files. Those tools are part of the Adobe Gaming SDK which you can download here.

png2atf -c -i starling-atf.png -o starling.atf

This will compress the texture with the standard settings in all available formats.

png2atf tricks:

 

 

Using a File to load an ATF texture bytes of compressed PVRTC data (moderate quality), then Texture.fromATFBytes using async loading, the UI locks for ~0.05 seconds (almost imperceptible) and it uses 6.5MB of GPU memory

png2atf -c p -r -e -i atlas.png -o atlas_ios_cpr.atf

 

When loading PNG Textures into Starling with a Loader, always use ImageDecodingPolicy.ON_LOAD so that the PNG decode (600 ms in my case) happens in the background Loader thread.

Mipmaps are expensive. Decide for yourself if you need them, and be aware of the options. If you do, using ATF to generate mipmaps ahead of time is a good option, as generating mipmaps at upload-time required 2.5 seconds.

Do use the JPEGXR -r flag to losslessly compress your device-specific ATF files. They’ll be smaller files to package and load from disk (though use the same amount of GPU memory). The default quant level is 0 (lossless) for these block compressed (device-specific) atf files.

 

Limitations

I want to highlight that even if ATF will be very useful for 2D content (like with Starling), ATF has been mainly designed for 3D textures purposes. So what does it mean?
The compression applied to the textures is lossy and may impact too much the quality of your assets. Things like RGBA8888 and RGBA4444 for PVR are not supported and could be an issue.

 

 
Information collected and BIG Thank You:
http://wiki.starling-framework.org/manual/atf_textures
http://www.adobe.com/devnet/flashruntimes/articles/introducing-compressed-textures.html
http://forum.starling-framework.org/topic/atf-observations-ymmv
http://treefortress.com/tutorial-compressed-textures-in-air-atf-format/
http://jacksondunstan.com/articles/2059

Phone: +370 6 727 04 99, +370 6 144 50 55
Email: info@digizomb.com
All rights reserved 2012©
Digital zombies™