Optimal sprite sizes for sprite rendering?

So, I am trying to figure out, is there an optimal size for sprites? my tests are not really seeing a huge difference in fps, just memory used. 16x16, 32x32, 128x128, etc, etc.

I am trying to make sprites that are made of up to 5-10 parts, to make it easier to swap them during gameplay. But I want to know whats most optimized in terms of power 2 sizes within the sheet to render from.

RimWorld does 128x128 for a lot of its parts.

My guess is the renderer is going to take the same time but use X amount of memory to process any sheet under say 1028x1028? or am I mistaken?

the smaller the better

the smaller they are the more you can fit on the same sheet so they render in the same batch

the memory is how many sprites are loaded

the rendering is what is being displayed, if you display sprites from different sheets it burdens the renderer

if you have many game objects it also burdens the renderer

1 Like

Thank you.

I can now make better more accurate tests because of this information.

MipMaps are also a factor. Let’s say your 128x128 sprites are zoomed out so on the screen they’re really 1/4 that size. Well, the GPU can do less work if it can pick out the correct mip level. This advantage, however, comes at a cost of 33% more memory. If your player has the ability to zoom in and out it’s something to consider. With a fixed camera zoom, it may be unnecessary.

realistically, theres no perfomance difference on sprite sizes on modern hardware, you can use tens of thousands of them at any size.

if you do that without batching you will get 10k drawcalls per frame

sprite batching is given to you automatically in Unity if they use the same material https://docs.unity3d.com/Manual/DrawCallBatching.html

The docs still state:

I am confused, how do we maximize the benefits of batching and material sharing, it seems to be from what I read, share materials using least amount of sprite sheets.

Fewer materials using fewer spritesheets = more likely to batch.

When in doubt, open up the Frame Debugger Unity - Manual: Debug frames in Unity

It will tell you why two things did not batch. This should give you a guide for what things could productively be combined into a shared spritesheet, if they can share the same material. If they can’t (some special material or shader difference) then there’s no need to try to merge them since that batch is broken anyway.

all of my games usually use just one sprite sheet for the entire game, that only requires one material (the default sprite material assigned by unity to sprites) - for example in the pinball game (listed in my sig below), all sprites are handled in 1 draw call, all sprites are placed on a 2048x2048px psd.