Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Record the probe contact shadow measurement, not kept (part of #167)

Nguyen Xuan An861cf55c1d19
diff --git a/bench/reference/README.md b/bench/reference/README.md
index d9598371..0b766ab1 100644
--- a/bench/reference/README.md
+++ b/bench/reference/README.md
@@ -970,3 +970,29 @@ Scores against Cycles, GPU, `--skip-blender` on the stored Cycles and EEVEE arra
No scene got worse by more than 0.0002 (`spot-area`, `fog-valley` 0.1855 to 0.1859). Frame cost on the RTX 3060 (`frame-time.mjs`, median of three runs): `brick-flat` 0.375 to 0.39 ms before and 0.375 to 0.38 after, `metal` 0.44 to 0.45 before and 0.44 after, so the extra lookup is below the timer's resolution. SwiftShader `transparency` in `bench/runtime`: 345.9 ms before, 347.5 after (15 frames; that scene has no environment map, so the shader path is the same).
`metal` is still 0.0046 above EEVEE, so the first box of #167 stays open. Where the rest is, by 6 by 8 block of the FLIP map (measured): the largest error is the lower half of the chrome sphere, where 67js is 0.062 brighter in display luminance than Cycles (EEVEE 0.022). Cycles shows the floor there darkened by the sphere's own contact shadow, and the sphere's probe traces the scene without the sphere, so the floor it shows is lit all the way to its base (inferred; the "seeing through the part itself" try above, 0.1117, was the attempt at that and was not kept). The rest of the frame is 67js 0.01 to 0.03 darker than Cycles, and EEVEE is darker still, so there is little left to gain from the direct specular. The floor holds over half of the error (0.0639 of 0.1147 in the table above) and is not a reflector.
+
+## The sphere's contact shadow in its probe, measured and not kept (2026-11-03, part of issue #167)
+
+The inference above, that the chrome sphere is too bright because its probe shows a floor with no shadow of the sphere, is right about the direction and wrong about the cure. Main reproduced `baseline.json` to four digits on the stored arrays first (`metal` 0.0962, `car-paint` 0.1028, `brushed-film` 0.1026, `material-spheres` 0.1185, `metal-room` 0.5071). Display luminance of the sphere's lower half, 67js minus Cycles, in four bands below the centre and three columns (GPU; the first column is the plain probe):
+
+| Band (top to bottom) | left | middle | right |
+| --- | --- | --- | --- |
+| 1 | -0.039 | -0.020 | -0.044 |
+| 2 | -0.038 | -0.024 | +0.048 |
+| 3 | +0.001 | +0.005 | +0.088 |
+| 4 (bottom edge) | +0.038 | +0.142 | +0.312 |
+
+The mean over the lower half is only +0.015 (Cycles 0.594, 67js 0.609, EEVEE 0.588); the excess sits in the bottom edge and on the right, where the sun's shadow falls in Cycles (sun from -x, +z). So the cause is the one inferred: a floor lit up to the base. Casting the sphere's shadow onto the probe's floor points fixed that edge (band 4 middle +0.142 to -0.092) and overshot everywhere else (band 3 middle +0.005 to -0.107, right +0.088 to -0.141). The probe sits at the sphere's centre, and a ray from the centre to the floor lands far from where the true reflected ray from the surface lands: for a pixel at the bottom of the sphere the true ray leaves the surface a few centimetres above the floor and meets it next to the contact point, while the centre ray meets it about a sphere radius further out. The shadow therefore moves to the wrong floor points.
+
+Scores against Cycles (GPU, the five scenes with a reflective part; every other scene has no object probe and is unchanged):
+
+| Variant | `metal` | `car-paint` | `brushed-film` | `material-spheres` | `metal-room` |
+| --- | --- | --- | --- | --- | --- |
+| Main | 0.0962 | 0.1028 | 0.1026 | 0.1185 | 0.5071 |
+| Shadow of the part on the probe's floor, full sun | 0.1038 | 0.1037 | 0.1036 | 0.1186 | 0.5077 |
+| Same, shadowed direct light weighted 0.35 | 0.0982 | 0.1029 | 0.1018 | 0.1184 | 0.5072 |
+| Same, weighted 0.2 | 0.0971 | 0.1028 | 0.1019 | 0.1184 | 0.5071 |
+
+Every weight is worse for `metal`, so the shadow is not kept and no engine file changed. A cure needs the lookup to account for where the ray leaves the surface (a parallax-corrected probe: the reflected ray intersected with a sphere or box proxy of the part and with the floor plane), which is a shader change with a per-pixel cost and its own issue.
+
+The floor, checked with the existing screen-space occlusion (`--ambient-occlusion <strength> --ambient-occlusion-radius <units>`, off by default): `metal` 0.0964 (0.5, 0.5), 0.0979 (1, 0.5) and 0.1097 (1, 1.5) against 0.0962 without it, so occlusion does not explain the floor's gap to Cycles either. It helps parts that sit on a floor with little reflection (`car-paint` 0.1028 to 0.1013, 0.1000 and 0.0960; `material-spheres` 0.1185 to 0.1181, 0.1174, then 0.1206), so it stays opt-in. The floor share of the `metal` error is therefore not contact darkening; the bounce light from the metal parts remains the candidate listed in the multiple scattering section.
diff --git a/changes/167-probe-shadow.md b/changes/167-probe-shadow.md
new file mode 100644
index 00000000..ca06a626
--- /dev/null
+++ b/changes/167-probe-shadow.md
@@ -0,0 +1 @@
+- Record that casting the part's own shadow onto its reflection probe does not close the metal gap (part of #167, which stays open): a shadowed floor in the probe fixes the bottom edge of the chrome sphere but overshoots the rest, metal 0.0962 to 0.1038, and the floor is not explained by screen-space occlusion either. No engine file changed; the measurements and the parallax-corrected probe that would be needed are in ench/reference/README.md.