Game Development Reference
In-Depth Information
Figure 2-24 . Make it so! Turning a folder into a Smart Sprite Sheet
You'll notice the Atlas folder icon turned pink. And above it, in the preview area, you get
a few extra options to change the sprite sheet's publishing format. For now, you can leave
the format as PNG (uncompressed, no dithering), but the recommended format is PVR
RGBA8888 with Compress selected to conserve memory and to load these images signi-
ficantly faster. There is no downside to using compressed PVR. Cocos2D users may re-
cognize this texture format by its .pvr.ccz extension.
Tip A common misconception is that image file size equals memory usage, but
nothing could be further from the truth. An image.png file that's 100 KB in size
could easily consume 16 megabytes of memory as a texture. The maximum, un-
compressed size of a texture in bytes is calculated from the image properties:
width x height x (bpp / 8) where bpp stands for “bits per pixel.” Simply redu-
cing color bit depth from 32-bit (4 bytes per color) to 16-bit (2 bytes per color)
already halves a texture's memory usage. The compressed PVR format further
decreases memory usage without affecting image quality, while the lossy
PVRTC reduces memory usage even further at the expense of image quality.
It shouldn't matter which atlas type you use for the rest of the topic, but if you run into an
out of memory situations in your app, the atlas type is how you can most easily and
quickly reduce memory usage and even increase performance. To do so, simply select one
of those cute pink sprite sheet folders with a smiley icon and change the texture type. For
instance, the sprite sheet in Figure 2-25 uses PVR RGBA8888—a texture in PVR format
Search WWH ::




Custom Search