Sign in to follow this  

Spritesheet sizes

This topic is 411 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Currently, I have a hodge-podge of sprite sorces... I have some that are a collection of individual images in a directory, I have some that are in a sprite sheet with no meta-data indicating what is where and I have some that are in a sprite sheet with identifying meta-data.

 

I want to reduce the number of sprite sheets I have in total and also ensure that they are all sprite-sheets with identifying data.

 

I have written a quick application that lets me load all sorts of sprites and name them and everything, then it exports it to a png with a csv. The question I have is what size the sprite sheets should be. My game is targeting Windows Desktops only at the moment (It is written in c# and not meant for mobile... but I may eventually be ported to mono). 

 

What is the optimal sprite sheet size? I originally was hoping that a single 512x512 sheet would be enough room, but that is turning out to not be the case. So, I started by seperating the sprites by functionality... however, even so I still can't fit all of a particular category onto a 512x512 sheet... so Should I increase the spritesheet size or bite the bullet and split it into a second sprite sheet?

 

Is there best practices regarding spritesheet size?

Share this post


Link to post
Share on other sites

It used to be the case a very long time ago that spritesheet size could become a concern because a certain GPU might not support textures that large, you're not likely to have that worry today, since no GPU has supported anything less than 2048x2048 in approximately forever -- it was long enough ago that I honestly can't remember, late 90s at least, I would think. There's no particular advantage to sizing the sprite-sheet smaller or larger, they don't even *have* to be square, or even powers of two anymore (though powers of two remain nice for mip-mapping purposes, if its a concern -- but often isn't in a 2D game). You might have a theoretical concern over wasting texels with big unused areas, but GPU memory is quite large these days and its not likely to cause any actual issues)

 

Most tools that do what you're talking about tend to take a list of images, tries to pack them in a way that approaches the optimum, and outputs whatever texture size is necessary (possibly rounded up to some hardware alignment boundary, or to the next power of two).

 

In review:

  • Power-of-two dimensions are still something nice to have if your sprites can be viewed from oblique angles (e.g. as a texture) or which can be zoomed in and out.
  • The least capable hardware you're even remotely likely to interact with supports textures of at least 2K x 2K.
  • Textures don't need to be square.

Share this post


Link to post
Share on other sites

The spritesheet size shall be less than available texture size on the target platform. You may check target GL/DirectX  specification for maximum allowed. Eg. in OpenGL 4.5 minimum supported value of MAX_TEXTURE_SIZE is 16384.

Share this post


Link to post
Share on other sites

This topic is 411 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this