Hasty Briefsbeta

Bilingual

SDF vs. MSDF vs. Slug: GPU Text Rendering

7 hours ago
  • The article compares five GPU text rendering methods: texture atlas, SDF, MSDF, tessellation/Rive, and Slug (implemented in Slughorn).
  • Texture atlas is simple but blurs at different scales and is memory-heavy for large glyph sets like CJK.
  • SDF uses distance fields for better scaling but softens sharp corners; MSDF fixes corners with three channels but still bakes an atlas.
  • Tessellation methods (e.g., Rive) are resolution-independent but require geometry updates and may not handle 3D perspective well.
  • Slug renders directly from glyph outlines in the fragment shader, providing exact coverage at any scale or angle without an atlas or per-frame tessellation.
  • Slug excels in dynamic, 3D, or perspective-heavy contexts (VR/AR, GIS) and handles large glyph sets efficiently.
  • Choice depends on needs: MSDF for static/UI text, Slug for dynamic/3D text, SDF for constrained hardware, and Rive for animated vector art.