Jump to content

Sprite Atlases and Game Performance


mariogarranz
 Share

Recommended Posts

I'm about to finish my game, and right now I'm focusing in performance improvement.

 

One of the variables I'm not sure how does actually impact on game performance is the number and size of sprite atlases.

 

I know that:

 

- Using atlases improves load times, since it reduces the number of HTTP requests needed to load the images.

- If GPU acceleration is available, I guess using atlases improves performance, because it reduces the number of textures being used during the draw function.

- On the other hand, I understand (not really sure of this) that a big atlas may take up too much memory and cause performance loss.

 

So my question is, does anyone know how to organize my images to improve performance? Should I try to put all the images being used in the same draw loop in a single atlas, even if this makes very big image? Is there a limit to the recommended image size, and if so, how do you estimate it?

 

 

Right now I have 2 separate atlases for GUI and ingame elements, maybe they should be all together because they are all drawed at the same time?

 

Thanks in advance for your help.

Link to comment
Share on other sites

the maximum texture size that a given device can handle depends on a number of factors: the actual hardware, the hardware drivers, the OpenGL drivers, and the browser's WebGL/canvas implementation. it's *probably* true that if the hardware & driver support a given size that the WebGL implementation will support that same size (it's hard to imagine why it wouldn't, but it's not impossible).

 

for instance, iPhone 4 and later support 2048x2048 pixel textures in their OpenGL ES 2 implementation, so that's probably a safe bet if you're targeting iPhone 4+. but early versions of the 3gs only supported 1024x1024, so if you're targeting older systems, you might want to limit it to that. I believe only the Retina iPads (not phones) support 4096x4096.

 

android devices are a very mixed bag, but newer devices are generally at least as capable as an iPhone 4. 

 

there's not going to be a hard-and-fast rule for all devices, unfortunately. 1024x1024 is going to fit on any device you'd care about, and 2048x2048 is probably safe too - if your game is using that many images or that large of images then chances are good it won't run well on those old devices anyway ;). but the only way to know for sure is to try it on a given device. 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...