Jump to content
  • Advertisement
Sign in to follow this  
Adventus

Texture placement within atlas

This topic is 3992 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

As a side project i've been writing a few handy texture atlas tools and i've struck upon an automation problem.... ....Assuming arbitarily sized textures (or at least 2^n), Is there an efficent algorithm for determining the best placement of each texture within the atlas? One idea i had was to start with an AABB quadtree, then each time i place a texture subdividing it into 4 more nodes (one holding the placed texture the other 3 at the vertices of the parent node).... then each time i place another texture i traverse the tree until i find the unused AABB which is as close to the size of the texture as possible(but still greater than). This will probably work, but im wondering if this is just a standard problem which already has some optimised solutions? Im guessing there is at least a few good approximate solutions, or even an optimal one, but im probably not up to the math....

Share this post


Link to post
Share on other sites
Advertisement
The magic google (and forum) search words are "rectangle packing" and "bin packing". Unfortunately this problem is NP complete, but there are some approximate solutions that work quite well.

There are other threads on this forum that discuss this, just search for "rectangle packing".

Share this post


Link to post
Share on other sites
Ok thanks, i guessed it was a pretty standard problem. Thanks for the google words, thats all thats really required nowdays.

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!