![]() It's easy to code, fast to run, and you won't get much better without an amazing amount of work. Sort items, jam into texture in scanline order. After all my work, quite literally three months of work, I ended up saving 3% space.Īnd after we ran our compression routine over it, it actually ended up larger (which I still can't explain) so we threw the entire thing out and went back to the old algorithm. ![]() I tried a bunch of wacky heuristics - trying to find objects that fit together, doing some weighting over a bunch of desired space packing properties, rotating and flipping. So, we had that algorithm, and I decided to improve it. In an attempt to preserve squareness, our algorithm would start at 128, then increase by 128s until it came up with a result that wasn't any deeper than it was wide. You either need to hardcode a width or come up with another heuristic for this. Lay them out in your texture in scanline order, just testing stuff from the topleft pixel to the topright pixel, moving down a line, and repeating, resetting to the topleft pixel after every successful placement. ![]() Sort them by total pixels consumed, large-to-small. ![]() The algorithm we started with was simple. I spent a few months at one job coming up with a better texture packing algorithm. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |