acdream had no application icon on either executable. Two marks now ship, built from the game's own material rather than drawn freehand: * Client - the retail mosswart head. Not an illustration of one: the actual creature mesh (Setup 0x02000B4F part 14, skin atlas 0x05001E11, ClothingBase 0x10000344) read out of client_portal.dat through acdream's own GfxObjMesh/SetupMesh port, then smoothed, lit and graded. Palette values are sampled from that texture, including the mustard belly the Mosswart lore calls a "foul yellow". * Launcher - a forged ring enclosing a barbed crescent, rebuilt from measurements of the retail wordmark and the acclient.exe icon resource. An original construction in the same visual language, not a copy of the trademarked logo. Its warm field matches the retail client icon. Three techniques carry the render quality, all in tools/IconForge: * PN-triangle tessellation (smooth.py). The retail head is 104 triangles and renders faceted. Each triangle becomes a cubic Bezier patch built from its own corner positions and normals, so the silhouette genuinely rounds rather than merely shading smoothly - and 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. * Matcaps (ring.py). A Lambert rasterizer cannot produce chrome, because chrome is almost entirely reflection and there is nothing here to reflect. Sampling a lit-sphere image by the camera-space normal is the standard stand-in for an environment map. * Distance-transform bevelling (chisel.py). Flat shapes become chiselled metal by treating distance-to-edge as height. The height field is blurred before differentiating; without that the medial axis of each stroke shows through as a hatched ridge. Two facts worth recording, both discovered the hard way. Creature Setups define no upright pose in PlacementFrames, so the exporter must be handed the weenie's MotionTable id or all 17 parts stack on the origin. And a mosswart's eyes sit on the sides of the skull like a frog's, so a dead-on frontal turns them edge-on and the face stops reading as a mosswart at all; the hero angle is az 266 / el 32. Wiring: <ApplicationIcon> gives each executable its PE icon. The client's runtime window icon is embedded rather than copied beside the binary - a window icon has no sensible fallback if the file goes missing, and embedding survives single-file publish. WindowIconLoaderTests guards the resource names, which are coupled to LogicalName in the csproj by string alone and would otherwise fail only as a silently icon-less window. Both halves of the pipeline are deterministic and reproduce the committed PNGs byte-for-byte, so an accidental edit shows up as a diff. Solution builds clean; 14,378 tests pass on the standard hermetic lane filter, 0 failures. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
62 lines
3.2 KiB
Markdown
62 lines
3.2 KiB
Markdown
# IconForge
|
|
|
|
Generates acdream's application icons into `assets/icons/`. Provenance,
|
|
palette, rights notes and the wiring live in
|
|
[`assets/icons/README.md`](../../assets/icons/README.md); this file covers how
|
|
the pipeline works.
|
|
|
|
```bash
|
|
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.
|