The torch/point-light look was wrong two ways, both now fixed against the
named retail decomp (calc_point_light 0x0059c8b0) via our verified
LightBake.PointContribution port:
1. Per-PIXEL → per-VERTEX. accumulateLights moved from mesh_modern.frag to
mesh_modern.vert so point lights Gouraud-interpolate across each triangle
the way retail's fixed-function T&L does. The per-pixel eval made a tight,
hard-edged "spotlight" pool on flat walls; per-vertex is a soft, broad
gradient. frag now just consumes the interpolated vLit (+ fog + flash).
2. Simplified ramp → faithful calc_point_light shape. The live point/spot
branch was max(0,N·L) × linear(1−d/range) × cap — missing two terms our
LightBake.cs port already has:
• half-Lambert WRAP (1/1.5)·(N·D + 0.5·d), D un-normalised — a face
angled away from a torch still catches light (retail's soft terminator)
instead of snapping to black.
• distance-cube NORM branch norm = distsq>1 ? distsq·d : d — inverse-
square-ish soft far halo + punchy near field, vs the flat linear ramp.
Per-channel no-blowout cap (min(scale·color, color)) retained.
The per-channel cap was also added to the legacy mesh.frag for consistency.
A read-only retail-vs-acdream lighting audit (11-agent workflow) confirmed
these two as the cause of the "better but a bit off" look and cleared the
ambient/sun/terrain/color-space chain as already faithful. Remaining
confirmed divergences (per-object light selection; dungeon static vertex
bake) are filed as the next fixes.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>