tools(probe): extend RainMeshProbe with sky-surface LUMINOUS audit

Added per-Surface dump that decodes Type bits and prints whether the
LUMINOUS (0x40) flag is set on each. Targets all 27 sky surface IDs
referenced by Holtburg's Region — every dome variant (0x010015EE/F0/F1/F2),
the inner sky/star sheet (0x010015EF), sun (0x01001F67/0x01001348), moon
(0x01001F6A), every cloud variant (0x01004C35..0x01004C3A, 0x010015B6),
and rain (0x01004C42/0x01004C44 — control row).

Result: zero of the 27 surfaces have the LUMINOUS bit set. The previous
SkyRenderer comment that claimed dome+clouds carried the bit was wrong;
the differentiator between "self-lit texture passthrough" and
"ambient+diffuse-tinted" sky meshes is purely the Surface.Luminosity
FLOAT (1.0 dome/sun/moon, 0.0 stars/clouds, 0.1484 rain). This fed
directly into the emissive-default fix in the next commit.

Bonus finding: cloud surface 0x08000023 has Translucency=0.25 (not 0)
which the Translucency plumbing fix in the next commit will also pick
up — clouds will render at 75% opacity, matching retail's curr_alpha
derivation (D3DPolyRender::SetSurface at 0x59c767).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-04-27 12:04:23 +02:00
parent b8e0857b87
commit a6e7108122

View file

@ -28,8 +28,47 @@ using var dats = new DatCollection(datDir, DatAccessType.Read);
uint[] gfxIds = { 0x01004C42u, 0x01004C44u };
foreach (uint gid in gfxIds) ProbeRain(dats, gid);
// Phase 7c: also dump every sky surface we know to test the LUMINOUS flag.
// Two existing code comments contradict each other about whether Dereth's
// dome/sun/moon meshes carry the LUMINOUS bit. Resolve empirically.
Console.WriteLine();
Console.WriteLine("================ Sky Surface LUMINOUS audit ================");
uint[] skySurfaceIds = {
0x08000048u, 0x08000049u, 0x0800004Au, 0x0800004Bu, // dome 0x010015EE
0x0800004Du, // star sheet 0x010015EF
0x0800004Eu, 0x0800004Fu, 0x08000050u, 0x08000051u, // dome 0x010015F0
0x08000053u, 0x08000054u, 0x08000055u, 0x08000056u, // dome 0x010015F1
0x08000057u, 0x08000058u, 0x08000059u, 0x0800005Au, // dome 0x010015F2
0x080000D1u, // celestial 0x01001348
0x080000D2u, // sun-like 0x01001F67
0x080000D6u, 0x080000D7u, // moon 0x01001F6A
0x080000D4u, // cloud 0x01004C36/37
0x08000023u, // cloud 0x01004C35
0x08000024u, 0x08000025u, // cloud 0x01004C39/3A
0x080000D5u, // dome variant 0x010015B6
0x080000C5u, // RAIN — control row, expected NO Luminous
};
foreach (uint sid in skySurfaceIds) ProbeSkySurface(dats, sid);
return 0;
static void ProbeSkySurface(DatCollection dats, uint sid)
{
if (!dats.TryGet<Surface>(sid, out var s) || s is null)
{ Console.WriteLine($" Surface 0x{sid:X8} (NOT FOUND)"); return; }
uint t = (uint)s.Type;
bool luminous = (t & 0x40u) != 0u;
Console.Write($" Surface 0x{sid:X8} Type=0x{t:X8} Luminous={(luminous ? "YES" : "no ")} Lum={s.Luminosity:F4} Trans={s.Translucency:F4} ");
// Decode bits inline.
var bits = new (uint mask, string n)[] {
(0x01u,"B1Solid"),(0x02u,"B1Image"),(0x04u,"B1ClipMap"),(0x10u,"Translucent"),
(0x20u,"Diffuse"),(0x40u,"Luminous"),(0x100u,"Alpha"),(0x200u,"InvAlpha"),
(0x10000u,"Additive"),(0x20000u,"Detail"),
};
Console.WriteLine(string.Join("|", bits.Where(b => (t & b.mask) != 0).Select(b => b.n)));
}
static void ProbeRain(DatCollection dats, uint gid)
{
Console.WriteLine();