Texture Packing: Auto, Fixed, and Ordered Grid Atlas Optimization
Learn how to efficiently pack glyphs into a texture atlas using auto packing, fixed size, and ordered grid layout modes for optimal font rendering and memory usage.
Texture packing arranges glyphs into a texture atlas, a single image optimized for GPU rendering. SnowB BMF uses bin packing algorithms to organize glyphs compactly, saving memory and improving rendering performance.
Packing Modes: Auto, Fixed Size, and Ordered Grid
Section titled “Packing Modes: Auto, Fixed Size, and Ordered Grid”Three modes are available: optimize for memory, target specific output dimensions, or use a structured grid.
Auto Pack: For Maximum Memory Efficiency
Section titled “Auto Pack: For Maximum Memory Efficiency”Auto Pack determines the smallest possible texture size for your glyphs using dynamic sizing with binary search.
- Minimizes texture memory usage automatically.
- Calculates the minimum required area and disables manual size settings (Width, Height, Fixed Size).
- Best for general use where minimizing memory footprint is the top priority.
Fixed Size: For Predictable Dimensions
Section titled “Fixed Size: For Predictable Dimensions”Use Fixed Size when you need specific texture constraints, such as power-of-two dimensions for GPU performance. This mode is active only when Auto Pack is disabled.
- Ensures consistent texture sizes for platforms with specific requirements.
- Settings:
- Width/Height: Define the maximum dimensions for the texture atlas.
- Fixed Size Checkbox: Forces the output texture to match these dimensions exactly.
- Good for:
- GPU performance: power-of-two dimensions (e.g., 256x256, 512x512, 1024x1024) improve rendering speed and memory handling.
- Platform constraints: some game engines or rendering frameworks expect specific texture sizes.
Ordered Grid: For Structured Glyph Arrangement
Section titled “Ordered Grid: For Structured Glyph Arrangement”Ordered Grid arranges glyphs in a uniform row-and-column grid instead of compact bin packing. Enable it via the Ordered Grid checkbox in the Pack Config panel.
- Clean, predictable grid layout where every glyph occupies an equal cell.
- When Ordered Grid is enabled, a Columns input becomes available (minimum value: 1). This controls how many glyphs appear in each row.
- Glyphs are placed left to right, top to bottom. Each cell is sized to fit the largest glyph, so alignment stays uniform.
- Good for:
- Spritesheet production where the game engine expects grid-based glyph maps.
- Debugging and previewing individual glyphs in an ordered layout.
- Renderers that rely on fixed-cell glyph lookup rather than per-glyph coordinates.
- Consistent exports regardless of glyph count changes.
Advanced Packing Algorithms
Section titled “Advanced Packing Algorithms”SnowB BMF uses the Guillotine Bin Packing algorithm to arrange rectangular glyphs with minimal wasted space. It runs fast enough for real-time previews and supports both dynamic and fixed texture sizing.
With Auto Pack enabled, a binary search layer iterates to find the most compact square dimensions before applying the Guillotine algorithm.
Best Practices for Texture Packing
Section titled “Best Practices for Texture Packing”General Recommendations
Section titled “General Recommendations”- Prioritize Auto Pack for best memory savings.
- Use Fixed Size with power-of-two dimensions (512, 1024) for optimal GPU performance.
- Adjust Spacing: Balance minimal spacing against glyph bleeding prevention.
Troubleshooting
Section titled “Troubleshooting”- Glyphs Don’t Fit: If glyphs fail to pack in Fixed Size mode, try increasing the texture dimensions, reducing the number of glyphs, or switching to Auto Pack.
- High Memory Usage: Use Auto Pack to ensure the smallest possible texture size.