Slug text in 3D
← All examples74_slug_3d
Text on a surface in perspective is where an atlas rasterizer struggles most: the glyph quads are foreshortened, so a baked distance field is sampled at a rate it was never built for and goes soft or aliases. Slug evaluates the outlines per pixel, so the only thing it needs is for the quads to keep a pixel of margin once projected. mk_slug_draw_3d uses the dilating vertex shader for exactly that: each corner is pushed outward by however much the current projection requires, and the em-space sample coordinate is shifted by the same amount so the glyph itself does not move. Press C to cycle the stock analytic renderer, a custom fragment shader, and an ordinary lit mesh extruded and beveled from the shaped glyph outlines. In mesh mode, B switches between inset and outward round-over profiles. ./scripts/build-linux.sh --slug --shaping --target=74_slug_3d --run Controls: drag = orbit, wheel = distance, Space = pause spin, C = rendering mode, B = bevel profile, O = background, ESC = quit.

Runs the WebAssembly build on this page. Click the canvas to give it keyboard focus.
- Number
- 74
- Tags
- Requires
MODKIT_ENABLE_SLUG- Capture frame
- 30
- Source
examples/74_slug_3d/main.c
Build and run
./scripts/build-linux.sh release --target=74_slug_3d --run