# Soft sun shadows: stochastic disk rays + temporal accumulation + denoiser (2026-10-26) Status: **MODEL ONLY, verdict KILL (cost, and moving-caster trails)**. The look at rest passes at 4° and 8°. No renderer code and no GPU this round. Branch `shadow-temporal` off main @c21fde4f. It follows the owner's 2026-10-26 decision to try the industry approach for soft shadows, and it uses the GI temporal bar: - plausible on frame 1; - right by about 3 frames, apart from a little extra blur; - good within about a dozen frames. Scratch, model and images are in `logs/shadow-temporal/` on nazrin: - **the model:** `model/`. `tm2.ts` is the estimator. `tmodel.ts` is the same estimator before the two perspective fixes in §1.6; the floor runs used it, and both fixes are inert there. `event.ts` holds the perspective events, `floor.ts` runs the screen's floor sets, and `aggfloor.py` / `aggev.py` make the tables. The model is about 900 lines, so it is not committed. - **results:** - `full/` holds the floor sets: `rows.jsonl` and `agg.md`. - `events/` holds the events: `rows.jsonl` and `agg-.md`. - `tune*/` holds the parameter sweeps. - **the owner's sheets:** `logs/shadow-temporal/owner/` (§6). Evidence tags as in `celestial-lighting.md`: - **[M]** means measured in the offline model this round. - **[V]** means measured by an earlier round. - **[I]** means an inference. ## 0. Summary **Design (§1).** - **The base stays:** main's exact hard ray to the sun centre per pixel, plus its blocker distance. - **Classification.** A pixel is a penumbra candidate in three cases: - a hard-ray blocker point lies inside its light cone; - it is hard-shadowed and a receiver with a different hard result lies within its own penumbra radius; - its history says it is in a penumbra. - **Probe rays.** Every non-candidate pixel also shoots one probe ray. The variant **Tu** probes only hard-shadowed pixels. A probe that disagrees with the hard result adds candidates around it. - **Rays.** k = 4 rays a candidate a frame, and 8 on a candidate with no history. The samples use blue-noise Cranley-Patterson offsets on an R2 sequence. - **History.** Screen-space reprojection with plane and normal validation. The history length is counted in samples, capped at 12 frames × k. - **Clamp.** The history is clamped to the current frame's spatial estimate. - **Filter.** A 2-pass sparse light-space gather (SIGMA/SVGF style): - its radius comes from the blocker depth (the shadow-blur round's height rule); - it is wide on a new pixel and narrows with the sample count; - it is plane-tested; - a value edge-stop blends in as the history grows. **Results at rest** (§2, §3) [M], mean |error| over penumbra pixels: | | frame 1 | frame 3 | frame 12 | steady | |---|---|---|---|---| | floor sets, zoom view, 4° | 0.073 | 0.038 | 0.013 | 0.011 | | floor sets, zoom view, 8° | 0.060 | 0.030 | 0.011 | 0.010 | | perspective cuts, 4° | 0.06-0.11 | 0.022-0.038 | 0.016-0.021 | 0.013-0.019 | | perspective cuts, 8° | 0.07-0.09 | 0.024-0.027 | 0.009-0.014 | 0.007-0.013 | For scale: - main's edge field is 0.085 / 0.117 at 4° / 8°; - BC N = 256 is 0.005; - the hard shadow is 0.24. **What that means at rest:** - **Frame 1** is about as accurate as main's steady state, and smooth. Its flaws: - extra blur: the penumbra is too wide; - faint grain: roughness 0.016, at the visible line in about half the sets; - a few spikes on thin far casters. - **Frame 3** is 2-3× the steady error. - **Steady state** is 5-10× better than main and 2-4× worse than BC. It has a few sets with visible roughness or flicker (slats at 45-80°, fences). **Events** (§4) [M]: - **A still camera and still sun, and the real sun speeds** (6 h and 1 h days): no change from rest. - **A camera cut, the turn and the walk's disocclusion** converge on the bar's schedule. - **Camera motion** (pan, walk) holds the error at about 2-3× the still value while it moves. Much of that is anti-aliasing of hard contact edges, which the point-sampled reference counts as error. - **Moving casters lag.** The NPC's shadow at 4° runs at 0.065 against 0.020 still. It shows a 1-2-voxel trail and lead of up to 0.46-0.63, well beyond the clamp's tolerance. After a stop it sharpens over about 12 frames. - A tighter clamp halves the trail and doubles the steady roughness. - An anti-lag reset trades the trail for blur. - Neither meets the bar. **Cost** (§5) [I], ±2-3×: - one sun at 800×600, a typical view, about **1.3-9.3 ms**, depending on the variant and on whether the hard ray is cached; - the worst view **5-19 ms**; - **N = 8: about 11-56 ms typical.** The frame is 6.9 ms and main already spends 4.6 ms p50 of GPU. Nothing that matters is shared between suns. **Verdict (§7): kill.** The look at rest at 4-8° meets the bar, but: - N = 1 does not plausibly fit; - N = 8 is about 5-25× over the headroom; - moving casters trail beyond the clamp's tolerance. **At 0.53°** (§4.6) temporal beats hard at rest (0.02 against 0.23), but the gain disappears in motion (0.10-0.19). The recommendation is that small suns stay hard (decision 3). ## 1. The design as modelled [M] The parameters were tuned on 10 floor sets (`tune1`-`tune7`, §8) and then frozen. They are `DEFAULTS` in `model/tmodel.ts`. ### 1.1 Base and classification (per sun) **The hard ray.** One exact ray per pixel to the sun centre. It gives the hard transmittance T (glass included) and the first-blocker distance, so the blocker's light-depth is z = h + t, where h = p·L. **Light-space grids.** Two grids, each with 8 power-of-two levels from 0.5 to 64 voxels: - **blocker points:** the (u, v, z) of every hard hit, plus the hit points of this frame's stochastic rays; - **receivers:** per cell, the min and max of T and the minimum h. **The candidate test.** A pixel is a candidate if any of these holds: - **(a) a lit pixel near a blocker point.** Some blocker point q in the pixel's cone satisfies |uv_q − uv_p| ≤ (z_q − h_p)·tanR + 1.5 px. This is a sufficient geometric test, and it is the same for terrain and entities. - **(b) a shadowed pixel near a different result.** Some receiver with a different T lies within (z_p − h_p)·tanR + 1.5 px, and that receiver is below p's blocker. - **(c) history.** The reprojected output lies in (0.004, 0.996). - **(d) probes.** A non-candidate pixel casts one probe ray to the disk. If the probe disagrees with the hard result: - the pixel becomes a candidate; - every hard-shadowed pixel whose cone reaches it becomes a candidate; - the probe's blocker hit joins the blocker points, which re-runs (a). The variant **Tu** probes only hard-shadowed pixels. **What each rule fixes.** - (b) alone misses fused occluders. The slats at 20° are hard-black everywhere but transmit about 25 % through the gaps; that region showed 816-1 021 missed pixels per set before the probes. - The lit probes in (d) fix penumbrae whose hard shadow is off-screen. The zoom of plate 10° 8° had 816 missed pixels, and now has 0. **Candidate fraction:** - typical perspective views: **0.18-0.29** of facing pixels at 0.53-8°; - floor zoom views: 0.20 / 0.50 / 0.63 at 0.53° / 4° / 8°; - the worst set: 0.98-0.99 (slats 5°). ### 1.2 Rays - **Count.** k = 4 rays a candidate a frame. A candidate with no accumulated samples (new, disoccluded, or previously settled) gets `kFresh` = 8 on that frame. - **Sampling.** Each pixel has a two-channel 64² void-and-cluster blue-noise offset. It is added to the R2 sequence at index f·k + j, and the concentric map takes the result to the disk. This is "blue noise + low-discrepancy animation", the STBN-equivalent the brief allows. - **White noise** costs +10-20 % of steady error (`tune2`). ### 1.3 History: screen-space reprojection, per-pixel sample count **Reprojection.** - The current surface hit is moved back by its motion vector (entities carry their displacement) and projected with the previous camera. - The previous frame's history is sampled with a bilinear 2×2. - Each tap is validated against the previous normal (a dot product ≥ 0.9) and plane (within 0.2 voxel). - With no valid tap the pixel is disoccluded. **Accumulation.** - **What is stored per pixel and sun:** - H, the accumulated visibility; - S, the samples behind it, capped at (12 − 1)·k, so 12 frames; - the last output, for rule (c). - **The blend** is sample-weighted: H ← (H_clamped·S + raw·n_rays) / (S + n_rays). - **Settled (non-candidate) pixels** store H = hard and S = 0. If they become candidates they start fresh. - **Clamp.** Before the blend, H is clamped to μ ± (2.5·σ_μ + 0.06). Here μ and σ_μ are the weighted mean and its standard error of this frame's raw samples, gathered with the pixel's current filter taps. **Why screen space and not per-voxel / world keys:** - **Resolution.** It is per pixel. VSC slots are one shading cell, and coarser far away. The old Stage 3 accumulated per slot and grained. - **No camera-install problem.** The boxcov round measured about 23.6k slot installs a frame while moving. Each new slot started empty, which was Stage 3's "re-warm". Here a new pixel is filled on its first frame by the spatial filter (§1.4) and `kFresh`. - **No storage tied to the VSC's lifetime or eviction.** - **The cost** is the usual one: disocclusion and resampling (§4.3). ### 1.4 Spatial filter (history-aware, hit-distance guided) **Penumbra radius.** R = (z̄ − h_p)·tanR in light space. z̄ is the mean light-depth of the blocker points (hard plus stochastic hits) inside p's cone, which is the height rule. **Gaussian width.** σ = max(c(S)·R, s(S)·m), where m is the pixel's light-space size (√ of its footprint area): - c(S) = max(0.12, 0.5·8/S); - s(S) = max(0.6, 2·8/S). So frame 1 gets σ = max(R/2, 2 px), and the width shrinks as samples accumulate. **Passes.** - Two passes of T = 16 taps each, plus the clamp gather. The taps are Gaussian-quantile radii on a golden-angle spiral with a fixed per-pixel blue-noise rotation. - Light-space offsets are mapped to screen through the inverse footprint Jacobian, so the taps are footprint-shaped (an SG_A lesson). - New pixels get 48 taps, blending down to 16 as S grows. Pass 2 runs at the full radius on a new pixel and at half the radius once mature. **Weights.** Each tap is weighted by: - its sample count S, or a high fixed weight for settled pixels; - the plane test, |n_p·(x_q − x_p)| ≤ 0.1 + 0.02·d; - the normal test, a dot product ≥ 0.9; - a value edge-stop, exp(−Δ²/2(2σ_bin)²), where σ_bin² = x(1−x)/S. It blends in as S goes from 8 to 32. A switch here made a visible frame-3 roughness step in the first full run (`t9`), so it ramps. **Measured trade-offs** (`tune2`-`tune7`): - the value edge-stop halves steady error on thin lines and contact edges (pole 0.53°: 0.082 → 0.022); - re-rotating the taps every frame costs +60 % flicker; - one pass instead of two gives 2× the frame-1 roughness; - a dense ideal Gaussian is only modestly better than 2 × 16 sparse taps once the edge-stop is on. ### 1.5 N ≤ 8 suns **Shared between suns:** - the reprojection addressing and validation (G-buffer, motion vectors); - the pixel age; - the G-buffer fetches inside filter taps, if the tap positions were shared. **Per sun:** - the hard ray, classification, probes and rays; - the light-space grids; - the history H, S and the last output; - the clamp and both filter passes. The tap positions are per sun as well: the footprint, R and the height rule all depend on L, as the shadow-blur round found for any light-space filter. The history length S cannot be shared: - candidacy, and therefore resets, is per sun; - the clamp is per sun. ### 1.6 Two model bugs found and fixed this round Both are recorded because a GPU build could repeat them. 1. **Reprojected sample count.** The first version took the minimum S over the four bilinear taps. At a candidate's edge a settled neighbour (S = 0) reset the history every frame, which blurred every penumbra edge for good: NPC steady error 0.057 → 0.022 once fixed. Use the dominant tap's S. 2. **Reprojecting the shadow-ray origin instead of the surface hit.** P carried a 0.01-voxel normal offset. Reprojecting it shifted history by about 0.03 px a frame, and the EMA built that into a ½-px one-sided shift: 0.53° steady 0.066 → 0.020 once fixed. Reproject the depth buffer's surface point. The floor runs are unaffected: they use identity reprojection and a single tap. ## 2. Floor sets: cold start (every pixel new on frame 1), still camera [M] These are the screen round's 14 cases × 5 elevations × 3 sizes. The `zoom` view is 1 voxel = 1 px; the `fit` view is 1-9 voxels a pixel. The metrics are the screen's (spike, seam, roughness), against its 1 024-ray reference. Each cell is mean · spike sets · seam sets · roughness (sets > 0.015), out of 62 sets per size. The flicker column is the mean / p99 (worst set) of |V_t − V_{t−1}| over penumbra pixels, frames 17-24. Full table: `full/agg.md`. **Zoom view:** | size | f1 | f2 | f3 | f4 | f8 | f12 | steady (f24) | flicker | rays/px | |---|---|---|---|---|---|---|---|---|---| | 0.53° | 0.159 · 35 · 19 · 0.010 (21) | 0.132 · 24 · 3 | 0.091 · 18 · 1 · 0.007 (12) | 0.049 · 16 · 1 | 0.028 · 3 · 6 | 0.021 · 1 · 1 · 0.008 (14) | **0.017 · 1 · 0 · 0.006 (13)** | 0.008 / 0.17 | 1.61 | | 4° | 0.073 · 15 · 18 · 0.016 (34) | 0.051 · 12 · 4 | 0.038 · 9 · 4 · 0.011 (11) | 0.027 · 9 · 5 | 0.017 · 5 · 15 | 0.013 · 2 · 8 · 0.011 (12) | **0.011 · 3 · 6 · 0.010 (13)** | 0.005 / 0.22 | 2.50 | | 8° | 0.060 · 14 · 21 · 0.015 (31) | 0.041 · 10 · 8 | 0.030 · 10 · 5 · 0.010 (10) | 0.023 · 9 · 7 | 0.014 · 7 · 17 | 0.011 · 4 · 8 · 0.009 (10) | **0.010 · 1 · 6 · 0.008 (7)** | 0.004 / 0.17 | 2.89 | **Fit view:** | size | f1 | f3 | f12 | steady (f24) | flicker | |---|---|---|---|---|---| | 0.53° | 0.197 · 57 · 34 · 0.009 (20) | 0.131 · 24 · 0 · 0.008 (17) | 0.026 · 4 · 0 · 0.007 (15) | **0.020 · 4 · 0 · 0.006 (14)** | 0.009 / 0.16 | | 4° | 0.075 · 25 · 8 · 0.016 (36) | 0.037 · 13 · 0 · 0.013 (15) | 0.016 · 4 · 3 · 0.014 (27) | **0.013 · 5 · 3 · 0.012 (20)** | 0.007 / 0.22 | | 8° | 0.055 · 20 · 4 · 0.016 (33) | 0.024 · 12 · 0 · 0.011 (7) | 0.011 · 6 · 1 · 0.011 (12) | **0.009 · 6 · 1 · 0.009 (8)** | 0.004 / 0.17 | **References** (the same sets and metrics, from `logs/sscreen/full`): | | zoom 0.53° | zoom 4° | zoom 8° | fit 4° | fit 8° | |---|---|---|---|---|---| | hard | 0.228 · 27 · 51 · 0.073 (28) | 0.241 · 47 · 58 · 0.173 (56) | 0.233 · 45 · 56 · 0.179 (55) | 0.228 · 59 · 60 | 0.203 · 62 · 61 | | main (edge field) | 0.058 · 24 · 24 · 0.018 (20) | 0.085 · 38 · 50 · 0.044 (47) | 0.117 · 39 · 55 · 0.058 (50) | 0.160 · 56 · 57 | 0.183 · 57 · 61 | | BC N = 256 | 0.004 · 0 · 0 | 0.005 · 0 · 0 · 0.005 (1) | 0.005 · 0 · 1 | 0.005 · 0 · 0 | 0.005 · 0 · 0 | **Reading:** - **Frame 1 at 4-8°** has about main's steady mean error, with half its spike sets and a third of its seam sets. It is smooth on average (roughness 0.015-0.016), but 31-36 of 62 sets sit just over the 0.015 visibility line. That is a faint grain on one frame. - **Frame 1's spikes** are thin casters seen far away or at contact: pole, fence and rail at 5-10°. The frame-1 filter blurs a 1-2-px line below its contrast. - **Frame 3** is 2-3.5× the steady mean, with no new artifact classes. - **The roughness bump at f8** (15-17 seam sets) is where the value edge-stop finishes blending in. - **Steady state**, all on the slats at 45-80° and the fences at 10-45°: - spike sets: 1-6 of 62; - seam sets: 0-6; - rough sets: 7-20. - The slats at 45° 4° are the worst: 25 spike pixels of 0.25, roughness 0.04, flicker p99 0.22. That is a fine speckle under a high-frequency stripe pattern, where the edge-stop meets per-pixel noise. - **Every other set** is at or below BC's roughness by eye (`owner/steady-*.png`). ## 3. Perspective cuts: cold start in four perspective scenes, still camera [M] 200×150, 55-60° fov. The scenes: - **yard:** a roof, glass, a pole, stacked plates, slats, a fence and a pillar; - **wall** (pole behind a wall), **ledge** and **stacked**: the shadow-blur round's risk scenes. Each cell is mean · spike px (max) · seams per 10k · roughness, from `events/agg-T.md`. | scene | size | f1 | f2 | f3 | f4 | f8 | f12 | steady (f24) | |---|---|---|---|---|---|---|---|---| | yard | 4° | 0.109 · 116 (0.84) · 52 · 0.019 | 0.058 · 13 (0.56) | 0.038 · 2 (0.28) · 0 · 0.018 | 0.029 · 1 | 0.027 · 0 | 0.020 · 0 · 0 · 0.020 | 0.019 · 0 (0.05) · 0 · 0.019 | | yard | 8° | 0.080 · 84 (0.83) · 16 · 0.015 | 0.041 · 9 | 0.027 · 2 (0.19) · 0 · 0.012 | 0.022 · 1 | 0.018 · 0 | 0.014 · 0 · 1 · 0.013 | 0.013 · 0 · 1 · 0.013 | | wall | 4° | 0.095 · 15 (0.74) · 3 · 0.013 | 0.050 · 5 | 0.031 · 0 · 0 · 0.015 | 0.026 · 0 | 0.026 · 0 · 3 | 0.021 · 0 · 1 · 0.022 | 0.019 · 0 · 1 · 0.020 | | wall | 8° | 0.084 · 17 (0.89) · 8 · 0.015 | 0.042 · 13 | 0.024 · 6 (0.21) · 0 · 0.010 | 0.019 · 0 | 0.018 · 0 | 0.014 · 0 · 0 · 0.014 | 0.011 · 0 · 0 · 0.011 | | ledge | 4° | 0.062 · 0 · 0 · 0.014 | 0.033 | 0.022 · 0 · 0 · 0.009 | 0.019 | 0.021 | 0.018 · 0 · 0 · 0.018 | 0.015 · 0 · 0 · 0.014 | | ledge | 8° | 0.087 · 1 · 31 · 0.029 | 0.043 · 0 · 19 | 0.027 · 0 · 11 · 0.013 | 0.018 · 0 · 7 | 0.012 | 0.009 | 0.007 | | stacked | 4° | 0.088 · 3 (0.17) · 5 · 0.017 | 0.045 | 0.025 · 0 · 0 · 0.011 | 0.020 | 0.020 | 0.016 | 0.013 | | stacked | 8° | 0.068 · 2 (0.18) · 0 · 0.019 | 0.040 | 0.026 · 0 · 0 · 0.012 | 0.019 | 0.013 | 0.011 | 0.010 | | yard | 0.53° | 0.201 · 209 (0.86) · 190 | 0.156 · 13 | 0.091 · 0 · 0 | 0.046 | 0.030 | 0.022 | 0.020 | | wall | 0.53° | 0.207 · 31 · 112 | 0.148 · 5 | 0.104 · 2 | 0.063 | 0.037 | 0.027 | 0.021 | **Frame-1 spikes.** The yard's frame-1 spikes are mostly two thin far shadow lines: - the pillar's 4-voxel line, about 1 px wide here; - the fence posts. The frame-1 filter (σ ≥ 2 px) spreads them to faint grey, and they are at full contrast by frame 3. There are no holes in umbrae and no lit specks. The risk scenes' depth breaks (ledge edge, stacked layers, the wall's contact) are clean at every frame: the plane test plus per-pixel rays do not double-count, unlike the shadow-blur filters. **The ledge at 8°** has 31 seams per 10k on frame 1, falling to 0 by frame 8. That is noise along its long grazing penumbra. **The 0.53° frame 1** is too blurred: 0.20, against 0.23 for the hard shadow. The 2-px frame-1 floor is wider than the penumbra. **Penumbra rays** (candidates × k plus probes, per facing pixel): - **T:** 1.5-1.9 at steady, 2.2-3.1 on the cut frame; - **Tu:** 0.7-1.1 at steady. ## 4. Events [M] The camera, sun and casters are still for 24 frames first. Each event is then measured on frames 1, 2, 3, 4, 8 and 12 after it starts (more frames in `events/agg-*.md`). Each cell is mean · spike px (max) · roughness; "trail" is the count of pixels where the estimate is darker than the reference by more than 0.1, with its maximum. ### 4.1 Camera turn: 90° in 0.25 s (2.5° a frame), then still | size | during the turn, f12 / f24 / f36 | after +1 | after +3 | after +12 | after +24 | |---|---|---|---|---|---| | 0.53° | 0.131 / 0.133 / 0.124 (25 spikes, max 0.88) | 0.125 | 0.089 | 0.046 | 0.025 | | 4° | 0.068 / 0.062 / 0.059 (27, 0.86) | 0.061 | 0.043 (2, 0.30) | 0.024 (1) | 0.018 | | 8° | 0.041 / 0.042 / 0.040 (17, 0.85) | 0.041 | 0.027 (1) | 0.016 | 0.013 | **During the turn**, the pixels entering at the screen edge are always one frame old: - their error is frame-1-like; - the spikes are thin far lines entering, and the stacked plates' edge entering over-blurred; - by age at 4°: age-1 pixels about 0.15, age 3 0.05-0.06, age 5-8 about 0.04. **After the turn**, the error converges on the bar's schedule: 2× steady at +3, and steady at about +12. Sheets: `owner/turn-during.png` and `owner/turn-after.png`. ### 4.2 Disocclusion: strafing at 1 voxel a frame past a wall The plate's and fence's shadows are revealed behind it. | size | f1 | f3 | f12 | f48 | by age at f12 (4°): a1 / a2 / a3 / a4 / a5-8 / old | |---|---|---|---|---|---| | 0.53° | 0.093 | 0.194 | 0.131 | 0.105 | | | 4° | 0.035 | 0.082 (18, 0.74) | 0.064 | 0.036 | 0.21 / 0.11 / 0.06 / 0.04 / 0.04 / 0.08 | | 8° | 0.022 | 0.044 | 0.040 | 0.018 | | **Newly revealed pixels** reach 0.04 by age 4, which meets the bar's "right by about 3 frames". **The old pixels during motion** (0.06-0.08 at 4°) are worse than the young ones. Inspected, the worst are the wall's contact-shadow edge, where the reference steps 0 → 1 between adjacent pixels: - the reprojected history anti-aliases that step to about 0.3 / 0.7; - the point-sampled reference counts that as error; - it reads as an AA'd edge, not as an artifact. A Catmull-Rom reprojection did not change it, and nearest-tap was worse (`rp/`). ### 4.3 Pan: 45° a second | size | f1 | f3 | f12 | f64 (still moving) | still camera | |---|---|---|---|---|---| | 0.53° | 0.025 | 0.148 | 0.118 | 0.115 | 0.020 | | 4° | 0.018 | 0.043 | 0.054 | 0.058 (5 spikes, max 0.22) | 0.019 | | 8° | 0.012 | 0.023 | 0.032 | 0.035 | 0.013 | **A steady pan holds 3× the still error.** The causes are the resampling AA of hard edges (§4.2) plus a 1-px soft lag at penumbra edges. Flicker during the pan: - p99 0.23 at 4°, which includes hard-edge shimmer; - mean 0.025. Sheet: `owner/pan.png`. ### 4.4 Moving casters **The NPC**: a walker of 6×28×6 at 40 voxels a second and a flyer at 50, which is 0.28-0.35 voxel a frame. It moves for 48 frames, then stops. | size | variant | move f1 | f3 | f12 | f48 | trail at f48 | stop +3 | +12 | +24 | |---|---|---|---|---|---|---|---|---|---| | 4° | T | 0.018 | 0.056 | 0.072 | 0.065 | 106 px, max 0.46 | 0.051 | 0.028 | 0.020 | | 4° | TL (anti-lag reset) | 0.018 | 0.073 | 0.060 | 0.055 | 30 px, 0.45 | 0.034 | 0.023 | 0.020 | | 4° | Tg (tight clamp γ = 1, δ = 0.03) | 0.039 | 0.049 | 0.051 | 0.049 | 42 px, 0.28 | 0.042 | 0.036 | 0.037 | | 8° | T | 0.011 | 0.031 | 0.054 | 0.051 | 123 px, 0.36 | 0.037 | 0.019 | 0.014 | | 8° | Tg | 0.021 | 0.028 | 0.033 | 0.032 | 19 px, 0.22 | 0.026 | 0.023 | 0.023 | | 0.53° | T | 0.026 | 0.197 | 0.135 | 0.109 | 61 px, 0.78 | 0.094 | 0.064 | 0.035 | **The windmill**: 4 blades of 6×6 cubes, radius 94, spinning at 0.7 rad/s, with a tip speed of 0.46 voxel a frame and blades at a 54-150 height. | size | variant | move f12 | f48 | still | stop +12 | |---|---|---|---|---|---| | 4° | T | 0.019 | 0.029 | 0.008-0.009 | 0.012 | | 4° | Tg | 0.017 | 0.018 | 0.014-0.015 | 0.015 | | 8° | T | 0.008 | 0.016 | 0.005 | 0.008 | | 0.53° | T | 0.094 | 0.096 (10 spikes, 0.41) | 0.022 | 0.040 | **Reading:** - **The NPC's shadow lags.** The leading edge is too light and the trailing edge too dark: a 1-2-voxel offset band of 0.3-0.6 (sheets `owner/npc-move-*.png`). - The EMA's effective lag is about 6 frames, and the clamp's window (±2.5σ_μ + 0.06) is wider than the error. - Per-pixel noise at k = 4 makes a tight window fight noise. - **This fails the brief's ghosting check:** the trail is well beyond the clamp's tolerance. - **Tg** (tight clamp) halves the NPC trail, but doubles the steady roughness (0.031-0.037 against 0.017-0.020) and the flicker (p99 0.10 against 0.044). That trades a moving-caster artifact for a scene-wide one. - **TL** resets the history where the hard-coverage history and the current 3×3 hard mean disagree by more than 0.2, dilated by the cone. It converts the lag into frame-1 blur and grain at the moving edges. The NPC's move error is about the same; the windmill's is worse at 8° (seams). - **After a stop** the moving caster's shadow sharpens over about 12 frames. There is no switch, but someone watching an NPC stop would see its shadow settle. That is the temporal bar's own behaviour applied to a mode change. - **The windmill at 4-8° is fine:** large penumbrae, motion much smaller than R. Where R is small (0.53°, the NPC's contact) motion of more than about R per 6 frames shows. ### 4.5 Moving sun **Real speeds:** - **4° and 8° on a 6-hour day:** 1.2e-4° a frame. The steady error is unchanged (4°: 0.018-0.019, 8°: 0.013) and there is no spike. - **0.53° on a 1-hour day:** 6.9e-4° a frame. 0.019-0.023, also unchanged. The edges move far less than a pixel per history length. This needs no snapped shadow direction and no sweep cache. **A 2-minute day** (`sunfast`, 0.021° a frame): - at 4°: 0.018 → 0.028 over 48 frames; - at 8°: 0.013 → 0.018; - at 0.53°: 0.019 → 0.113. The light moves the whole 0.53° disk in about 25 frames, so a 12-frame history lags by half a penumbra. ### 4.6 0.53°: temporal against hard (owner decision) | | still, steady | frame 1 | pan / walk / turn (in motion) | NPC moving | |---|---|---|---|---| | temporal (floor zoom / perspective) | 0.017 / 0.020-0.024 | 0.16-0.21 | 0.115 / 0.10-0.19 / 0.12-0.13 | 0.11-0.20 | | hard | 0.228 (floor zoom) | same | same | same | | main's edge field | 0.058 (floor zoom) | | | | **By eye** (`owner/sun053-compare.png`, `owner/steady-zoom-0.53.png`): - **at rest**, the temporal 0.53° shadow is a clean anti-aliased edge and looks better than hard; - **in motion**, its edges carry a 1-px soft lag and shimmer, and spike counts during a pan rise to 10-25; - **on frame 1** it is visibly blurrier than hard. **What 0.53° costs.** The same rays a candidate as 4°, over fewer candidates (0.18 against 0.23 of pixels in the yard). **Recommendation.** Keep hard below about 1-2° (decision 3). The gain is an AA edge at rest; the price is per-frame rays and lag in motion. ## 5. Cost model [I] ### 5.1 Prices All prices are per sun at 800×600 (480k pixels), counted as if every pixel faces the sun, which is conservative. The quantities are per facing pixel, from the model (§2-§4). | item | price per unit a pixel | basis | |---|---|---| | hard ray | 1.06-1.92 ms | 2.2-4.0 ns a ray, from the screen round [V/I] | | disk ray (divergent, cone-short) | 1.06-3.8 ms | 1-2× a hard ray [I] | | filter / clamp tap (16 B) | 0.004-0.012 ms | shadow-blur §4.1 [I] | | light-space grid cell | 0.004-0.012 ms | as a tap | | grid build (2 scatters + 8-level mips, 2 grids) | 0.2-0.6 ms | shadow-blur pyramid build [I] | | reprojection (about 8 tap-equivalents, every pixel) | 0.03-0.1 ms | | **The model's grid search** visits 25-95 cells a pixel. That is an upper bound: it searches at the global maximum blocker depth. A max-z mip test at one level is about 9-16 taps, and that is used below (0.04-0.19 ms). ### 5.2 Per sun, N = 1 | view | variant | rays/px | taps/px | ms (hard ray uncached) | ms (hard ray cached, as main's VSC) | |---|---|---|---|---|---| | typical (yard, 4°, steady) | T (probe everything) | 1.68 | 10.9 | **3.2-9.3** | 2.1-7.4 | | typical (yard, 4°) | **Tu** (umbra probes) | 0.90 | 10.8 | **2.4-6.3** | **1.3-4.4** | | typical (yard, 8°) | Tu | 1.14 | 13.7 | 2.6-7.2 | 1.6-5.3 | | typical, k = 2 (Tk2) | T | 1.23 | 18.4 | 2.7-7.6 | 1.6-5.7 | | cut frame (all pixels new, yard 4°) | T / Tu | 2.62 / 1.80 | 22 | 4.2-12.9 / 3.3-9.8 | | | worst view (slats 5° zoom: 98 % candidates) | T | 4.1-4.3 | 49-51 | **6.0-18.7** | 4.9-16.8 | **Memory per sun:** H (16-bit), S (8-bit) and the last output (8-bit), so 4 B a pixel, 1.9 MB at 800×600. Transient buffers (raw, R, two ping-pong filter buffers) are about 8 B a pixel. Shared: the previous depth and normal (8 B), motion vectors and age. **Against the budget:** - the frame is 6.9 ms, and main's GPU is 4.6 ms p50 and 6.2 ms p95 on the `play-day` route (boxcov §2 [V]); - that leaves 0.7-2.3 ms; - the cheapest plausible form (Tu, hard ray cached, typical view) is 1.3-4.4 ms. It fits only at the bottom of its range, and the worst view does not fit at all. ### 5.3 N = 8 Everything above is per sun except the reprojection and G-buffer: 8 × (1.3-7) ms is **≈ 11-56 ms typical, and up to 150 ms in the worst view.** Fitting N = 8 in about 2 ms needs about 0.05-0.1 rays a pixel per sun. - The only route is to share the ray budget, for example by choosing one sun per pixel per frame. - That gives each sun's history k/8 rays a frame, so convergence is 8× slower: about 100 frames to "good", far outside the bar. - Or soft for K ≤ 2 suns and hard for the rest. That breaks N-parity: it is decision 3 of the screen round, again. ### 5.4 The ray cost dominates - At 4°, the stochastic rays are 60-80 % of the total. - Halving k (Tk2) saves about 25 % of the rays but costs: - 1.5-2× the frame-3 and frame-4 error (yard f3 0.066 against 0.039); - 15 % on the steady state. ## 6. The owner's sheets (`logs/shadow-temporal/owner/`) **Event strips:** - one row group per sun size (0.53°, 4°, 8°); - within a group, three rows: the estimate, the 1 024-ray reference at the same frame, and the signed error (red too bright, blue too dark, full colour at 0.25); - the columns are frames after the event. | sheet | content | |---|---| | `cut-yard90.png`, `cut-wall.png`, `cut-ledge.png`, `cut-stacked.png` | cold start: frames 1, 2, 3, 4, 8, 12, 24 | | `walk.png` | strafing past the wall: frames 1, 2, 3, 4, 8, 12, 48 of the walk | | `turn-during.png`, `turn-after.png` | mid-turn (f12, f24, f36); after it: +1, +2, +3, +4, +8, +12 | | `pan.png` | pan frames 1, 2, 3, 4, 8, 12, 64 | | `npc-move-{T,TL,Tg}.png`, `npc-stop-{T,TL,Tg}.png` | the NPC moving (f1-12, f48) and after it stops (+1 … +12), for the default, anti-lag and tight-clamp variants: the trail is the red/blue band along the walker's shadow | | `windmill-move-*.png`, `windmill-stop-*.png` | the same for the windmill | | `sun.png`, `sunfast.png` | real-speed sun and a 2-minute day | | `sun053-compare.png` | 0.53° yard, frames 1, 2, 3, 12, 24 | | `steady-{zoom,fit}-{0.53,4,8}.png` | **the screen's format**: ref, hard, main's edge field, BC N = 256, then temporal f1, f2, f3, f4, f8, f12, f24, each with its signed-error row, on ten sets (plate, pole, slats, fence, box + cube, stack, louver, cross, glass, ell) | ## 7. Verdict: kill **Against the brief's bar at 4° and 8°:** - **Frame 1: plausible, mostly.** There are no holes and no lit specks. Its error is about main's steady error, and the penumbra is wider than it should be (blur). It has faint grain on that one frame (roughness 0.015-0.016, at the line) and thin far lines faded on frame 1. Pass, with that caveat. - **Frame 3: close to steady.** 2-3× the steady mean, with no new artifacts. Pass. - **Steady state: mostly clean.** 5-10× better than main and 2-4× worse than BC. A few sets show speckle or flicker: slats at 45-80° (flicker p99 0.22), fences. Borderline. - **Moving casters: fail.** The trail is beyond the clamp's tolerance (0.46 at 4° and 0.36 at 8° on the NPC). Each fix trades it for scene-wide roughness (tight clamp) or blur and grain at moving edges (anti-lag). - **Camera motion:** 2-3× the still error while it moves. The part that is not edge anti-aliasing is a 1-px soft lag. Borderline. - **Cost: fail.** - N = 1 is 1.3-4.4 ms in its cheapest form, against 0.7-2.3 ms of headroom, and 5-19 ms in the worst view; - N = 8 is 11-56 ms typical. **What is worth keeping** (findings, not proposals): - **Probe rays** make classification complete without a guard band. Blocker points from any ray, terrain or entity alike, find penumbrae whose hard shadow is off-screen or fused. This is what the edge field and the shadow-blur filters lacked. - **Per-pixel rays plus a plane test** have none of the depth-break failures of mask-spreading filters (ledge, stacked, wall: clean at every frame). - **A real sun speed** needs no shadow-direction snapping or sweep cache under temporal accumulation. - **The GPU traps** of §1.6: the reprojected sample count, and the reprojection point. ## 8. Decisions for the owner 1. **Accept the kill?** This is the recommendation. The look at rest matches the GI bar at 4-8°. Moving casters and cost do not, and N = 8 is far out of reach. 2. **If not killed**, the narrowest form that looks right is **Tu, k = 4, 12-frame history, hard ray cached**. It would mean accepting: - 1.3-4.4 ms per soft sun at N = 1, and more in penumbra-heavy views; - moving-caster lag of 1-2 voxels at 0.3-0.6, settling about 12 frames after a stop; - a soft-sun cap (K = 1-2 soft suns, the rest hard), which breaks N-parity. These are trade-offs on cost, ghosting and parity, so this is listed, not proposed. 3. **Small suns.** At 0.53° temporal beats hard only at rest: 0.02 against 0.23, an anti-aliased edge. In motion it is 0.10-0.19, with 1-px lag and shimmer, and frame 1 is blurrier than hard. The recommendation is **hard below about 1-2°**, whatever happens to large suns; the threshold is the owner's. 4. **Clamp tightness, if built:** γ = 2.5 (default) against γ = 1 (Tg). - Tg halves the moving-caster trail (NPC 4°: 106 px at 0.46 → 42 px at 0.28); - it doubles the steady roughness everywhere (cut-yard 0.019 → 0.031; NPC scene 0.020 → 0.037) and the flicker p99 (0.044 → 0.10). 5. **Probe policy:** probes on every non-candidate (T) or only on hard-shadowed ones (Tu). - Tu is 0.8 rays a pixel cheaper; - its look is the same in every event measured; - it misses 24-77 px of outer penumbra whose hard shadow is off-screen, at 4-8° in the yard. ## 9. Limits - **No GPU.** Ray and tap prices are [I], ±2-3×. The model's grid search is an upper bound, replaced in §5 by a mip estimate. - **The images are 200×150.** Tap counts are resolution-independent, since the taps are in light space. At 800×600 every penumbra spans 4× the pixels: frame-1 grain would be finer, and the 2-px frame-1 floor narrower relative to the penumbra. Not measured. - **Casters are axis-aligned boxes; blades are voxelised cubes.** There is no real terrain, no LoD, and no VSC. - **The metrics compare with a point-sampled reference.** Anti-aliasing of hard edges under motion counts as error (§4.2), which inflates the camera-motion numbers. The excess was not separated out. - **One parameter set** was tuned on 10 floor sets. A per-size or per-k retune might move frame 1 / frame 3 by about 10-20 %. It would not change the cost or the moving-caster verdicts. - **Model runs**: every job ran in a 6 GB `systemd-run` scope, at most 2 at once, and peaked at about 130 MB.