Tuesday, 13 September 2011

Sprite sheets and Maximum texture size

Sprite sheets are the “correct” way to add animation into your game/app with Corona SDK.

If you do use sprite sheets, you need to be aware of what's called the "Maximum Texture Size".
Each device has its maximum texture size, a maximum size for a single picture.

With Corona SDK you can get the device’s maximum texture size using the system.getInfo("maxTextureSize"), but that’s obviously for runtime, in order to make sure you are not trying to load an image larger than the maximum.

When creating a new sprite sheet you need to consider its size.
So how big a sprite sheets should be?

Let’s check the details:
(According to

Device Maximum texture size
iPod Touch 1024 x 1024
iPod Touch (Second Generation) 1024 x 1024
iPod Touch (Third Generation) 2048 x 2048
iPod Touch (Fourth Generation) 2048 x 2048
iPhone 1024 x 1024
iPhone 3G 1024 x 1024
iPhone 3GS 2048 x 2048
iPhone 4 2048 x 2048
Samsung GT-i9100 Galaxy S2 4096 x 4096
Google Nexus S 2048 x 2048
HTC EVO 4G+ 4096 x 4096
HTC Vision (Desire Z) 4096 x 4096
LG P990 Optimus 2X 2048 x 2048
HTC G1 1024 x 1024
Barnes & Noble Nook color 2048 x 2048

As you can see from the table above, most devices built in the last two years are most likely to support 2048 x 2048 but older will require 1024 x 1024.

As a guideline try to use 1024 x 1024 sheets only.
Use small amount of memory and target most of the mobile devices out there.
Go up to 2048 x 2048 if you don’t have other choice.
Jumping to 4096 x 4096 is not an option (currently not supported by Apple at all), unless you target your software for a specific device.

No comments:

Post a Comment