Skip to content

render: stabilize the sun shadow lattice - #5222

Closed
jakildev wants to merge 1 commit into
codex/4820-rotation-picking-closeoutfrom
codex/4964-world-stable-sun-shadow-lattice
Closed

jakildev wants to merge 1 commit into
codex/4820-rotation-picking-closeoutfrom
codex/4964-world-stable-sun-shadow-lattice

Conversation

@jakildev

Copy link
Copy Markdown
Owner

Summary

Sun-shadow cascades now use a translation-invariant quarter-octave texel ladder and integer lattice origins, eliminating sampled-route shadow crawl during camera pans. Bake, sample, and feeder-density calculations share that lattice contract. This is a design-blocked WIP because the ticket's exact-RGB placement criterion is contradicted by the resulting shaded reference pixels.

Screenshots

sweep_pan_16 — the sampled shadow overlay at the far end of the zoom-4 pan.

Before After
before after

Acceptance evidence

Criterion Check run Observed
1. Stable 17-shot pans at zoom 1 and 4; parent positive fire render-shadow-pan-stability-metric.py on parent and head sweeps parent maxima: 4,208 / 21,876 changed pixels and 15.5563 / 35.7771 px edge displacement; head: 0 changed pixels, 0 displacement for all 34 comparisons
2. Hermetic controls and validation registration python3 scripts/tests/test_render_shadow_pan_stability_metric.py 3/3 pass: shifted pair, one-pixel mutation, blank invalid
3. Exact route unchanged render-verify.py --target IRCanvasStress plus the receiver/index/grazing suites 59/59 CanvasStress rows byte-identical; 40/40, 4/4, and 3/3 tests pass
4. Every moved row exact-RGB-local within one sun texel, both directions render-placement-window-metric.py --base-ref origin/codex/4904-refresh-macos-references --footprint-px 4 plus global colour-set control FAIL: 144 moved PNGs are reblessed, but zoom1_origin has 2,168 changed head pixels whose RGB is absent anywhere in the parent image (2,176 reverse), so no finite locality window can satisfy the locked clause
5. No cost on million control sun_depth_slab_timing.py --pairs 5 --cells perf-grid-million five guarded interleaved Release pairs; frame mean 1.000x, p99 1.052x, voxelSunFaces 0.984x, computeSunShadow 1.043x: all pass rule (i)'s 1.10x lane ratio
6. Fit invariants IrredenEngineTest --gtest_filter=SunShadowCascadePolicy.* 3/3 pass; fractional positions keep size fixed, origin integral, padded bounds covered
Reviewer notes

Plan departures

  • Lattice-coordinate arithmetic was also required in the bake and sample shaders; subtracting world-space floats first left a deterministic 4×2 boundary step.
  • The exact-RGB locality premise fails even with a global search, not merely the planned one-texel window. Resolving it requires changing criterion 4 or changing the intended filtering/shading outcome.

Overlap

  • #5103 rows are upstream by construction: this PR targets codex/4904-refresh-macos-references.
  • #5195 docs/agents/VALIDATION-RENDER-FEATURES.md base-conflict is inherited from the parent base; this PR adds a distinct validator row.

Part of #4961

Refs #4964

🤖 Authored with Codex (GPT-5)

Quantize each cascade to a translation-invariant texel-size ladder and address bake and sampling in lattice coordinates so camera pans cannot change the grid phase.

Add deterministic pan, placement, and interleaved million-scene evidence plus the macOS reference updates. The placement oracle exposes a remaining exact-RGB contract mismatch for design review.
@jakildev jakildev added fleet:wip Work in progress — not ready for review fleet:author-codex Implementation last authored by Codex; route review to Claude fleet:authored-on-macos PR was authored and smoke-tested on macOS Metal backend labels Nov 20, 2026
@jakildev
jakildev changed the base branch from codex/4904-refresh-macos-references to codex/4820-rotation-picking-closeout November 20, 2026 02:56
@jakildev
jakildev added this pull request to stack #5218 November 20, 2026 02:56
@jakildev

Copy link
Copy Markdown
Owner Author

Closing and recreating: GitHub's linear native-stack link retargeted this sibling PR onto #5217 instead of its assigned parent #5103, and stack-managed PRs cannot be retargeted directly. No review requested.

@github-actions

Copy link
Copy Markdown

Perf gate

Head host slug: linux-x86_64-xeon-6975p-c-03-0-vga

perf comparison: cb2e87f → dbe3407-ci

baseline: /home/runner/work/_temp/perf-baseline/history/linux-x86_64-xeon-6975p-c-03-0-vga/cb2e87f332f63470b88fccdc2448364d60bdff6c
head: /home/runner/work/IrredenEngine/IrredenEngine/save_files/perf/dbe34078b-ci

host calibration

  • host: linux-x86_64-xeon-6975p-c-03-0-vga (matches baseline)
  • ref_ms: head 70.71 vs baseline 69.94 (load_factor 1.01×)
  • calibration target: 50.00 ms (informational)
  • baseline capture: perf-baseline@cb2e87f33 (branch tip); master 473953323, finished 2026-11-19T19:24:47Z, 0.3 d before the head run, ref_ms 69.94
  • weighting: raw (class-matched capture; load_factor 1.01×; no calibration-scaling entry)
  • attribution: improvement withheld, stacked: merge base 6c4ecf30d is not on refs/remotes/origin/master, so the run measured the base branch's unmerged changes

thresholds: regress ≥ 10%, improve ≥ 5%

voxel cull effectiveness

cell ratio (base→head) avg visible total avg feeder
target=IRLuaPerfGrid,zoom=1,sub_mode=full,sub_base=1 1.000 → 1.000 (+0.0pp) 262144 → 262144 1024 → 1024 0 → 0
target=IRLuaPerfGrid,zoom=4,sub_mode=full,sub_base=1 0.598 → 0.598 (+0.0pp) 156637 → 156637 1024 → 1024 0 → 0
target=IRPerfGrid,zoom=1,sub_mode=full,sub_base=1 1.000 → 1.000 (+0.0pp) 262144 → 262144 1024 → 1024 0 → 0
target=IRPerfGrid,zoom=4,sub_mode=full,sub_base=1 0.975 → 0.975 (+0.0pp) 255592 → 255592 1024 → 1024 0 → 0

frame timing (ms)

cell avg p99
target=IRLuaPerfGrid,zoom=1,sub_mode=full,sub_base=1 419.71 → 439.44 (+4.7%) 1276.46 → 1161.46 (-9.0%) ↓
target=IRLuaPerfGrid,zoom=4,sub_mode=full,sub_base=1 940.31 → 957.06 (+1.8%) 1708.08 → 1712.28 (+0.2%)
target=IRPerfGrid,zoom=1,sub_mode=full,sub_base=1 497.57 → 540.55 (+8.6%) 6789.76 → 8112.95 (+19.5%) ⚠
target=IRPerfGrid,zoom=4,sub_mode=full,sub_base=1 1322.17 → 1341.29 (+1.4%) 2038.95 → 2080.17 (+2.0%)

GPU frame timing (ms; separate from stage samples)

cell envelope (base→head) buffer spans (base→head) coverage (base→head)
target=IRLuaPerfGrid,zoom=1,sub_mode=full,sub_base=1 unavailable → unavailable unavailable → unavailable unavailable → unavailable
target=IRLuaPerfGrid,zoom=4,sub_mode=full,sub_base=1 unavailable → unavailable unavailable → unavailable unavailable → unavailable
target=IRPerfGrid,zoom=1,sub_mode=full,sub_base=1 unavailable → unavailable unavailable → unavailable unavailable → unavailable
target=IRPerfGrid,zoom=4,sub_mode=full,sub_base=1 unavailable → unavailable unavailable → unavailable unavailable → unavailable

GPU stage timing (avg ms per sampled invocation)

cell canvasClear voxelCompact voxelStage1 voxelCardinalElect voxelStage2 voxelSunFaces textToTrixel buildLightOcclusionGrid computeVoxelAO bakeSunShadowMap computeSunShadow computeLightVolume lightingToTrixel fogToTrixel trixelToFb resolvePerAxisScreenDepth fbToScreen cardinalSurfaceFb
target=IRLuaPerfGrid,zoom=1,sub_mode=full,sub_base=1 16.29→16.89 46.34→47.27 40.16→41.34 0.96→0.76 ↓ 40.01→38.75 68.94→66.40 — 0.00→0.00 1.45→2.65 ⚠ 16.75→7.34 ↓ 13.45→0.36 ↓ 11.91→25.61 ⚠ 2.51→1.15 ↓ 0.95→0.93 0.15→0.16 ⚠ — 6.49→6.67 0.00→0.19
target=IRLuaPerfGrid,zoom=4,sub_mode=full,sub_base=1 17.20→17.07 235.08→239.02 178.46→182.57 2.96→3.04 169.06→164.69 112.95→113.18 — 0.00→0.00 1.30→6.81 ⚠ 28.77→6.78 ↓ 11.82→0.36 ↓ 10.07→22.52 ⚠ 5.03→1.23 ↓ 0.99→0.99 0.14→0.16 ⚠ — 6.11→6.29 0.00→0.29
target=IRPerfGrid,zoom=1,sub_mode=full,sub_base=1 15.49→16.01 55.55→57.52 43.89→45.01 6.51→6.85 36.53→35.99 65.32→62.62 1.28→1.30 0.00→0.00 4.08→4.69 ⚠ 39.01→35.64 ↓ 13.10→0.54 ↓ 28.79→41.30 ⚠ 4.79→4.49 ↓ 1.35→1.39 0.15→0.17 ⚠ 0.00→0.00 7.15→7.52 0.00→0.19
target=IRPerfGrid,zoom=4,sub_mode=full,sub_base=1 16.44→16.11 384.05→391.17 288.01→295.71 4.59→4.78 264.15→262.20 127.90→121.26 ↓ 1.29→1.30 0.00→0.00 1.32→5.58 ⚠ 37.68→6.58 ↓ 13.47→0.35 ↓ 11.14→22.07 ⚠ 4.28→1.20 ↓ 1.13→1.16 0.15→0.17 ⚠ 0.00→0.00 6.04→6.41 0.00→0.51

top CPU systems by avg ms (head)

target=IRLuaPerfGrid,zoom=1,sub_mode=full,sub_base=1

pipeline system avg ms (base→head)
RENDER SingleVoxelToCanvasFirst 214.703 → 215.644 (+0.4%)
RENDER ComputeLightVolume 24.978 → 25.631 (+2.6%)
RENDER CanvasToFramebuffer 14.330 → 25.039 (+74.7%) ⚠
UPDATE FogRevealEval 7.136 → 8.852 (+24.0%) ⚠
RENDER BakeSunShadowMap 6.007 → 6.060 (+0.9%)
UPDATE PropagateTransform 3.483 → 3.639 (+4.5%)
RENDER UpdateVoxelSetChildren 2.147 → 2.949 (+37.4%) ⚠
UPDATE LuaWaveStateToOffset 2.542 → 2.850 (+12.1%) ⚠

target=IRLuaPerfGrid,zoom=4,sub_mode=full,sub_base=1

pipeline system avg ms (base→head)
RENDER SingleVoxelToCanvasFirst 713.424 → 723.813 (+1.5%)
RENDER CanvasToFramebuffer 13.360 → 36.619 (+174.1%) ⚠
RENDER ComputeLightVolume 21.534 → 22.632 (+5.1%)
UPDATE FogRevealEval 7.943 → 8.521 (+7.3%)
RENDER ComputeVoxelAO 6.756 → 7.116 (+5.3%)
RENDER BakeSunShadowMap 5.044 → 5.102 (+1.1%)
UPDATE PropagateTransform 3.455 → 3.548 (+2.7%)
UPDATE LuaWaveStateToOffset 2.735 → 2.910 (+6.4%)

target=IRPerfGrid,zoom=1,sub_mode=full,sub_base=1

pipeline system avg ms (base→head)
RENDER SingleVoxelToCanvasFirst 234.442 → 237.100 (+1.1%)
RENDER CanvasToFramebuffer 14.537 → 37.400 (+157.3%) ⚠
RENDER ComputeSunShadow 34.544 → 29.979 (-13.2%) ↓
RENDER ComputeLightVolume 24.263 → 24.094 (-0.7%)
RENDER LightingToTrixel 18.559 → 18.391 (-0.9%)
RENDER BakeSunShadowMap 7.924 → 8.200 (+3.5%)
UPDATE FogRevealEval 6.789 → 8.045 (+18.5%) ⚠
UPDATE PropagateTransform 4.692 → 4.787 (+2.0%)

target=IRPerfGrid,zoom=4,sub_mode=full,sub_base=1

pipeline system avg ms (base→head)
RENDER SingleVoxelToCanvasFirst 1084.329 → 1095.639 (+1.0%)
RENDER CanvasToFramebuffer 13.217 → 45.526 (+244.5%) ⚠
RENDER ComputeLightVolume 24.282 → 22.225 (-8.5%) ↓
UPDATE FogRevealEval 6.477 → 7.132 (+10.1%) ⚠
RENDER ComputeVoxelAO 5.572 → 5.840 (+4.8%)
RENDER BakeSunShadowMap 5.204 → 5.372 (+3.2%)
UPDATE PropagateTransform 4.695 → 4.816 (+2.6%)
RENDER UpdateVoxelSetChildren 2.328 → 3.020 (+29.7%) ⚠

An error occurred while trying to automatically change base from codex/4820-rotation-picking-closeout to master November 21, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fleet:author-codex Implementation last authored by Codex; route review to Claude fleet:authored-on-macos PR was authored and smoke-tested on macOS Metal backend fleet:wip Work in progress — not ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant