# Soft sun shadows: P2 cap sweep and SDF closest-miss (2026-10-26) Status: **offline model screen**. There is no renderer code and no GPU in this round. Branch `shadow-sdf` off main @c1ff1446. **Verdicts:** - **Arm A** (P2, the hard ray plus a capped, contact-hardened filter): - **cap 1-2: screen further, then prototype.** It is a cheap, history-free fix for the stair-step and the sweep pop. It is not a wide penumbra. - **cap 8: owner decision** (look against cost, §6). - **Arm B** (an SDF with distance-field soft shadows): **kill** for direct sun shadows. It follows these rounds: - `shadow-practice` (P1/P2/P4); - `shadow-lod` (cone tracing, killed); - `shadow-blur` and its follow-up (the harness, and estimator A); - `shadow-temporal` (killed). Scratch is in `logs/shadow-sdf/` on nazrin: - **The model:** `model/`. - `sdf.ts` holds the field, the sampler and the march. - `bjob.ts` and `ajob.ts` run arms B and A on the floor sets. - `rjob.ts` runs the risk scenes, and `evjob.ts` the moving caster and the sweep step. - `storage.ts` measures the real regions. - `blur2.ts` is the follow-up's estimator file plus the cap `CAP`. - The rest is the prior rounds' harness, unchanged. - **Results:** `fullA/`, `fullB/`, `fullQ/` (field variants), `risk/`, `events/` and `storage.jsonl`. Every directory has a `rows.jsonl`; `steady.md` holds the full steady table. - **Owner sheets:** `owner/`, described in §5. Evidence tags as before: **[M]** measured in the model this round, **[V]** measured by an earlier round, **[I]** inference. ## 0. Summary - **Arm A, steady look [M].** - It is clean at every cap: no streaks, specks or blotches, and the umbra is exactly dark. - But a cap of 1-2 voxels barely moves the mean error against the physically wide reference: - at 4° zoom, hard 0.241 → cap 1 0.214 → cap 2 0.174 → cap 4 0.139 → cap 8 0.103; - the uncapped A is 0.026. - What the cap buys is the edge: - a voxel stair-step becomes a ramp; - a sweep step on a plate at 4° changes a pixel by at most 0.31 (cap 2) or 0.05-0.09 (cap 8), against hard's whole-pixel flip (1.0). - Tall casters at a low 0.53° sun have penumbrae of 20-40 voxels too. Every cap is far below those. - **Arm A behaviour [M]:** history-free by construction, so there are no trails and no settle after a stop. - **Arm A cost [I]:** - cap 1-2: about 0.01-0.1 ms a sun, 0.1-0.8 ms at N = 8; - cap 8: about 0.1-1.5 ms a sun, 0.8-12 ms at N = 8. - **Arm B, look [M].** - The hypothesis was half right. An exact field has no grid-phase blobs, and thin casters are not lost: the SDF images are smooth. - The closest-miss estimator is structurally wrong, though. At 4°/8° zoom it scores 0.134/0.142 (sd) or 0.125/0.159 (sdu), against main's old edge field at 0.085/0.117 and uncapped A at 0.026/0.020. - With an **exact** analytic field (an oracle), the error at 4-8° drops only to 0.122-0.139. So the estimator, not the field's resolution, is the limit. - At 0.53° it is the reverse: the voxel field erodes every shadow edge by about 0.2-0.3 voxel, which is a 1-px lit rim (0.168; the oracle gets 0.089). - **Arm B's failure modes [M]:** - **The single tightest occluder** (Quilez, Aaltonen, signed) greys the umbra of anything thin along the ray: plates and stacked plates at 20-45°, box tops. The interior distance measures the slice, not the projection. - **The directional union fix** (`sdu`) restores those umbrae. It then over-darkens thin casters (pole, rails, fence, slats 45°), because a near-miss from each side closes the disk. - No variant gets both. Every variant is worse than the edge field at 4° zoom. - D matters little past 8. - Field quantisation at 1/8 voxel, the body_field format, costs nothing; 1 voxel costs a lot at 0.53°. - **Arm B cost [M/I]:** - 16-20 field steps a ray at a 30° sun, about the same as the hard DDA's ~17. Low suns cost 50-80 steps. - Uncached, that is about 1-1.8 ms a sun at mid elevations and 3-7 ms low, or **8-60 ms at N = 8**. - Storage at D = 16 is 2-4 MB per 256³ region as 8³ r8 bricks (the SVT is 0.1-4 MB). - The JS build is 1.7-2.9 s a region. - **Recommendation.** - Kill B. - Screen A at cap 1-2 further as "hard + edge" (the owner's P1 question). - Whether a cap of 4-8 is worth its cost and its look is an owner decision. - Nothing in this round makes 4-8° physically soft at N = 8 within the headroom. ## 1. Method [M] ### 1.1 Shared harness The prior rounds' harness is reused unchanged, so the numbers compare directly: - the 14 floor cases × 5 elevations × 3 sizes (62 sets per size, 372 with both views); - the zoom view (1 voxel = 1 px) and the fit view; - the 1 024-ray reference (`logs/sscreen/full/img`); - the metrics: mean penumbra |error|, spike sets (> 0.15) and seam sets (≥ 10 per 10k); - the hard, edge, BC N = 256 and uncapped A rows, as stored by earlier rounds. **The risk scenes** (ledge, wall, stacked; perspective camera, 30° sun): - they are shadow-blur's, but **with the boxes snapped to whole voxels**, because the SDF is a voxel field; - the reference and hard images are therefore recomputed here; - the hard row matches the follow-up's to ±0.01. **Reading the seam count for capped methods.** A seam is a jump between neighbours larger than 1.5× any jump the reference has nearby. A capped ramp is steeper than the wide physical one by design, so a cap counts seams wherever the true penumbra is wider than the cap. Read spikes and the sheets for artifacts. Seams here mostly mean "sharper than physics". ### 1.2 Arm A as modelled - This is the follow-up's estimator **A = fp + ncb**: - footprints; - the ratio form D = N/(N + C); - the plane test; - the height rule. - The kernel radius is capped: **r = min(d·tanR, cap/2)** in light space (perpendicular to the sun), applied everywhere a radius is formed. - "cap" is the full light-space penumbra width in voxels. It is world-space and never screen-space. On a floor it is stretched by 1/sin e along the sun's azimuth, as physics does. - The pyramid is exact (the pruned tree) and the guard band is sized to the cap. - Contact hardening comes for free: r grows with the blocker distance d. - It is deterministic and history-free. - The P1 form, a fixed ramp without contact hardening, was not run separately. At cap 1 the contact-hardened version reaches the cap within about 0.9 m of the blocker at 4°, so the two differ only at contact. ### 1.3 Arm B as modelled **The field** is the same construction as `physics-rs/src/body_field.rs`, extended to the exterior side: - per voxel-cell centre, the exact separable EDT (Felzenszwalb & Huttenlocher) to the nearest centre of the other kind, minus ½ voxel; - signed: + in air, − in solid; - clamped to ±D and quantised to q (default 1/8 voxel, body_field's); - read trilinearly between centres. **Structures and terrain:** - Each structure (a case's boxes) has its own field in its own frame. - The terrain floor is the plane y = 0, whose voxel field is exactly linear. - The scene value is min(terrain, structures). That is exact for disjoint objects, and it gives entities and terrain the same rule. - Glass is left out of the field and multiplies in its hard transmittance. **The march:** - from the receiver toward the sun's centre, step = max(|h|, 0.5 voxel); - through solids too, for the signed variants; - outside every shell (h = D) it switches to "far" steps, standing in for the SVT's empty-node DDA. The penumbra half-width at distance t is **w = min(t·tanR, D)**. It is capped at what the field can see, so D also acts as a cap of 2D. **Estimators** (one march yields all of them): | name | rule | |---|---| | `iq` | Quilez: outer only, res = min h/(2w), V = smoothstep(res); a hit is dark | | `aa` | iq plus Aaltonen's closest-point triangulation | | `ao` | outer only, with the disk-segment curve fitted into [0, w]: the umbra and the outer edge are placed right, the inner half is dark | | `sd` | **signed, centred**: s = min over the whole march (triangulated in air) of h/w; V = the exact visible disk fraction past one straight edge at offset s·w. It is exact for a single straight-edged occluder | | `sdp` | sd per "event" (each separate dip of s), multiplied: fusion for independent occluders | | `sdu` | **directional union**: every sample with s < 1 is a half-plane in the light-space disk, on the far side of the field gradient projected onto the light plane, at the slice offset h/(w·\|ĝ⊥\|). The union is evaluated on 32 disk points. Near-misses from opposite sides close the disk, which a single minimum cannot | | `…x` | the same estimator on the **exact** analytic signed distance (an oracle), separating the estimator's error from the voxel field's | No estimator uses the gravity axis. The gradient and the light frame are generic. ## 2. Steady metrics [M] Each cell is mean penumbra |error| · spike sets · seam sets, out of 62 sets per size. The full table, with the fit view, is `logs/shadow-sdf/steady.md`. **Zoom view (1 voxel = 1 px):** | estimator | 0.53° | 4° | 8° | |---|---|---|---| | BC N = 256 | 0.004 · 0 · 0 | 0.005 · 0 · 0 | 0.005 · 0 · 1 | | hard (main) | 0.232 · 27 · 51 | 0.241 · 47 · 58 | 0.233 · 45 · 56 | | old edge field (main-old) | 0.058 · 24 · 24 | 0.085 · 38 · 50 | 0.117 · 39 · 55 | | A uncapped (follow-up, killed on cost) | 0.081 · 3 · 4 | 0.026 · 4 · 1 | 0.020 · 0 · 1 | | **A, cap 1** | 0.177 · 21 · 44 | 0.214 · 46 · 59 | 0.213 · 46 · 56 | | **A, cap 2** | 0.131 · 11 · 25 | 0.174 · 38 · 55 | 0.183 · 38 · 55 | | **A, cap 4** | 0.103 · 3 · 10 | 0.139 · 16 · 42 | 0.158 · 16 · 52 | | **A, cap 8** | 0.086 · 3 · 4 | 0.103 · 4 · 20 | 0.128 · 0 · 33 | | B iq, D = 16 | 0.327 · 18 · 26 | 0.428 · 32 · 56 | 0.439 · 35 · 56 | | B ao, D = 16 | 0.253 · 16 · 36 | 0.305 · 18 · 52 | 0.321 · 15 · 54 | | **B sd, D = 16** | 0.168 · 13 · 7 | 0.134 · 12 · 17 | 0.142 · 10 · 16 | | B sdp, D = 16 | 0.143 · 17 · 13 | 0.120 · 18 · 36 | 0.140 · 16 · 39 | | **B sdu, D = 16** | 0.164 · 14 · 20 | 0.125 · 33 · 49 | 0.159 · 33 · 49 | | B sd, exact field (oracle) | 0.089 · 10 · 7 | 0.122 · 13 · 18 | 0.139 · 9 · 18 | | B sdu, exact field (oracle) | 0.082 · 17 · 16 | 0.127 · 37 · 47 | 0.163 · 38 · 49 | **Fit view:** | estimator | 0.53° | 4° | 8° | |---|---|---|---| | hard | 0.227 · 26 · 46 | 0.228 · 59 · 60 | 0.203 · 62 · 61 | | old edge field | 0.166 · 40 · 31 | 0.160 · 56 · 57 | 0.183 · 57 · 61 | | A uncapped | 0.111 · 7 · 8 | 0.034 · 8 · 0 | 0.021 · 4 · 0 | | A, cap 2 | 0.160 · 18 · 30 | 0.178 · 56 · 59 | 0.167 · 60 · 61 | | A, cap 8 | 0.115 · 7 · 10 | 0.114 · 34 · 39 | 0.123 · 38 · 47 | | B sd, D = 16 | 0.166 · 21 · 7 | 0.146 · 27 · 33 | 0.138 · 21 · 40 | | B sdu, D = 16 | 0.160 · 14 · 9 | 0.141 · 49 · 49 | 0.161 · 53 · 55 | **The D sweep and the field variants** (zoom, mean error at 0.53 / 4 / 8°): | | D = 4 | D = 8 | D = 16 | D = 32 | |---|---|---|---|---| | sd | 0.168 / 0.141 / 0.149 | 0.165 / 0.138 / 0.146 | 0.168 / 0.134 / 0.142 | 0.170 / 0.134 / 0.139 | | sdu | 0.168 / 0.152 / 0.176 | 0.161 / 0.135 / 0.167 | 0.164 / 0.125 / 0.159 | 0.167 / 0.127 / 0.155 | At D = 16, for sd: - quantisation q = 0 (float): 0.170 / 0.134 / 0.142; - q = ½ voxel: 0.175 / 0.135 / 0.143; - **q = 1 voxel: 0.331 / 0.172 / 0.158**; - step 0.25 instead of 0.5: 0.166 / 0.134 / 0.145. So 8 bits over ±16 (q = 1/8) is enough, and the step size is not the limit. **Reading the tables:** - **Arm A** improves monotonically with the cap. Spikes fall to 0-4 sets by cap 8. Below cap 4 it is a hard shadow with clean edges. - On the floor sets "near the camera" the reference penumbra is 10-200 px wide: tall casters, low suns. A capped estimator cannot approach it there. - That is the clamp production ships (practice §0), seen against an unclamped reference. - **Arm B** never gets near A uncapped, and at 4-8° it is worse than the old edge field in mean error. It does have 3-4× fewer spike and seam sets than the edge field (sd). - The oracle rows show that most of the 4-8° error belongs to the closest-miss estimator itself. - At 0.53° about half belongs to the voxel field: 0.168 against the oracle's 0.089. ## 3. Risk cases [M] ### 3.1 Perspective risk scenes (30° sun, snapped boxes) Each cell is mean · spike max · seams per 10k. | estimator | ledge 0.53° | wall 0.53° | stacked 0.53° | ledge 4° | wall 4° | stacked 4° | ledge 8° | wall 8° | stacked 8° | |---|---|---|---|---|---|---|---|---|---| | hard | 0.236 · 0.08 · 5 | 0.237 · 0.05 · 0 | 0.239 · 0.18 · 38 | 0.227 · 0.46 · 39 | 0.238 · 0.30 · 60 | 0.236 · 0.53 · 138 | 0.226 · 0.56 · 53 | 0.239 · 0.59 · 73 | 0.241 · 0.62 · 138 | | A cap 1 | 0.100 · 0.00 · 0 | 0.144 · 0.12 · 2 | 0.110 · 0.09 · 2 | 0.203 · 0.46 · 57 | 0.149 · 0.28 · 96 | 0.191 · 0.45 · 283 | 0.215 · 0.55 · 100 | 0.191 · 0.57 · 148 | 0.218 · 0.53 · 356 | | A cap 2 | 0.099 · 0.00 · 0 | 0.144 · 0.12 · 2 | 0.110 · 0.09 · 2 | 0.167 · 0.29 · 81 | 0.081 · 0.22 · 3 | 0.141 · 0.23 · 178 | 0.198 · 0.34 · 130 | 0.151 · 0.57 · 129 | 0.191 · 0.32 · 457 | | A cap 4 | 0.099 · 0.00 · 0 | 0.144 · 0.12 · 2 | 0.110 · 0.09 · 2 | 0.111 · 0.17 · 14 | 0.020 · 0.12 · 2 | 0.072 · 0.09 · 1 | 0.171 · 0.32 · 143 | 0.079 · 0.34 · 4 | 0.146 · 0.17 · 135 | | A cap 8 | 0.099 · 0.00 · 0 | 0.144 · 0.12 · 2 | 0.110 · 0.09 · 2 | 0.019 · 0.10 · 0 | 0.022 · 0.12 · 2 | 0.014 · 0.09 · 1 | 0.118 · 0.14 · 22 | 0.017 · 0.19 · 5 | 0.071 · 0.09 · 1 | | B sd D16 | 0.238 · 0.00 · 0 | 0.458 · 1.00 · 1 | 0.328 · 0.29 · 0 | 0.120 · 0.17 · 1 | 0.106 · 1.00 · 24 | 0.139 · 0.13 · 75 | 0.081 · 0.31 · 1 | 0.105 · 0.96 · 14 | 0.188 · 0.11 · 21 | | B sdp D16 | 0.237 · 0.00 · 0 | 0.454 · 1.00 · 1 | 0.326 · 0.13 · 0 | 0.070 · 0.14 · 3 | 0.081 · 1.00 · 3 | 0.077 · 0.10 · 4 | 0.068 · 0.31 · 11 | 0.054 · 0.96 · 7 | 0.114 · 0.09 · 10 | | B sdu D16 | 0.258 · 0.00 · 0 | 0.469 · 1.00 · 1 | 0.338 · 0.13 · 0 | 0.059 · 0.13 · 12 | 0.088 · 1.00 · 6 | 0.054 · 0.13 · 31 | 0.101 · 0.28 · 45 | 0.053 · 0.97 · 20 | 0.095 · 0.17 · 90 | **Arm A:** - At 0.53° every cap gives the same result as the uncapped A (0.099-0.144, as in the follow-up). These scenes' blockers are within the cap. - At 4° cap 8 is already near uncapped (0.014-0.022). Short scenes have short penumbrae. - At 8° the ledge (blocker at 64 voxels, half-width 2.2) needs more than cap 8. - The small caps' seam counts are the clamped edge, not artifacts (§1.1). Spikes stay at hard's level or below. **Arm B at 0.53°:** - The wall and stacked scenes are 2-4× **worse than hard**. The voxel field rounds each convex edge by about 0.2-0.3 voxel: - the EDT's "centre minus ½" over-reads off-axis (body_field documents up to 0.21); - trilinear interpolation across the surface makes it worse. - The 0.53° penumbra is narrower than that within about 40 voxels of the blocker. So every shadow loses a 1-px rim to light: the red outlines in `owner/risk-0.53deg.png`. - The wall's spike of 1.0 is the pole's foot. **Arm B at 4-8°:** sdp and sdu are the best B rows (0.05-0.11). They are still 3-5× uncapped A's numbers on the same scenes in the follow-up (0.016-0.022). ### 3.2 Thin casters, slats, fences, stacked plates (floor zoom subsets) Mean · spikes · seams. | subset (sets per size) | size | hard | edge | A uncapped | A cap 2 | A cap 8 | B sd | B sdu | B sd (exact field) | |---|---|---|---|---|---|---|---|---|---| | pole, rail, fence (14) | 4° | 0.275 · 12 · 13 | 0.161 · 12 · 13 | 0.032 · 3 · 0 | 0.127 · 12 · 10 | 0.057 · 3 · 3 | 0.129 · 8 · 9 | 0.163 · 12 · 11 | 0.102 · 8 · 9 | | pole, rail, fence (14) | 8° | 0.237 · 12 · 13 | 0.233 · 12 · 14 | 0.015 · 0 · 0 | 0.118 · 11 · 12 | 0.050 · 0 · 6 | 0.128 · 9 · 9 | 0.184 · 12 · 12 | 0.122 · 8 · 9 | | slats, all (5) | 4° | 0.321 · 4 · 4 | 0.138 · 5 · 5 | 0.077 · 1 · 0 | 0.226 · 4 · 5 | 0.144 · 1 · 0 | 0.105 · 2 · 2 | 0.170 · 3 · 5 | 0.105 · 2 · 2 | | slats 45-80° (2) | 4° | 0.464 · 2 · 2 | 0.121 · 2 · 2 | 0.117 · 1 · 0 | 0.249 · 2 · 2 | 0.117 · 1 · 0 | 0.100 · 2 · 2 | 0.164 · 2 · 2 | | | stack (4) | 4° | 0.230 · 3 · 4 | 0.022 · 1 · 2 | 0.018 · 0 · 1 | 0.190 · 3 · 4 | 0.100 · 0 · 1 | 0.138 · 0 · 1 | 0.069 · 2 · 3 | 0.121 · 0 · 1 | | stack (4) | 8° | 0.240 · 3 · 4 | 0.036 · 2 · 3 | 0.024 · 0 · 1 | 0.222 · 2 · 4 | 0.160 · 0 · 2 | 0.179 · 0 · 1 | 0.111 · 3 · 4 | 0.171 · 0 · 1 | | louver, cross (10) | 4° | 0.221 · 9 · 9 | 0.087 · 9 · 10 | 0.020 · 0 · 0 | 0.169 · 6 · 9 | 0.077 · 0 · 3 | 0.161 · 2 · 3 | 0.133 · 6 · 9 | 0.164 · 3 · 3 | **By eye** (`owner/floor-4deg-armB.png`): - **Single-minimum estimators (sd, sdp):** - the stacked plates', box tops' and louver boards' umbrae are grey (0.3-0.5 too light); - the slat field's average is about right, but it is striped. - **The union (sdu):** - those umbrae are black again; - poles, rails and the cross are too dark and too wide, because the half-plane model treats a 1-voxel rod as an edge; - the slats are over-darkened. - The LoD round's failure was **blobs and vanishing thin casters**. Here there are no blobs, and thin casters **over**-darken instead of vanishing: the hypothesis about mip inflation holds. - But the slats are not fixed. Their under-darkening becomes striping (sd) or over-darkening (sdu). **Arm A** (`owner/floor-4deg-armA.png`): - It is clean. Its one systematic flaw is the old one: slats at 80° under cap 4-8 come out as an even over-darkening (0.1-0.2), because the hard mask's stripe coverage is not the disk average (shadow-blur §2). - With cap ≤ 2 the slats stay striped like hard, with soft edges. ## 4. Moving casters and the sweep step [M] Both arms are **history-free**: every frame is a fresh evaluation. So by construction there are **no trails, no re-warm and no settle after a stop**, and no mode shift when a caster or the sun starts or stops. What can still show is how much a pixel changes in one frame relative to the reference's change (crawl or pop). **Moving caster** (0.3 voxel a frame along x for 6 frames, camera still; `events/`). - **For arm B** the structure's field moves with it in its own frame. It is never re-voxelised, so it moves continuously. - Each cell is the largest per-frame |Δest − Δref| · px per 10k above 0.1. | set | hard | A cap 2 | A cap 8 | B sd D16 | B sdu D16 | |---|---|---|---|---|---| | plate 20° @ 4° | 1.00 · 40 | 0.24 · 200 | **0.06 · 0** | **0.01 · 0** | 0.19 · 2 | | plate 20° @ 8° | 1.00 · 45 | 0.24 · 225 | 0.06 · 0 | 0.02 · 0 | 0.18 · 1 | | plate 20° @ 0.53° | 0.96 · 40 | 0.19 · 120 | 0.14 · 196 | 0.06 · 0 | 0.11 · 1 | | slats 45° @ 4° | 1.03 · 846 | 0.50 · 2538 | 0.27 · 3412 | 0.09 · 0 | 0.33 · 1641 | | fence 10° @ 4° | 1.04 · 1182 | 0.43 · 1515 | 0.43 · 450 | 1.00 · 276 | 1.00 · 1108 | | pole 45° @ 4° | 1.01 · 44 | 0.70 · 64 | 0.70 · 27 | 1.00 · 14 | 1.00 · 49 | - The 0.7-1.0 maxima on the pole and the fence come from contact pixels at the casters' feet, which the caster covers or uncovers. Every estimator has them, hard included. - The px-per-10k column carries the signal: - on extended casters, arm A at cap 8 and B sd move almost exactly with the reference; - small caps still crawl at the capped edge (0.24); - sdu's union flips disk points (0.2-0.3). - Per-frame mean error is the steady error; there is no lag term. **Sweep step** (the cached direction jumps by the tolerance, 0.53°/4 = 0.1325°, in one frame). Each cell is the largest per-pixel change in that frame · px per 10k changing by more than the reference's change + 0.1. | set | hard | A cap 2 | A cap 8 | B sd D16 | B sdu D16 | |---|---|---|---|---|---| | plate 20° @ 4° | 1.00 · 90 | 0.35 · 348 | **0.09 · 0** | **0.05 · 0** | 0.25 · 45 | | plate 20° @ 8° | 1.00 · 87 | 0.35 · 352 | 0.09 · 0 | 0.04 · 0 | 0.27 · 78 | | fence 10° @ 4° | 1.00 · 20 | 0.11 · 0 | 0.02 · 0 | 0.17 · 35 | 0.29 · 381 | | plate 20° @ 0.53° | 1.00 · 454 | 0.35 · 129 | 0.26 · 78 | 0.35 · 93 | 0.42 · 132 | | fence 10° @ 0.53° | 1.00 · 104 | 0.22 · 0 | 0.22 · 0 | 0.27 · 246 | 0.33 · 160 | - Hard flips whole pixels at every step. - **A at cap 8, or B sd, turns a 4-8° sweep step into a change under 0.1.** Cap 2 halves the 0.53° pop (1.0 → 0.2-0.35) but still steps. - Both arms could instead run per frame with the exact sun direction (no snap), at their uncached price. - Sheets: `owner/move-{plate_20,fence_10,slats_45}-{0.53,4}deg.png`. The rows are frames 0, 1 and 5, then the post-step frame (s1). ## 5. Owner sheets (`logs/shadow-sdf/owner/`) The format is the prior rounds': each estimate is followed by its signed error against the 1 024-ray reference (red too bright, blue too dark, full colour at |E| = 0.25). | sheet | content | |---|---| | `floor-{0.53,4,8}deg-armA.png` | 10 zoom sets (plate 10, pole 20, pillar 20, slats 45/80, stack 20, fence 10, boxcube 20, louver 20, cross 45). Columns: ref, hard, edge (main-old), A cap 1/2/4/8 | | `floor-{0.53,4,8}deg-armB.png` | the same sets. Columns: ref, hard, ao, sd, sdp, sdu (D = 16), and sd on the exact field | | `risk-{0.53,4,8}deg.png` | ledge, wall, stacked. Columns: ref, hard, A cap 2/8, sd, sdu | | `sdf-D-sweep-4deg.png` | sdu D = 4/8/16/32 and sd D = 4/32 on plate, pillar, stack, fence | | `move-*.png` | the moving caster and the sweep step (§4) | ## 6. Cost [I, from M counts] **Prices** (shadow-blur §4.1, temporal §5.1; RX 5700, 800×600, ±2-3×): - a 16 B tap a pixel costs 0.004-0.012 ms; - an uncached hard ray costs about 1.5 ms (about 17 DDA steps, so about 0.09 ms a step); - a field step (brick lookup + one filtered r8 fetch, dependent) is priced like a DDA step, 0.05-0.09 ms a pixel. ### 6.1 Arm A **f is the share of pixels the gather touches** [M]: - floor zoom (penumbra-centred, the worst case): 0.046 / 0.063 / 0.092 / 0.135 for caps 1 / 2 / 4 / 8; - fit view: 0.012-0.028; - risk scenes: 0.005-0.13. **Samples in reach a paid pixel** [I] are about π(cap/2 + ½)² / sin e pixels at 1 voxel/px: - cap 1: 4-36; - cap 2: 10-80; - cap 4: 28-225; - cap 8: 90-730, for e from 45° down to 5°. With mip-matched windows near the camera this is bounded by about 2·(2K+1)² ≈ 50-250. The model's exact tree visits more (its counts are in `fullA/rows.jsonl`); that is not a GPU form. **The guard band** is about (cap/2)/sin e px: ≤ 10-27 px for cap 1-2, and up to 50-300 px for cap 8 at low suns (the model's M). | cap | per sun | N = 8 | notes | |---|---|---|---| | 1 | 0.01-0.05 ms | 0.1-0.4 ms | classify 0.01-0.03 plus f × ≤ 40 taps | | 2 | 0.02-0.1 ms | 0.15-0.8 ms | | | 4 | 0.05-0.4 ms | 0.4-3 ms | f ≈ 2-10 % | | 8 | 0.1-1.5 ms | 0.8-12 ms | f ≈ 3-15 %, plus guard-band hard rays (uncached) at low suns | These match practice §6's estimates, now with measured f. The hard ray itself stays main's (cached world T plus the inline entity ray). ### 6.2 Arm B **Field steps a ray** [M]: | | 5° | 10° | 20° | 45° | 80° | risk scenes (30°) | |---|---|---|---|---|---|---| | mean steps, floor zoom, D = 16 | 83 | 51 | 32 | 19 | 16 | 16-20 | - Of these, 60-80 % are shell steps (h < D). The rest are far steps standing in for the SVT DDA. - D changes the mix, not the total: D = 4 gives 18 shell + 18 far, and D = 32 gives 31 + 6, at 36 a ray in both cases. - The grazing-floor march is what costs at low suns. It is the receiver's own surface staying within 0.5-1 voxel of the ray. | | per sun | N = 8 | |---|---|---| | uncached, every facing pixel, sun ≥ 20° (16-32 steps) | 1-2.5 ms (≈ 1-1.7 hard rays; the march **replaces** the DDA, so about +0-1 ms over main) | 8-20 ms | | uncached, sun 5-10° (50-80 steps) | 3-7 ms | 25-60 ms | | cached in VSC slots like main's T | refresh share × the above, plus a wider invalidation (a near-miss within w of a moving caster: the dirty box grows by D on every side) | — | | entities (inline per pixel per frame, as main's entity ray) | a march through each entity's own field: about the shell steps near the entity (5-20) | ×8 | Against the 0.7-2.3 ms headroom, B's uncached N = 8 does not fit at any elevation. ### 6.3 SDF storage and build [M, on generated regions] These come from `storage.ts` on 8 regions of 256³: earthlike near spawn ×4, marble-pillars ×2, sky-islands ×2. Water counts as solid, and neighbour regions read as air, so these are upper bounds. One byte a voxel (signed r8, q = 2D/255). | D | shell voxels (share of region) | 8³ bricks per region | MB/region raw (512 B a brick) | with a 1-voxel apron (10³) | 16³ bricks | |---|---|---|---|---|---| | 4 | 1.9-4.7 % | 1 250-3 470 | 0.6-1.8 | 1.2-3.5 | 230-720 | | 8 | 3.4-9.1 % | 1 650-4 890 | 0.8-2.5 | 1.7-4.9 | 280-880 | | 16 | 6.1-18.1 % | 2 520-7 830 | 1.3-4.0 | 2.5-7.8 | 390-1 255 | | 32 | 11-36 % | 4 240-13 770 | 2.2-7.0 | 4.2-13.8 | 625-1 994 | The same regions' SVT bytes are 0.14-4.0 MB. At D = 16 the field is about 1-30× the SVT, region for region. **Build:** - **The whole region:** a dense 256³ signed EDT took 1.7-2.9 s in JS on one thread (two transforms). A Rust integer build like body_field's is probably 0.2-0.5 s per region on a server worker [I]. - **Edits:** a voxel change moves distances only within D. An edit box e recomputes (e + 2D)³ while reading (e + 4D)³. A 1-voxel edit at D = 16 reads 65³ (≈ 1/60 of a region): about 30-50 ms in JS, about 5 ms in Rust [I]. It re-uploads ≤ (1 + 2D/8)³ = 125 bricks (64 KB). - **Entities:** a per-structure field in local space, built once per byte change, like body_field. **Reusing `physics-rs/src/body_field.rs`:** - What it stores: - one byte a cell over the structure's occupancy box plus a 1-cell air margin; - the **interior depth only** (0 in air), in eighths of a voxel, capped at 31.75; - an exact separable integer EDT, minus ½; - built lazily on the first deep-contact sample, ≤ 4 MB a structure. - **Reusable as is:** the EDT build, the quantisation and the trilinear sampler with its gradient. - **Not reusable as is:** - shadows need the **exterior** side, so the box grows by 2D per axis (a die: 66³ → 82³ at D = 8, 287 KB → 551 KB); - shadows need it on the GPU, uploaded per structure; - it is server-side physics data built lazily, while the client would need it for every visible entity. - Since the shadow estimator fails on look, this was not taken further. ## 7. Verdicts and owner decisions ### Arm A: P2 cap sweep **Look:** - **Cap 1-2:** hard with clean, contact-hardened edges. No new artifacts. The stair-step is gone and the sweep step softens. - **Cap 4-8:** physically right short penumbrae and a clamped long one. It is near uncapped A on short-range scenes (risk 4°: 0.014-0.022). - **Neither** looks like a 4-8° sun on tall or distant casters. **Behaviour:** history-free. No trails, and no mode shift on start or stop. **Cost:** cap 1-2 fits N = 8 (0.1-0.8 ms). Cap 8 at N = 8 (0.8-12 ms) fits only at the low end. **Verdict:** - **Screen further (cap 1-2) → prototype.** Next: P1's fixed ramp against the contact-hardened cap 1, the perspective pans and walks, and a real tap count. - **Cap 4-8 is an owner decision**, below. ### Arm B: SDF closest-miss **Verdict: kill.** - The closest-miss family cannot produce the inner penumbra from one ray's samples. A field slice is not the occluder's projection. - Its two fixes trade umbra fidelity against thin-caster fidelity. The better of them is still worse than the old edge field at 4° (0.125-0.134 against 0.085). The exact-field oracle shows that a finer field would not save it. - At 0.53°, a voxel-resolution field is too coarse: it erodes every edge by a pixel. - Uncached N = 8 costs 8-60 ms. **What carries over:** - an exact field has no grid-phase blobs; - per-structure fields give moving casters continuous, history-free shadows; - body_field's 8-bit, 1/8-voxel format is precise enough. These matter for AO or contact terms, not for sun penumbrae. ### Decisions for the owner (numbers above; nothing is landed) 1. **Kill arm B?** Recommended: yes (§2, §3, §6.2). 2. **Arm A's cap** (the main look-against-cost call): | cap | 4° zoom mean · spikes | sweep step on a plate at 4° | N = 8 cost | |---|---|---|---| | 2 | 0.174 · 38 | 0.35 | 0.15-0.8 ms | | 8 | 0.103 · 4 | 0.09 | 0.8-12 ms | | hard | 0.241 · 47 | 1.0 | 0 | Either way, tall or distant casters under a 4-8° sun stay crisper than physics: production's clamp. 3. **Is "hard + clean edge" the goal?** If so, cap 1-2 (or P1's fixed ramp) is the cheap path, and the large-sun cutoff (8°→10° fade) carries the "big soft sun" impression. 4. **0.53°:** - every cap gives 0.13-0.18 on the floor sets (against hard's 0.23) and equals uncapped A on the risk scenes (0.10-0.14); - most of the remaining 0.53° error is the sub-pixel staircase that every hard-ray method has (follow-up decision 5). 5. **Run arm A per frame with the exact sun direction** (no sweep snap) or keep the snap? - The snap's per-step pop is 0.09 at cap 8 and 0.35 at cap 2 at 4°. - Running per frame is a cost question for the prototype. ## 8. Limits - Offline model only: no GPU and no measured cost. Costs are [I] from earlier rounds' prices; f and the steps a ray are [M]. - Arm A uses the exact pyramid. The GPU's windowed form at small caps was not modelled. At caps ≤ 2 a level-0 window should be equivalent [I]. - The field is built from boxes (the floor cases) and from snapped risk scenes. Slopes and real terrain were measured for storage only, not for look. - The floor is analytic in the field. Real terrain's voxel staircase would add grazing near-misses (sdu over-darkening) that were not measured. - The events are floor zoom views with x-motion only. There was no rotation and no perspective pan. - Storage counts water as solid and treats unloaded neighbours as air (upper bounds). The build times are JS, single thread. - **Memory hygiene:** every heavy job ran in a 6 GB `systemd-run --user --scope`, one at a time. The peak was under 1 GB.