Sign in to follow this  
riruilo

Algorithms to create sprite sheets?

Recommended Posts

Hi friends! I have to create a sprite sheet processor for a game I'm doing for the iPhone. That is, given several images (different sizes, non-square and non-power-of-two) put all of them in one (or more) files. Requeriments: -I'd to maximize the number of images I put on the sprite sheet. -I'd to minimize the size of sprite (must be square and power of two) and the number of sprite sheets (iPHone supports 1024*1024 so I guess I have to create several sprite sheets ) -Apart from creating this file, I have to create another one with image names and texture coordinates. Guess this is the easiest part. My question is: what kind of algorithm should I use to solve this max/min problem? All ideas are welcome! Thanks in avanced!

Share this post


Link to post
Share on other sites
Search the internet and/or the forum archives for 'bin packing' and you'll find plenty of info.

Share this post


Link to post
Share on other sites
I don't know if you *need* to write it or just have a solution, but it's already been done many times. This tool is pretty handy and does exactly what you are asking:

http://forums.indiegamer.com/showthread.php?t=18027

Which is to create a texture atlas and corresponding data file.

Edit: You can also check out ImageMagick and its Montage feature :)

Share this post


Link to post
Share on other sites
Thanks for the info, I will so it!

I'd like to write it, instead of using another solution, but it's nice to have several choices.

Share this post


Link to post
Share on other sites
If you want to see how I created my own sprite sheet for use in OpenGL, have a look at this video tutorial.

http://www.marek-knows.com/downloadSection.php?Topic=OpenGL&pg=1#OpenGL6

Share this post


Link to post
Share on other sites
Quote:
Original post by mmakrzem
If you want to pay to see how I created my own sprite sheet for use in OpenGL, have a look at this video tutorial.

Fixed.
Off topic but why do you never say this in your posts?

Share this post


Link to post
Share on other sites

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