three-text-troika-3d
Installation
SKILL.md
High-Quality 3D Text with Troika and SDF Rendering
What this builds
A production-grade 3D text rendering system using troika-three-text that displays crisp, resolution-independent text in a Three.js scene. Unlike Three.js's built-in TextGeometry (which extrudes font outlines into heavy triangle meshes), troika uses Signed Distance Field (SDF) rendering on a single quad per glyph, giving you sharp text at any camera distance with a fraction of the geometry cost.
- SDF-based glyph rendering: crisp at any zoom level, no jagged edges, no LOD management
- Standard .ttf/.otf/.woff font loading with automatic SDF atlas generation
- Full text layout engine: word wrap, alignment, line height, letter spacing, max width
- Custom Three.js materials applied to text (ShaderMaterial, MeshPhysicalMaterial with envMap)
- Outline, stroke, drop shadow, and glow effects via SDF distance manipulation
- Text anchoring for precise positioning relative to scene objects
- Proper disposal and font caching
- R3F integration via drei's Text component (which wraps troika internally)