When I want to use texture atlasing, should I try to place all of my sprites into one single texture atlas? Or are there times when I should have multiple smaller texture atlases?
Like many things in software, it's a balancing act. Fewer texture swaps is good, but getting textures that are too large can also hurt performance. Additionally, sprite sheets with a large number of sprites can be difficult to manage logistically.
To help manage larger sprite sheets, it's recommended that you keep your sprites separate, then join them into a sprite sheet for use in your game. You can use tools (both of which have very clever names) like:
Using these tools will allow you to ensure that animations that belong together end up on the same sprite sheet. That way you're not switching between textures mid animation.
Unfortunately there's no universal standard for maximum texture size. Not only that, but it varies from hardware to hardware, not just between graphics platforms. There are maximums that the graphics platforms can support though, but it doesn't mean the hardware supports it. Be sure to create a check with your game to ensure that you won't load a texture that's too large.
|show 2 more comments|
The fewer textures the better. So one big one would be best. However, depending on your platform and language there is a size limit to an image. So if 2048 x 2048 px is the largest your image can be and your texture atlas is bigger than that, it would be best to have two smaller atlases.