Files

104 lines
5.7 KiB
Markdown

# Original geometry clipping overrides
User testing reported a visible distance clipping plane during gameplay which
disappears in orbit inspection. The port selected10000 only forLV1B and3200 for
every other level.3200 is the OMediaLayer constructor default, not the original
gameplay setting for those levels. The following static recovery reads original
Neutron.exe only; original-game visual comparison remains separate.
Neutron.exe SHA-256: f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8.
EXE text file offsets equal VA minus0x400000 in these ranges.
## Original setup and decisive regression
OMediaLayer ctor DLL1004D340 initializes near20, far3200, FOV0xAAA OMT angle
units (59.9853515625 degrees). Game geometry layers are globals509A30/509A3C;
their far field is+0xC0. Original level complete-object RTTI/vtables identify
initializer virtualB4, whose stores below override those constructor values.
The near20 and FOV are retained. Sky layer509A38 has its own1000000 far plane;
this helper does not introduce missing sky rendering or sky-specific states.
Outside LEV1 initializer450580 writes float28000 at45086F to geometry layer
509A3C. VR04 initializer456AD0 writes50000 at456C04/456C4A to both geometry
layers. A gameplay3200 far plane therefore clips valid original terrain and
props in both scenes. Orbit used scene-size-derived far=radius*20 and masked
the wrong gameplay range rather than correcting the scene setting.
Original level1 geometry spansX[-11080.31,34316.65],Y[-546.06,19685.04],
Z[-18442.92,26509.07]; VR04 spansX[-6273.61,4535.86],Y[-2.03,7815.47],
Z[-7364.04,2746.19]. Geometry bounds corroborate the impact but are not used
as a substitute for the recovered original clipping values.
## Recovered initial geometry-layer far limits
All35 registered level initializers were inspected. This includes3B/E records
without establishing their normal-gameplay use. Values are world units. An
unwritten layer retains its constructor3200.
| Original class / GAM code | Initializer VA | Layer509A30 far | Layer509A3C far | Store VAs |
| --- | --- | --- | --- | --- |
|CLevel01AGame / LV1A|0x44f0e0|5000|5000|0x44f210, 0x44f256|
|CLevel01BGame / LV1B|0x44f4b0|10000|10000|0x44f5a5, 0x44f5b1|
|CLevel01CGame / LV1C|0x44f7e0|10000|10000|0x44f896, 0x44f8a2|
|CLevel01DGame / LV1D|0x44fb00|120000|120000|0x44fc35, 0x44fc41|
|CLevel01EGame / LV1E|0x44fe30|120000|120000|0x44ff65, 0x44ff71|
|CLevel01FGame / LV1F|0x450160|15000|15000|0x4502da, 0x4502f2|
|CLevel01Game / LEV1|0x450580|3200|28000|0x45086f|
|CLevel02AGame / LV2A|0x450ab0|3200|3500|0x450c21|
|CLevel02BGame / LV2B|0x450e30|50000|50000|0x45112d, 0x451173|
|CLevel02Game / LEV2|0x4513e0|3200|50000|0x4516b2|
|CLevel03AGame / LV3A|0x451890|3200|80000|0x451a3e|
|CLevel03BGame / LV3B|0x451c50|40000|40000|0x451e06, 0x451e29|
|CLevel03CGame / LV3C|0x452030|40000|40000|0x4521e6, 0x452209|
|CLevel03DGame / LV3D|0x452410|40000|40000|0x4525c6, 0x4525e9|
|CLevel03EGame / LV3E|0x4527f0|40000|40000|0x4529a6, 0x4529c9|
|CLevel03Game / LEV3|0x452c20|40000|40000|0x452dd7, 0x452dfa|
|CLevel04AGame / LV4A|0x453060|10000|10000|0x45320a, 0x45322d|
|CLevel04BGame / LV4B|0x4534c0|7200|7200|0x4535bd, 0x45364c|
|CLevel04CGame / LV4C|0x453b10|30000|30000|0x453dfb, 0x453e1e|
|CLevel04DGame / LV4D|0x454070|10000|10000|0x45421a, 0x45423d|
|CLevel04Game / LEV4|0x4544a0|30000|30000|0x4546d6, 0x4546f9|
|CLevel05AGame / LV5A|0x454960|16000|16000|0x454a94, 0x454ad6|
|CLevel05BGame / LV5B|0x454ce0|16000|16000|0x454e14, 0x454e56|
|CLevel05Game / LEV5|0x4550b0|12000|12000|0x455242, 0x455288|
|CLevel06AGame / LV6A|0x4554e0|4000|4000|0x455614, 0x455656|
|CLevel06Game / LEV6|0x4558b0|4000|4000|0x4559e4, 0x455a26|
|CLevel07Game / LEV7|0x455c80|10000|10000|0x455dff, 0x455e41|
|CLevelVR01 / VR01|0x456050|50000|50000|0x456184, 0x4561ca|
|CLevelVR02 / VR02|0x4563d0|50000|50000|0x456504, 0x45654a|
|CLevelVR03 / VR03|0x456750|50000|50000|0x456884, 0x4568ca|
|CLevelVR04 / VR04|0x456ad0|50000|50000|0x456c04, 0x456c4a|
|CLevelVR05 / VR05|0x456e50|50000|50000|0x456f84, 0x456fca|
|CLevelVR06 / VR06|0x4571d0|50000|50000|0x457304, 0x45734a|
|CLevelVR07 / VR07|0x457550|50000|50000|0x457684, 0x4576ca|
|CLevelVR08 / VR08|0x4578d0|50000|50000|0x457a04, 0x457a4a|
## Implementation boundary
Application/SceneProjection.cs supplies FarPlane(code) and CreateGameplay(code,
aspect). CreateGameplay returns the original positive-Z,0..1 depth perspective;
the existing caller applies Vulkan viewport Y flip. Code lookup is case-insensitive.
Unknown/model-only contexts retain the original generic3200 default.
The current port merges both geometry layers into one draw collection. Where the
original layers differ, it uses their larger far limit. That is an explicit port
policy which prevents truncating the layer with the longer original range; exact
per-layer clipping/masks still require recovered render-layer assignments.
LV4B is a known dynamic exception: initial7200 is stored4535BD/45364C. Task
callback453690 sets flag+530 when task value1; update4536C0 then animates far
using12000+19000*timer at453780..453792/453811..453829, finally setting22000
at45388A..45389E. The standalone helper returns the initial7200 only; task-
driven fog/color/clip animation is not implemented by this static mapping.
## Verification
ProjectionTests guard exact original outside and VR04 layer-store instructions,
map every supplied GAM code, check depth0/1 endpoints for all ranges, preserve
generic fallback and reject invalid aspect ratios. A real outside source camera
and source geometry regression counts vertices which fit the original28000
frustum but were cut by the old3200 far plane:3844 vertices are recovered in
the real LEV1/level1 source view. All three managed groups pass.
Runtime GPU/readback integration
belongs to primary; these checks do not by themselves establish rendered fidelity.