Jump to content
  • Advertisement
Sign in to follow this  
DrDerekDoctors

Texture cache / sprite sheet building

This topic is 4489 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
Lightmap Packing.

http://www.blackpawn.com/texts/lightmaps/

I use ^that^ for exactly what you are describing. Works great :)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!