Files
Neutron/docs/analysis/water-collision.md
T

4.3 KiB

NC shape collision registration

Static original EXE/OMT evidence, 2026-10-25. Original files were read only; no original instructions were executed. This corrects the earlier statement in original-collision.md that all 2,869 lab triangles reach static registration. The polygon registration function has no general decorative-material filter, but its caller omits entire shapes whose names begin with NC.

Recovered call path

Addresses are preferred Neutron.exe VAs. For these .text addresses the file offset is VA minus 0x400000. EXE SHA-256: f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8.

LV1B initialization calls game complete-object slot 0x158 at 0x44F569. CLevel01BGame complete vtable 0x4C3CD0, slot 0x158, resolves to 0x44DBF0. That shared scene loader iterates original shape resources, using 0x477BA0 (which explicitly requests 3DSh at 0x477BC2) and the resource's shape name. Its string is derived from the shape's database metadata at 0x44DC65 onward.

For each terrain object, after assigning its source shape, it tests:

  • 0x44DD27: lowercase the first name character with 0x47F9B9.
  • 0x44DD2F: compare against n (0x6E); other names take InitPhysics.
  • 0x44DD5C: lowercase the second name character.
  • 0x44DD64: compare against c (0x63).
  • 0x44DD67: equality jumps to 0x44DD70, bypassing the InitPhysics call.
  • 0x44DD69..0x44DD6D: ordinary names call terrain interface slot 0x2C.

C3DTerrain interface vtable 0x4D4CCC, slot 0x2C, is 0x464B00. That function reads the assigned shape and calls static registration 0x479140 at 0x464B18. Omitting InitPhysics therefore excludes the whole NC shape from both static collision grids, including the support-ray grid. 0x47F9B9 is the CRT lowercase routine; its default ASCII path maps A..Z by +32 (0x47F9CC..0x47F9DE). The equivalent ASCII prefix rule is case-insensitive.

The other shared scene loaders retain the same gate: 0x44D4F0 checks at 0x44D62F/0x44D664 and skips 0x44D66D; 0x44D810 checks at 0x44D94F/0x44D984 and skips 0x44D98D. Rendering setup and material processing continue after the gate. This is a shape-name rule, not a material-name, visibility or alpha rule. Do not delete NC geometry from rendering or use a substring/material heuristic.

Actual supplied geometry

Archive Shape ID/name Payload file offset Size Excluded triangles
level1b.omt 94 / ncwater 353257 2162 18
level1.omt 172 / ncwater 1962491 2398 20
level1.omt 174 / ncwater2 1163215 310 2
level1.omt 178 / ncwater3 1111837 310 2

Lab source/draw geometry remains 2,869 triangles. Static registered geometry is 2,851, including all 325 null-material triangles. VR04 has no NC-named shapes. level1b.omt SHA-256 is 5a33d11311fc222631eb8f7384d1863192cb1f55f7e67035caa0ae12fd9892ab; level1.omt SHA-256 is a1b525c433c613fc7e63b8fa69abb51a7a91565dce78970745afe158a05e7f6b.

Lab shape 94 includes the large horizontal surface at Y=-1006.0449829101562 covering X=3342.3577..4225.8027 and Z=-3466.2422..2431.9878. Material 181 is also named ncwater, but that coincidence is not the source registration gate. Treating this shape as solid lets the provisional capsule overlap correction push the riverlab player up onto that water plane. Excluding its static collision has direct source support; the observed pop alone would not justify a filter.

Reproduction and limits

Run python3 tools/binary/water_collision_evidence.py from GamePort for nine instruction-byte checks, two direct vtable checks and source geometry counts. python3 -m unittest discover -s tests -p test_water_collision.py -v passes both groups, including ASCII case variants, prefix versus substring and preservation of null-material lab proxies. Generated facts: artifacts/water-collision-evidence.json.

MeshPolygonSource now obtains shape names from prepared mesh records; its TerrainCollision flag filters both SceneCollision and OriginalScenePhysics support without changing source/render arrays. The managed underground replay verifies both open passage and a closed source-gated box query at the corrected root height. These facts establish source collision eligibility, not a complete original sphere solver, water hazard/swimming behavior, NPC phase order or original runtime comparison. Those remain separate work.