One Big sprite sheet or smaller individual sheets?

Hi there,
Quick question. Is there any benefit of putting all sprites in one sheet. For instance the idle, the walk, the run, the jump, the death, etc… In one big image and it’s corresponding one data .xml/json file?
Or have a smaller individual ones: walkSheet.png and walkSheet.json, run sheet.png and runSheet.json etc…
Any benefit from a performance point of view or it just s matter of preference?

Thanks

Put as much as you can on a single sprite sheet. If everything can fit on a single sprite sheet, then that would mean a single draw call from CPU to the GPU; basically, no need for the CPU to waste time transferring data across to the GPU. The more draw calls you have, the more time you waste, and the lower your frame rate, although you may not notice this unless you’re switching out large textures or a lot of them.

In the example you gave, with idle, walk, run etc., you would want to switch in and out of the different animations very quickly, so to avoid have to constantly send different data to the GPU each time (meaning more draw calls), just fit them all on a sprite sheet.

If I remember correctly, all current GPUs support a sprite sheet size of 2048x2048, and some can even handle 4096x4096 or larger, but you would need to detect this somehow and use the correct set of sprite sheets if you are going to try to use anything larger than 2048x2048.

If you do a web search for the reasons to use sprite sheets, then I’m certain you would have all the information you require about this topic. For instance, the helpful info here.

2 Likes

Cool, thanks for the reply and the link.
I did a research before asking here, and I found mixed opinions and some were in favor of many sprite sheets claiming that it is more relevant the workflow you apply.

The thing is that, say you have 2 sprite sheets: the walk and the run. Each contains what ever number of images. Then you parse each sheet only once to create the Animate object. So you store in memory the walkAnimate object and the runAnimate object. Having done that, that’s it right? You can forget about the sheet images because you already extracted the animate objects you need in the game. So you are not going back and forth reading sprites sheets. It is done once.

In summary, if you only read the sheets once to store in memory Animate objects, is there a difference?

Thx

That’s not how it works. The animation frames are sprites, and every sprite contains a reference to the texture that it requires (or a slice of the bigger sprite sheet texture).

No matter whether you’re using a sprite sheet or individual image files, once they’re loaded into memory, they need to remain there while anything is referencing them.

I see. Thanks for the explanation. I’ll give that a thought for sure.

cheers
R