Jump to content

  • Log In with Google      Sign In   
  • Create Account

Tom Atom

Member Since 20 Nov 2010
Offline Last Active Today, 01:03 PM

Posts I've Made

In Topic: Sprite Atlas Tool

12 October 2012 - 03:44 AM

What is the bin packing algorithm you use? Just curious since I did research on that topic a few years back (results available on my website).


I read lot of articles but following 2 helped me a lot. Especially the first one which gives good idea but the implementtion is up to you:

http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.140.200 (click the pdf icon)
http://www.blackpawn.com/texts/lightmaps/

The resulting algorithm seems to be similar to what you have on your page - after placing any rectangle I am also tracking all possible new rectangles and for next sprite I am choosing the smallest one from these. I am starting with one big bin - tower of sprites with width of the widthest and changing (see the rules in linked file) step by step to one long row with hight of the highest sprite. There are also always severeal tries in each "bin" incorporating some chance in sorting the rects but generally the biggiest are placed as first.

PARTNERS