Jump to content
  • Advertisement
Sign in to follow this  
razorjack

How to organize subareas on a bitmap?

This topic is 4335 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've got a question of an interesting puzzle problem for lightmap organization. The Problem is that I've different rectangle shaped areas I want to place on textures. New textures should be allocated if there are some rectangles which can't fit anywhere. How to organize this process if you want to have less memory wasting? Of course it would be also important to have a fast algorithm. Best results can be reached by bruteforce, but it becomes unpractical for a high amount of rectangles. Does anybody have an idea? ------ Sorry. My English isn't perfect. I'm from Germany. xD But I'll try my best to answer every question.

Share this post


Link to post
Share on other sites
Advertisement
I'd say, start with the largest patches. When you eventually reach the limit of a texture, start looking for smaller and smaller patches untill you've filled up the texture tightly, preferring patches that exactly match the dimensions of the leftover space.

What we did a while ago was dividing the leftover area into boxes, and trying to fill these as effectively as possible, recursively untill the leftover boxes were simply too small. We used some sort of bruteforcing, in that we tried the whole possibility tree and picked the best solution. The boxes we tried got filled for roughly 95%, quite a decent result methinks. Back then, we couldn't find much on this kind of problem though, this was all we could think up in the few weeks we were given. So perhaps you can think of a way to optimize this method... :)

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!