acdream/tools/IconForge
Erik 48c44abd4a fix(IconForge): point the texture path at the real dump directory
render.py was lifted from the scratch pipeline with its default TEXDIR still
aimed at tools/IconExtract's build output — a tool that is not in the repo.
forge.py overrides the value, so the icons built correctly and the staleness
was invisible; anyone importing render.py directly would have been sent to a
path that never existed.

Default now matches where tools/MosswartArt actually writes, and a missing
texture prints a warning instead of silently dropping out: a partial texture
set renders some parts flat grey, which reads as a lighting bug rather than a
missing extraction step.

Both icons still reproduce byte-for-byte.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-20 14:43:37 +02:00
..
ac_glyph.py feat: mosswart client icon and Asheron's Call-inspired launcher icon 2026-08-20 14:42:10 +02:00
chisel.py feat: mosswart client icon and Asheron's Call-inspired launcher icon 2026-08-20 14:42:10 +02:00
compose.py feat: mosswart client icon and Asheron's Call-inspired launcher icon 2026-08-20 14:42:10 +02:00
forge.py feat: mosswart client icon and Asheron's Call-inspired launcher icon 2026-08-20 14:42:10 +02:00
launcher.py feat: mosswart client icon and Asheron's Call-inspired launcher icon 2026-08-20 14:42:10 +02:00
README.md feat: mosswart client icon and Asheron's Call-inspired launcher icon 2026-08-20 14:42:10 +02:00
render.py fix(IconForge): point the texture path at the real dump directory 2026-08-20 14:43:37 +02:00
ring.py feat: mosswart client icon and Asheron's Call-inspired launcher icon 2026-08-20 14:42:10 +02:00
smooth.py feat: mosswart client icon and Asheron's Call-inspired launcher icon 2026-08-20 14:42:10 +02:00

IconForge

Generates acdream's application icons into assets/icons/. Provenance, palette, rights notes and the wiring live in assets/icons/README.md; this file covers how the pipeline works.

py tools/IconForge/forge.py launcher   # procedural, no game data needed
py tools/IconForge/forge.py client     # needs a DAT export in work/
py tools/IconForge/forge.py all

Modules

File Purpose
render.py Software rasterizer: z-buffer, perspective camera, Lambert key/fill/rim, Blinn specular, bilinear texture sampling, matcap materials.
smooth.py Crease-aware normal welding + PN-triangle tessellation.
ring.py Forged 3-D ring and hook meshes, plus the chrome and verdigris matcaps.
chisel.py Distance-transform bevelling: turns any 2-D mask into chiselled metal.
ac_glyph.py The ring-and-crescent sigil geometry.
compose.py Badging: fields, masks, drop shadows, contact sheets, size strips.
launcher.py Portal vortex, placement helpers.
forge.py Entry point.

The three techniques worth knowing

PN-triangle tessellation (smooth.py). The retail mosswart head is 104 triangles and renders faceted. Each flat triangle becomes a cubic Bézier patch built from its own corner positions and normals, with quadratically interpolated normals — so the silhouette genuinely rounds instead of merely shading smoothly. It needs no mesh connectivity, which matters because UV seams would otherwise pull apart. Normals are welded across coincident positions first, but only within a crease angle, so ear fins and tusk edges stay sharp while the skull rounds off.

Matcaps (ring.py). A Lambert rasterizer cannot produce chrome, because chrome is almost entirely reflection and there is nothing here to reflect. A matcap — one image of a lit sphere, sampled by the camera-space normal — is the standard cheap stand-in for an environment map. The sharp horizon band in chrome_matcap is what makes the eye read "metal" rather than "grey plastic".

Distance-transform bevelling (chisel.py). For flat shapes — the crescent, the ring, letterforms — take the distance transform of the mask, treat distance-to-edge as height, and derive normals from the height gradient. Shading those through the same matcap the 3-D meshes use keeps everything lit by one imaginary environment. The height field is blurred before differentiating: without that, the medial axis of each stroke shows through as a hatched ridge.

Gotchas

  • Creature poses need the MotionTable. Setup.PlacementFrames has no upright pose for creatures; pass the weenie's MotionTable id to the exporter or every part stacks on the origin.
  • Build a mask and its decorations in one frame. The crescent's barb and tail attach at cusp angles solved from the circle intersection. Rotating the crescent and the spikes separately mixes sign conventions and leaves the tail floating clear of the cusp.
  • The launcher path is deterministic and must stay that way: it reproduces the committed PNGs byte-for-byte, which is what makes an accidental edit show up as a diff. No RNG without a fixed seed.