Sky colour: set 2’s point light
Why the rebuild’s Palace (st03) sky is deep purple where the game’s is white-grey with blue-grey shade. Decoded from PDUWP.exe (our reading; addresses as leads) and the stage scripts, then checked by renders of our build against xemu frames (a check, not a fit: no value below comes from footage).
The wrong step
One step of the cloud colour is missing in
the rebuild: point light 0 of light set
2. The skyglow run read it as black and
the build draws the sky model with
p0 = 0. Everything else on the list
was re-checked and is as decoded: vertex colour
scale (u8 / 255, raw), texture colour space
(raw, no gamma), blend (source alpha / one for
the clouds, per material for SC), light set 2
for model 2, draw order, glow chain.
| Step | Game | Rebuild (4efcac8) |
|---|---|---|
| Point term of SBTSCLOUD3 | sat(sat(N·P) · c5 + sky), c5 =
set 2’s point light 0 colour, P = direction to
the light × range / distance² |
c5 = 0: sky only |
| St03 result | most of the dome
t0 × (1, 1, 1);
t0 × (0.33..0.76, 0.41..0.63, 0.78..1.0)
only where the point term fades |
t0 × (0.68, 0.59, 1.0)
everywhere: purple |
| St02 result | t0 × (1, 1, 0.71..0.87) |
t0 × (0.85, 1.0, 0.83): red 15
% low, slightly green |
The point light record (H, code and data)
- Script function 0x2005 (handler 0x140206960) stores colour, position and range in the set’s 0x58-byte record (“Stage light script”). The start-up builder 0x140199670 turns them into light records k = 2 and k = 3 of the set (index set·8 + 0x40 + k, kind 2): colour as byte / 255 at +0, position at +0x30, the range’s raw f32 at +0x64.
- 0x140199970(set) points light slot 2 (0x14057f3e0) at the set’s k = 2 record. Only for set 0 can a live effect light take that slot; for sets 1..3 it is always the script’s light. So while the sky object draws model 2 under set 2, slot 2 is set 2’s point light 0.
- The shared stage vertex upload (0x1402a6750)
writes
cP0_POS(c7) = the light’s position in model space with w = the range (copied from +0x64 to +0x5C of the record). The pixel bind (0x1402a7880) writes c5 = its colour. The sky model sits at the camera, so the light stays fixed in the world. - SBTSCLOUD3 vertex shader:
P = (dir·T, dir·B, dir·N) × range / distance², dir = unit vector from the vertex to the light, packed× 0.5 + 0.5into COLOR1. Pixel shader: the packed value is clamped to [−1, 1], unpacked(x − 0.5) × 2(so each component ends in [−3, 1]), thenpoint = sat(sat(N·P) · c5 + sky)andcolour = sat(t0 · min(sat(N·L) · light + point, 1)). The range is not a cut-off: it is the numerator of the falloff. - Who reads it (skycol2
r2): slot 2 is uploaded for every material
of the set, but only lit shaders read it. Stage
model 2 holds five shaders on the 19 versus
stages:
sbtscloud3(the point term above), and the unlitsc,scal(see “Stage shaders”),svc,svcal(vertex colour only). So on model 2 the cloud layer alone takes the point term. Model 1 (far scenery, set 3:sd,sbts,sbtsrefs) reads slot 2 through the SD / SBTS point term, but set 3’s point light 0 is black on all 19 stages (and set 1’s colour too). - With ranges of 1e8..1e9 and a dome 3 000..12
000 units away,
k = range / distance²is above 1 on most of the dome: the normal component of P is clamped to 1 and the point term saturates tosat(c5 + sky). Where k drops below 1 (far rim) the colour falls back towardsky + N·L · light. On st03 that gives a white core over the Palace and blue-violet cloud toward the horizon, which is what the xemu intro shows.
Set 2 on every versus stage (script values; k over the cloud dome’s vertices)
Cloud dome (model 2, SBTSCLOUD3): 377 vertices on most stages, rim radius 11 100..12 800, top 2 700..4 700 above the origin.
| Stage | Light | Sky | Point light 0: colour, range | k p10 / p50 / p90 | Fog of set 2 |
|---|---|---|---|---|---|
| st01, st08 | (255, 70, 0) | 0 | none | none | |
| st02 | (45, 97, 40) | (181, 187, 180) | (113, 94, 0), 9e8 | 5.4 / 15.6 / 80 | exp 8e-5, black |
| st12 | (28, 33, 26) | (11, 11, 11) | (90, 90, 90), 9e8 | 5.4 / 16.2 / 113 | exp 1.4e-4, black |
| st22 | (17, 17, 17) | (50, 50, 50) | (89, 89, 89), 9e8 | 4.8 / 12.8 / 60 | exp² 2e-5, (49, 49, 49) |
| st03 | (110, 55, 150) | (85, 105, 200) | (225, 255, 220), 1e8 | 0.77 / 2.4 / 14 | linear 1 602..12 822, (30, 45, 55) |
| st13 | (238, 190, 28) | (252, 210, 67) | none | linear 1 602..12 822, (250, 200, 58) | |
| st23 | (250, 98, 87) | (249, 118, 101) | (187, 137, 74), 1e9 | 8.8 / 27 / 73 | none |
| st04, st24 | (55, 55, 55) | (140, 140, 140) | (155, 155, 155), 1e8 | 0.62 / 1.7 / 5.5 | linear 2 919..12 606, (20, 20, 20) |
| st14 | (37, 39, 39) | (167, 188, 171) | none | exp² 1.4e-4, (11, 19, 18) | |
| st05 | (18, 18, 18) | (119, 103, 83) | (145, 145, 145), 1e8 | 0.58 / 1.6 / 6.9 | linear 8 031..13 512, (16, 11, 9) |
| st15 | (160, 160, 160) | (124, 124, 124) | (200, 200, 200), 1e8 | 0.58 / 1.6 / 6.9 | linear 8 031..13 512, (30, 30, 30) |
| st25 | (224, 218, 200) | (140, 150, 160) | (255, 200, 118), 1e8 | 0.58 / 1.6 / 6.9 | linear 9 192..15 498, (20, 0, 30) |
| st06 | (100, 100, 100) | (103, 106, 107) | (25, 195, 24), 5e6 | 0.04 / 0.14 / 0.29 | linear 1 317..12 999, (26, 31, 29) |
| st16 | (80, 100, 190) | (70, 67, 67) | black, 5e6 | linear 5 778..12 192, (20, 11, 9) | |
| st26 | (68, 25, 5) | (80, 80, 80) | (159, 159, 179), 5e6 | 0.04 / 0.14 / 0.29 | linear 3 390..10 797, (11, 9, 14) |
| st07 | (58, 58, 58) | (27, 5, 10) | (90, 74, 77), 1e8 | 0.59 / 1.7 / 9.6 | none |
| st17 | (45, 54, 58) | (15, 18, 22) | (50, 65, 96), 1e8 | 0.58 / 1.5 / 5.3 | linear 7 653..13 524, (79, 104, 118) |
Ground colour of set 2 is 0 on every stage.
Positions (game order): st02 / st12 / st22
(−864.0, 1 006.3, 4 505.4); st03 (−1 692.1, 1
395.2, 1 733.6); st23 (105.6, 961.3, 0); st04 /
st24 (−2 834.3, −614.4, −647.6); st05 / st15 /
st25 / st07 / st17 (−1 568.5, −293.6, 4 521.8);
st06 / st16 / st26 (−595.8, −258.8, 0). The
rebuild is wrong by the point term on the 14
stages with a coloured light: strongly on st03,
st04 / st24, st05 / st15 / st25, st12, st22,
st07, st17 (dark or tinted sky,
bright neutral light), mildly on st02 and st23
(their sky is already bright),
barely on st06 / st26 (k under 0.3). St13, st14,
st01, st08 and st16 have no point term and are
right today.
Check against footage (renders of our build with the light switched on by a probe flag)
Same intro camera as the footage (st03 shot 2, st02 shot 0), 1280 × 720, mean colour of a sky box; the cloud scroll phase differs between frames, which moves a mean by up to ± 0.1.
| Sky | Mean RGB | R : G : B | Clipped pixels |
|---|---|---|---|
| St03 xemu, three frames | (0.38..0.66, 0.43..0.70, 0.51..0.76) | 0.75..0.87 : 0.84..0.92 : 1 | 1..36 % |
| St03 ours today, PC look | (0.24, 0.23, 0.39) | 0.62 : 0.59 : 1 | 0 |
| St03 ours + point light, PC look (two phases, the second without glow) | (0.20, 0.23, 0.27), (0.36, 0.39, 0.43) | 0.74..0.84 : 0.85..0.91 : 1 | 0..7 % |
| St03 ours + point light, Xbox look (two phases, the second without glow) | (0.16, 0.19, 0.23), (0.27, 0.31, 0.35) | 0.70..0.77 : 0.83..0.89 : 1 | 0 |
| St02 xemu, three frames | (0.61..0.64, 0.54..0.58, 0.37..0.39) | 35..40 % | |
| St02 ours today, Xbox look | (0.61, 0.51, 0.30) | 19 % | |
| St02 ours + point light, Xbox look | (0.70, 0.60, 0.36) | 39 % | |
| St02 ours today / + point light, PC look | (0.75, 0.68, 0.46) / (0.76, 0.69, 0.48) | 52 / 55 % |
- St03: the hue error is the
point light (H): purple becomes
the footage’s blue-grey with a white core, in
both looks. Open (settled
by skybright 11-15, the dropped
svcbackdrop): our st03 sky is still about half as bright as the xemu frames (their dark half reads (0.24, 0.28, 0.35), ours (0.10, 0.14, 0.17)). Not explained by anything decoded here; leads below. - St02: the white sky of private recording 8 was the pre-skyglow build. Today’s Xbox look is within 0.03..0.09 of the xemu means and reaches the same clipped share with the point light. The PC look is brighter (52 % clipped) because no PC pixel shader reads fog, so the clouds lose set 2’s fog factor (0.40..0.71 on st02): that is the decoded PC picture, not an error (H PC code; no PC footage of this sky in the library to confirm).
- St13 (no point light) and st23 match their xemu pans by eye in the Xbox look (yellow-green glow; fiery red).
- With the light on, small violet specks remain on st03 where N·P is negative. The PC shader’s one-sided clamp lets tangential components of P reach −3; an Xbox colour interpolator holds [0, 1], so P stays in [−1, 1] there and the specks should be fewer (M: hardware rule, the Xbox vertex program is not re-read for it). (skybright 11-15: re-read, H: the packed vector goes out through the second colour output. The xemu frames show faint violet fringes too.)
Implementation notes for the
rebuild (built in skycol 11-15:
pdconv points,
PdData.set_point_light for every
material under sets 1..3, the Xbox look’s [0, 1]
clamp in the cloud shader; test
godot/tests/test_skycol.gd)
- pdconv: write each set’s point lights into
light.json(points: colour 0..1, position in the script’s order, range), from the 0x2005 records it already reads. PdData: give the sky model’s materials (light set 2) that set’s point light 0:p0_c5= colour,p0_range= range,p0_pos= position (game order, z mirrored, × 0.1), fixed in the world. The cloud shader already has the term. Set 0 keeps its effect-light rule.- Xbox look: clamp the packed point vector to [0, 1] before unpacking (PC look keeps [−1, 1]).
- Expect at st03 intro shot 2: sky R : G : B about 0.8 : 0.87 : 1 (today 0.62 : 0.59 : 1), a white core toward the light, mean luma about 0.2..0.4 depending on the scroll phase. At st02 intro shot 0, Xbox look: about (0.70, 0.60, 0.36), 39 % clipped.
- Re-shoot st04 / st24, st05 / st15 / st25, st07 / st17, st12 and st22 after the change: their skies gain the most after st03 and have not been compared with footage.
- (skybright 11-15: settled.) The
remaining 2 × on st03 against xemu is the sky
model’s opaque
svcbackdrop dome, which pdconv drops: “St03 sky brightness against the Xbox”.