Skip to content

Fix high bridge shadow depth and darkening - #1029

Merged
hrusten merged 1 commit into
mainfrom
feature/bridge-shadow-depth
Oct 3, 2026
Merged

hrusten merged 1 commit into
mainfrom
feature/bridge-shadow-depth

Conversation

@hrusten

@hrusten hrusten commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator

What changed

High bridge shadows used a translucent black pass that bypassed per-pixel depth. They could darken foreground pixels and overlapping shadows, and were lighter than the original game. Bridge shadows now use the existing destination-edit renderer for native signed depth admission, RGB565 darkening and accepted depth writes.

The bridge atlas retains indexed masks and native crop geometry. The live-cell builder supplies raw frame/level/flags and native cell order. This covers high concrete bridges and the affected shared wood path, including damage, collapse and repair. TerrainDrawRenderer remains the sole destination-edit owner; simulation bridge facts keep their existing owners. No gameplay state, snapshot schema or shader arithmetic changed.

Linked issue

None.

Evidence

  • No gameplay change (presentation and validation only)
  • Native behavior established: original functions and sources are cited beside the implementation
  • Rust regression tested
  • Parity demonstrated within the recorded native caller/raster corpus

Evidence and reproduction: original 0047F510, retail type/image reads, physical SHP frames, original Convert/raster leaves and Tactical cell sweep. The corpus contains 63 caller cases, 15 leaf controls and six-theater source-equivalence checks. Production atlas, builder and dispatch match every native color/depth pixel in both BGRA and RGBA sRGB attachments. The former bridge route first failed this GPU regression.

Seven paired release captures cover both concrete orientations over land/water, multiple spans, authored broken concrete, and ordinary wood-bridge deck/underpass travel. Strict comparisons differ only in frame bytes; simulation hashes and complete input/observation transcripts match. A repeated candidate capture matches exactly. Separate live wood/concrete tests pass all four stages: loaded, damaged, collapsed and ordinary Engineer repair.

This does not establish native whole-scene or complete bridge-gameplay parity. Aircraft shadows and the separate C_SHADOW/RAILBRDG path remain outside this change. No RNG draws, gameplay timer writes or detach calls occur in the selected draw chain.

Tests run

  • cargo test -p vera20k --lib: 9,567 passed, 0 failed, 231 ignored
  • cargo clippy -p vera20k --lib (CI set also included --bins --test '*' --examples): exit 0, existing warnings remain
  • rustfmt --edition 2024 on edited leaf files
  • Played it with cargo run --release --bin vera20k

Cargo ran through tools.cargo_run; full tests/clippy used physical INIs and VERA20K_REQUIRE_RETAIL_INI=1. Instead of a manual play session, the retained release executable ran seven reproducible retail-map observations plus an exact repeat. Native oracle --check, explicit ignored GPU comparisons, live HE/Engineer lifecycle checks and simulation field ratchet (2,532 baseline/current fields) passed. Validation receipts bind the logs and tested sources.

Rendering cost is recorded, not assumed free: on Apple M4/Metal, debug prepare-to-completion medians for 16 adjacent shadows rose from 1.30 to 4.19 ms. A deliberately repeated 128-shadow stress case exercised bounded submissions. These include completion waits/readback; Metal returned zero timestamp endpoints, so no GPU-only or release-FPS claim is made. See the raw measurements.

Independent read-only review found no blocking correctness defect. Its allocation finding was fixed in the shared bridge-name classifier; afterward, 594 focused bridge tests and all three GPU correctness tests passed. The classifier keeps the same names and numeric identity semantics. A final retained release replayed the 753-step Hills scene and matched the validated capture exactly, including image bytes and all simulation observations.

AI assistance

  • No AI tools were used
  • AI tools helped: Codex implementation, native/GPU comparisons, capture analysis and independent review
  • I can explain every change in this PR

Checklist

  • No retail archive, INI or art binaries added; the saved vectors are original-execution outputs and input identities
  • README status remains concise and marks bridges partial, with a link to the bounded shadow coverage

Route bridge own-shadows through the existing destination-edit renderer with
native masks, cropped geometry, live raw state and ordered cell traversal.
Keep signed depth admission, RGB565 halving and accepted Z stores with their
existing shared owner. Remove the per-overlay classifier allocation.

Native evidence: Cell0047F510, Get_Draw_Offset00480110, original SHP raster
leaves00493830/00497390 and Tactical sweep006D6E5B..006D71D3;
tools/spatial_oracle/bridge_shadow_render.md records executable coverage.

Validated with native execution, exact GPU color/depth comparisons, strict
retail library tests, CI clippy, live damage/repair and release captures.
One independent read-only review completed; its allocation finding fixed.
@hrusten
hrusten merged commit d2a64dd into main Oct 3, 2026
7 checks passed
@hrusten
hrusten deleted the feature/bridge-shadow-depth branch October 3, 2026 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant