Chlumsky / msdf-atlas-gen

MSDF font atlas generator
MIT License
744 stars 170 forks source link

Feature Request: overflow atlas into new atlases #20

Open mrhelmut opened 3 years ago

mrhelmut commented 3 years ago

Hello there,

I would like to suggest a new feature to atlas generation.

It seems to be pretty common to pack a font across several textures whenever the glyphs can't fit into the desired texture size.

This is especially useful in contexts like mobile gaming and huge character sets where glyphs may overflow a single 2048x2048 atlas.

Cheers! Thanks for the relevant work in distance fields generation!

Journeyman1337 commented 2 years ago

Several textures of the same width and height can easily be sent to GPU as a texture array. For example, GL_TEXTURE_2D_ARRAY in OpenGL This allows for multiple texture pages, giving much more space for glyphs than a typical texture can support.

I wrote a bin packing algorithm that can optimally place rects on multiple pages: https://gist.github.com/Journeyman-dev/d518e94961a77325c1ad8c9a56f519cd