three-ts-slug
v0.3.0
Published
TsSlug library package for generating and rendering Slug data. Slug is a font format that encodes glyphs as a series of curves and bands, allowing for efficient rendering and styling in 3D applications.
Readme
JSlug Library
This package contains the reusable Slug generation and rendering primitives extracted from the demo app.
Install
npm install three-ts-slugUsage
import { SlugGenerator, SlugLoader, SlugGeometry, SlugMaterial, injectSlug } from "three-ts-slug";API Surface
SlugGeneratorconverts OpenType-compatible font data into Slug texture and geometry data.SlugLoaderparses.sluggishbuffers back into renderable data.SlugGeometrybuilds the instanced glyph geometry used by the shader pipeline.SlugMaterialandinjectSlugintegrate Slug rendering into Three.js materials.- Types are exported from
./typesthrough the package entry point.
Notes
The demo UI and GitHub Pages showcase live outside this package in the root ts-slug/ app.
Performance Advantages
- Fully leverages the Three.js instancing system for efficient per-glyph rendering.
- Can drive very high instance counts (benchmark scene targets about 100k glyph instances).
SlugGeometryauto-adjusts internal buffer capacity with no manual capacity input required.
