Entry 47
The title's lit icons against VU1: the directional term was doubled
Filescrates/piney-gs/src/convert.rscrates/piney-draw/src/lib.rstools/vu.pytools/test_demo_rs.py
The user found the title's icons wrong: grey, dull sides, and a selected icon that looked broken. In 43 they were the one part of the title that differed from the CPU GS model, and that model draws without light. So the title agent checked the lighting against the game's own VU1 code instead.
How it was checked
test_icon_lighting in tools/test_demo_rs.py runs the port's title to
the menu. At two frames it takes each lit object the port draws (12
objects, 1,964 vertices) with the port's lwMatrix, and runs it through
the game's own code:
Init's light: theccLightconstructor,ccOmniLight::Init,ccSetColor, the matrix,AddGrp;ccDrawEnv::SetLightMatrixandccSetMatrixPacketin eemu, with VU0 in macro mode;- VU1's
mc_SetMatrix,mc_SetObjParam,mc02_Start00/01andmc_DrawTriL, on a new micro-mode interpreter (tools/vu.py'sVu).
What it found
- The setup was right. The port's
Lightsequalled VU1's registers aftermc_SetMatrix: the directions (vf05-07), the doubled colours (vf09-11) and the ambient (vf12). - The formula was not. Only the vertex colours differed: 585 of 1,964, all on faces the light reaches.
- The cause. VU1 dots the raw s8 normal, whose length is 64, with the
direction, and scales the ambient by 128. Against the unit normal
piney-gsuses, the doubled colours therefore count half.mmatcounted them whole, so every lit face was twice as bright in its directional term. The fix is a factor of 0.5, and the doc onpiney_draw::Lightsnow gives both forms.
With the fix all 1,964 vertices match VU1 exactly, none off by one.
What the user saw
The bug made lit faces brighter, not darker. The dull sides are how the game lights them:
- The one white omni light sits at (-8500, 0, 6500); the icons are at x = -22400.
- A face turned away from the light gets only the ambient, 0.35 of its texture.
- The selected icon's texture is white, so mid-spin it shows as a grey-white bar under the same light.
No title animation carries a light or an ambient, title1 has no light
chunk, and cc3d is the active environment whenever the title draws, so
nothing else lights the icons.
Checked
test_demo_rs.py: 16 tests OK,test_icon_lightingamong them.piney-gs: 12 tests.piney-demoandpiney-gametests pass; clippy and fmt are clean.
- Other lit models. The desktop's and the field's lit models, if any, have not been checked against VU1 the same way. Only the title builds
Lightsso far. - The "transparency" report. It is not reproduced beyond this. After 63635fb and this fix, the GPU matches the CPU GS model on the desktop's text and the title's unlit parts.