TextureAtlas generator
Hi iPhone developers,
If you spend a lot of time merging individual images into one TextureAtlas, this might be interesting for you: I posted a Perl script for generating a TextureAtlas png from a config files, which basically enumerates the texture images that should go into the TextutreAtlas..
http://zombiesmash.gamedrs.com/?p=114
Check it out!
We are working on upcoming ZombieSmash! using cocos2d.
- Zombie
----
http://www.zombiesmash.gamedrs.com
http://www.twitter.com/zombiesmash
If you spend a lot of time merging individual images into one TextureAtlas, this might be interesting for you: I posted a Perl script for generating a TextureAtlas png from a config files, which basically enumerates the texture images that should go into the TextutreAtlas..
http://zombiesmash.gamedrs.com/?p=114
Check it out!
We are working on upcoming ZombieSmash! using cocos2d.
- Zombie
----
http://www.zombiesmash.gamedrs.com
http://www.twitter.com/zombiesmash
I wonder how that algorithm compares to the one I wrote a couple weeks ago in terms of spacial efficiency. Mine sorted by height, picked the tallest box that would fit in the given area. That gave you a strip to the right and box below to recursively descend into. Throwing in randomly sized boxes it usually got > 96% full.
I never got around to implementing actual image packing as I didn't really have a use for it, but I liked the simplicity of the recursion in Ruby.
Now I'm going to have to try that algorithm too.
I never got around to implementing actual image packing as I didn't really have a use for it, but I liked the simplicity of the recursion in Ruby.
Code:
def pack_strips(w, h, boxes)
avail = boxes.select{|box_w, box_h| box_w <= w and box_h <= h}
return [] if avail.empty?
box_w, box_h = box = avail.pop
strip = pack_strips(w - box_w, box_h, avail)
remain = pack_strips(w, h - box_h, avail - strip)
return (strip + remain) << box
end
Now I'm going to have to try that algorithm too.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Packing algorithm is based on: http://www.blackpawn.com/texts/lightmaps/default.html
thanks for the link. very nice.
Or you could just use the command line tool ImageMagic. That tool saved my sanity, and it can do image conversion etc on the fly.
I made one too (with packing algorithm based on the blackpawn.com one too), check out my sig.
Blog - http://bit.ly/mrqwak
Games - http://bit.ly/mrqwakgames
Twitter - http://www.twitter.com/mrqwak
I'm doing this in my sprite engine by runtime. works like a charm. An interesting idea is to size sort all images and adding them in "largest to smallest" order.
I built one too
I made a simple photoshop script using information from the aforementioned blackpawn article: http://richardjdare.com/blog/2009/08/tex...las-maker/

I made a simple photoshop script using information from the aforementioned blackpawn article: http://richardjdare.com/blog/2009/08/tex...las-maker/
Here's another free tool that I found useful for making texture atlases:
http://zwoptex.zwopple.com/
It's an online flash app that can optimally pack sprites into a sheet. It then lets you export the texture and a plist file (easy to read in objc) with all of the details. It's a very nice tool. one of the benefits of this over some of these scripts is that it also will trim any excess empty space from the edges of the uploaded images. This is a big win when trying to pack things optimally.
Looks like they are also working on integrating this with Cocos 2D, which would be great as I found the texture atlas generation script that comes with Cocos2D to be lacking since it doesn't trim sprites before adding them to the sheet.
-Keith
http://zwoptex.zwopple.com/
It's an online flash app that can optimally pack sprites into a sheet. It then lets you export the texture and a plist file (easy to read in objc) with all of the details. It's a very nice tool. one of the benefits of this over some of these scripts is that it also will trim any excess empty space from the edges of the uploaded images. This is a big win when trying to pack things optimally.
Looks like they are also working on integrating this with Cocos 2D, which would be great as I found the texture atlas generation script that comes with Cocos2D to be lacking since it doesn't trim sprites before adding them to the sheet.
-Keith
Telemachus Wrote:I built one tooThe custom data template and the fact that you're left with a layered Photoshop file makes this especially useful. Thanks!
I made a simple photoshop script using information from the aforementioned blackpawn article: http://richardjdare.com/blog/2009/08/tex...las-maker/