feat: mosswart client icon and Asheron's Call-inspired launcher icon

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>
This commit is contained in:
Erik 2026-08-20 14:42:10 +02:00
parent 4d84456c21
commit a1ffe77af4
43 changed files with 2210 additions and 0 deletions

View file

@ -0,0 +1,59 @@
// One-off: walk a creature Setup -> parts -> GfxObj -> Surface ids, and walk its
// ClothingBase texture/palette overrides, so we can dump the real skin textures.
using System.Globalization;
using DatReaderWriter;
using DatReaderWriter.DBObjs;
using DatReaderWriter.Options;
using SysEnv = System.Environment;
static uint Hex(string s) => uint.Parse(s.StartsWith("0x", StringComparison.OrdinalIgnoreCase) ? s[2..] : s,
NumberStyles.HexNumber, CultureInfo.InvariantCulture);
uint setupId = Hex(args[0]);
string? exportPath = args.Length > 2 ? args[2] : null;
uint motionTableId = args.Length > 3 ? Hex(args[3]) : 0;
uint clothingId = args.Length > 1 ? Hex(args[1]) : 0;
string datDir = SysEnv.GetEnvironmentVariable("ACDREAM_DAT_DIR")
?? Path.Combine(SysEnv.GetFolderPath(SysEnv.SpecialFolder.UserProfile), "Documents", "Asheron's Call");
using var dats = new DatCollection(datDir, DatAccessType.Read);
if (exportPath is not null)
return MosswartArt.Export.Run(dats, setupId, clothingId, exportPath, motionTableId);
if (!dats.TryGet<Setup>(setupId, out var setup) || setup is null) { Console.Error.WriteLine("no setup"); return 1; }
Console.WriteLine($"Setup 0x{setupId:X8}: {setup.Parts.Count} parts, radius {setup.Radius:F2} height {setup.Height:F2}");
var allSurfaces = new SortedSet<uint>();
for (int i = 0; i < setup.Parts.Count; i++)
{
uint gid = setup.Parts[i];
if (!dats.TryGet<GfxObj>(gid, out var g) || g is null) { Console.WriteLine($" part[{i}] gfx 0x{gid:X8} MISSING"); continue; }
var surfs = string.Join(", ", g.Surfaces.Select(s => $"0x{(uint)s:X8}"));
Console.WriteLine($" part[{i}] gfx 0x{gid:X8} verts={g.VertexArray?.Vertices?.Count ?? 0} surfaces=[{surfs}]");
foreach (var s in g.Surfaces) allSurfaces.Add((uint)s);
}
if (clothingId != 0 && dats.TryGet<ClothingTable>(clothingId, out var ct) && ct is not null)
{
Console.WriteLine($"\nClothingBase 0x{clothingId:X8}: {ct.ClothingBaseEffects.Count} base effects, {ct.ClothingSubPalEffects.Count} subpal effects");
foreach (var kv in ct.ClothingBaseEffects)
{
Console.WriteLine($" setup 0x{kv.Key:X8}:");
foreach (var ce in kv.Value.CloObjectEffects)
{
Console.WriteLine($" part {ce.Index} gfx 0x{ce.ModelId:X8}");
foreach (var te in ce.CloTextureEffects)
{
Console.WriteLine($" tex 0x{te.OldTexture:X8} -> 0x{te.NewTexture:X8}");
allSurfaces.Add((uint)te.NewTexture);
}
}
}
foreach (var kv in ct.ClothingSubPalEffects)
Console.WriteLine($" subpal key {kv.Key}: icon 0x{kv.Value.Icon:X8} ranges={kv.Value.CloSubPalettes.Count}");
}
Console.WriteLine("\nALL SURFACE IDS:");
Console.WriteLine(string.Join(" ", allSurfaces.Select(s => $"0x{s:X8}")));
return 0;