Game Development Reference
In-Depth Information
width and height are multiples of eight—something like 64 x 64 pixels or 128 x 64
pixels, 128 x 128 pixels, and so on. The sprite sheets in turn are much larger; their
maximum dimensions depend on the specifications of a device as shown in the fol-
lowing table:
Device
Dimensions
iPhone 2G, iPhone 3G
1024 x 1024 pixels
iPhone 3GS, iPhone 4, iPad 1
2048 x 2048 pixels
iPhone 5/5S/5C, iPhone 4, iPad 3, iPad 4, iPad mini
4096 x 4096 pixels
To calculate how much space a sprite sheet in PNG format will occupy in graphics
memory, a simple formula can be constructed. Standard bitmaps are used in uncom-
pressed form, so the content is irrelevant; only dimensions matter. It is known that
there are four channels in PNG, colors and alpha, each one is described by a byte
of data. The formula is as follows:
(Height x Width x 4)/(1024 x 1024) = space in megabytes
For example, a texture of 512 x 512 pixels occupies 1 MB of memory, 1024 x 1024
pixels in turn occupies 4 MB, and so on. To get an idea of hardware resources, in-
cluding the amount of RAM for iOS devices, it is good to look at the special table
published at http://docs.unity3d.com/Documentation/Manual/iphone-Hardware.html .
There are special applications that can help to create and manage sprite sheets, for
instance, a very popular tool Texture Packer ( http://www.codeandweb.com/texture-
packer ) designed by Andreas Löw . It supports many compression algorithms, includ-
ing PVRTC, and works with many actual game engines, such as Cocos 2d , Corona
SDK , Sparrow , Unity , and so on. Texture Packer also features a handy drag-and-
drop interface, as well as a bunch of various settings for texture sheets, letting us
Search WWH ::




Custom Search