Texture cache / sprite sheet building
Hello, I was wondering if anyone had any pointers for writing a program to compile a series of arbitralily sized rectangles into another arbitrarily sized rectangle. I know this isn't really a graphics thing, but I'd imagine that it's mostly used in conjunction with graphics so figured this was the best place to start.
Obviously it *can* be done through brute force, but that seems a really wasteful approach. Also I suppose it could be done just by shoving the largest stuff in the top corner first, but again I'm not sure that'd yield the best results.
So, anyone have any pointers?
Lightmap Packing.
http://www.blackpawn.com/texts/lightmaps/
I use ^that^ for exactly what you are describing. Works great :)
http://www.blackpawn.com/texts/lightmaps/
I use ^that^ for exactly what you are describing. Works great :)
I started with the blackpawn code, then needed something better, so I wrote this instead :
Rectangle Packing Code
I use this in Ancient Galaxy at level build time for the lightmap texture packing, and also at runtime at a reduced resolution in order to fit shadow maps into a shadow map atlas.
Rectangle Packing Code
I use this in Ancient Galaxy at level build time for the lightmap texture packing, and also at runtime at a reduced resolution in order to fit shadow maps into a shadow map atlas.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement