iDevGames Forums
TextureAtlas generator - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html)
+--- Thread: TextureAtlas generator (/thread-871.html)



TextureAtlas generator - zombie - Aug 12, 2009 02:04 AM

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


TextureAtlas generator - Skorche - Aug 12, 2009 09:06 AM

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.

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. Rasp


TextureAtlas generator - zombie - Aug 12, 2009 10:34 AM

Packing algorithm is based on: http://www.blackpawn.com/texts/lightmaps/default.html


TextureAtlas generator - firidolfo - Aug 12, 2009 12:28 PM

thanks for the link. very nice.


TextureAtlas generator - peteosx - Aug 24, 2009 12:48 PM

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.


TextureAtlas generator - Jamie W - Aug 24, 2009 01:45 PM

I made one too (with packing algorithm based on the blackpawn.com one too), check out my sig.


TextureAtlas generator - Duktigt - Aug 28, 2009 02:03 AM

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.


TextureAtlas generator - Telemachus - Sep 12, 2009 03:18 PM

I built one tooSmile
I made a simple photoshop script using information from the aforementioned blackpawn article: http://richardjdare.com/blog/2009/08/texture-atlas-maker/


TextureAtlas generator - kshep - Oct 16, 2009 07:13 AM

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


TextureAtlas generator - Frank C. - Oct 16, 2009 09:59 PM

Telemachus Wrote:I built one tooSmile
I made a simple photoshop script using information from the aforementioned blackpawn article: http://richardjdare.com/blog/2009/08/texture-atlas-maker/
The custom data template and the fact that you're left with a layered Photoshop file makes this especially useful. Thanks!