-
Notifications
You must be signed in to change notification settings - Fork 442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Texture atlas creation #2
Comments
Brain failure #2. Also I don't know if such thing as dot product exists here :-)
This class now stores the tree in flat array, making it easier for user to query the contents, but the internals are much more complicated. This solution already reduces allocation count by count of nodes in the tree, future work might remove the per-shape allocation altogether by using large typeless array and placement-new etc.
I think I would be genuinely interested in doing this based on the RectangleBinPack Algorithm which is something I wanted to implement a while ago. This will be looked at after the windowless opengl fix. |
Would be great to finish this before the issue turns 10 years old, heh. Just for the record, an alternative and very specialized algorithm was added recently: https://blog.magnum.graphics/backstage/pot-array-packing/ |
LMFAO!!!!! omg. Better late than never! =) have fun |
Okay, it had to take 11 years after all. As of 66bf0b2 there's a new TextureTools::AtlasLandfill packer, which is based on a very simple idea of tracking currently filled height and filling the image in a linear fashion bottom-up. Thus, "Landfill". It's also capable of incremental packing and has support for texture arrays. Combined with pre-sorting the items from highest to shortest and making the items all the same orientation it has efficiency comparable to stb_rect_pack, while being significantly faster. This is just an initial implementation aimed at glyph packing however, its efficiency and speed properties, especially for packing larger and more varying input sizes, are likely to improve further. |
Barebone joke implementation is now in https://github.com/mosra/magnum/blob/master/src/TextureTools/Atlas.cpp. Also -- would it be possible to preestimate atlas size to avoid specifying it manually?
The text was updated successfully, but these errors were encountered: