3D engine that AI agents drive
Record a sky visibility volume read by every surface, measured, nothing kept (part of #197)
Nguyen Xuan An89e99e48b255
diff --git a/bench/reference/README.md b/bench/reference/README.mdindex ded022f0..6934f6fa 100644--- a/bench/reference/README.md+++ b/bench/reference/README.md@@ -1204,3 +1204,22 @@ Measured on the same Cycles arrays as main (GPU, 960 x 540; `brick-flat` redrawnThe shadow floors move toward Cycles (mostly by 0.02 to 0.2) but five scenes get worse and two pass the 0.002 limit (`material-spheres` +0.0093, `brick-flat` +0.0061; worst regression). Cause (inferred): the term cuts the bounce that reaches the sides of objects and walls, where Cycles still has all of it, more than it cuts the light in the shadowed floor tiles; `material-spheres` lit-level 1.09 after. The shadowed floor itself gets no bounce from the lower-half copy in the first place (a level surface sees none of a lower hemisphere), so the floor ratio gap is not mostly this term: removing the whole bounce took `material-spheres` only from 2.01 to 1.51. Not kept; `baseline.json` is unchanged.Next idea: occlude per surface, not per scene: a sky and sun visibility lookup for the ground next to each caster, which needs a texture in the core shader and is a size cost; or darken only the floor-facing lower part of casters, which the shader would need a height above the floor for.++## A sky visibility volume read by every surface, measured and not kept (2026-11-03, part of issue #197)++Idea, from the two notes above: a scene-wide scalar can not darken shadowed floors without hurting lit ground, so scale the world light of each surface by how much sky its place sees. Change tried: `skyVisibilityGrid` (24 upward rays per cell, the grid of the fog) over the bounds of all parts at up to 16384 cells, uploaded once as an `R8` 3D texture; a registered shader feature (`surfaceSky`, off unless the renderer is given the option, so no core code for other scenes) multiplied `occlusion` by the lookup at `worldPosition + normal * half a cell`, skipping surfaces that carry baked sky visibility (`vertexSkyVisibility` below 1) or a light map, and scenes with morph targets (the volume took the morph texture's unit). Main at `763e7fe`, GPU, 960 x 540, FLIP against Cycles with the stored arrays; change from the committed `baseline.json` (all 23 scenes; `mountain-valley` and `character` do not change in any row).++| Variant | Better than -0.002 | Worse than +0.002 | Worst |+| --- | --- | --- | --- |+| Strength 1, all normals | none | 21 of 23 | `long-street` +0.0804, `metal-room` +0.0631, `lit-interior` +0.0545, `temple-hall` +0.0119 |+| Strength 0.5, all normals | `temple-hall` -0.0051, `fog-room` -0.0065, `brushed-film` -0.0039, `car-paint` -0.0025 | 12 | `metal-room` +0.0314, `lit-interior` +0.0268, `brick-room` +0.0264, `long-street` +0.0164 |+| Strength 1, weighted by the upward share of the normal | `brick-flat` -0.0079, `brick-graph` -0.0083, `car-paint` -0.0038 | 14 | `long-street` +0.0373, `dark-shaft` +0.0177, `temple-hall` +0.0113, `metal-room` +0.0209 |+| Strength 0.5, weighted by the upward share of the normal | `brick-flat` -0.0042, `brick-graph` -0.0044, `car-paint` -0.0054, `brushed-film` -0.0022, `material-spheres` -0.0026, `temple-hall` -0.0030 | 10 | `long-street` +0.0138, `metal-room` +0.0104, `brick-room` +0.0092, `lit-interior` +0.0080, `dark-shaft` +0.0073 |+++- The lookup is isotropic, a cell sees a whole sphere. Beside a wall about half of the upward rays hit the wall itself (inferred), so a surface that faces the wall is darkened by its own plane as well, which its cosine term already counts: strength 1 on all normals made `brick-flat` worse by 0.0323. Weighting by the upward share of the normal removes that (measured: `brick-flat` -0.0079) and turns the brick scenes and `car-paint` better, so the term is usable for floors only.+- With floors only, the targets split. `temple-hall` improves at strength 0.5 (-0.0030) and worsens at 1 (+0.0113); `material-spheres` and `car-paint` improve at 0.5 (-0.0026, -0.0054); `long-street` worsens at every strength (+0.0138 at 0.5); `mountain-valley` does not change (its terrain carries baked sky visibility, which the term skips). Cause for the street (guessed, not isolated): the sun-lit street is under narrow sky as well, and the cells of a volume over a street that long are coarse.+- Ten scenes fail the 0.002 limit at the best variant, so nothing is kept. Guess: the gap is light that comes back from the lit surfaces the blocked rays hit, which a visibility alone does not hold.+- Not measured, because the change was reverted: the gzip bytes, the frame cost and the ray time at 16384 cells. One run with 100000 cells (to resolve the street) did not finish all 23 scenes in 10 minutes, so the ray build is the limit on a finer volume.++Engine code reverted; `baseline.json` is unchanged. Next idea, if this is taken up again: sky visibility traced from the floor texels themselves (a 2D map of the floor, one value per texel, 64 or more rays) instead of a coarse volume.