Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Score the reference scenes with the shadow aimed along the sun (part of #206)

Nguyen Xuan An4cf61233682f
diff --git a/bench/reference/README.md b/bench/reference/README.md
index 3cdb098e..ff76522f 100644
--- a/bench/reference/README.md
+++ b/bench/reference/README.md
@@ -747,3 +747,21 @@ Every other scene keeps its score to four digits. Tried and not kept, on `temple
| Emission and lamps, 64 rays, weight 0.5 | 0.0644 | 0.2450 |
The sun's bounce helps `fog` (0.2240 to 0.1065) and `temple-hall` but breaks `dark-shaft`, whose ambient already stands in for it, so it stays out. The whole-frame score of `temple-hall` without a bake is 0.0007 worse (0.0640 to 0.0647): the grid is isotropic and the fog has `anisotropy` 0.6, so the light cannot follow the forward lobe toward the window, and a weight that lifts the whole frame back to 0.0640 leaves the region at 0.2450, 0.0005 under EEVEE. A baked first attempt read the lightmap in the emissive slot as a source and scored 0.50 to 0.69; baked parts are skipped now. Cost: the grid takes 0.3 s for `temple-hall` and 0.07 s for `dark-shaft` (measured in the page, 64 rays, on a loaded machine), after the sky rays (1.7 s and 0.03 s). `entry:core` grows 28 bytes gzip (85,260 to 85,288); no budget changed. `baseline.json` and the images were not rewritten.
+
+## The sun shadow follows the sun (2026-11-03, part of issue #206)
+
+Several scenes aimed their shadow map along a hand-set eye that sat a few degrees off the sun the shading and Blender use (`foliage`: map along (-6, 11, 8), sun (-3, 6, 4)). Every scene now builds its shadow eye with `shadowAlongSun` from its own sun direction, at the old distance, keeping extent, near and far. The renderer does the same when `shadowBounds` gives no `eye` (`src/shadow-light.js`, also used by the cascaded shadows), and redraws the map when `environment.lightDirection` changes.
+
+Measured with `npm run reference -- --skip-blender`, before and after on the same Cycles and EEVEE arrays, GPU against Cycles (EEVEE in brackets). Scenes not listed keep their score to four digits.
+
+| Scene | before | after |
+| --- | --- | --- |
+| `foliage` | 0.1023 (EEVEE 0.0888) | 0.0989 |
+| `long-street` | 0.1407 (EEVEE 0.0976) | 0.1267 |
+| `character` | 0.0799 (EEVEE 0.0622) | 0.0717 |
+| `fog` | 0.2240 | 0.2256 |
+| `brick-graph` | 0.1602 (EEVEE 0.1221) | 0.1637 |
+| `brick-flat` | 0.1272 (EEVEE 0.1099) | 0.1346 |
+| `outdoor-hdri` | 0.0462 | 0.0460 |
+
+`foliage` improves by 0.0034 but still trails EEVEE. The two brick wall scenes get worse (0.0074 and 0.0035), more than 0.002. The camera sees only the wall's lit face, so the only shadow term it can change is the wall shadowing itself through the map's bias at a different light slope; this is inferred, not isolated, and the old off-sun eye may have been compensating for that bias. `fog` is 0.0016 worse, inside the limit.
diff --git a/bench/reference/baseline.json b/bench/reference/baseline.json
index 98933b26..5e1fd475 100644
--- a/bench/reference/baseline.json
+++ b/bench/reference/baseline.json
@@ -3,96 +3,92 @@
"blenderVersion": "5.2.2 LTS",
"seconds": {
"brick-flat": {
- "cycles": 3.9,
- "eevee": 0.9
+ "cycles": 10.8,
+ "eevee": 1.6
},
"brick-graph": {
- "cycles": 4.3,
- "eevee": 0.3
+ "cycles": 8.9,
+ "eevee": 0.4
},
"brick-room": {
- "cycles": 8.6,
- "eevee": 0.3
+ "cycles": 19.6,
+ "eevee": 0.6
},
"brushed-film": {
- "cycles": 4.3,
- "eevee": 0.3
+ "cycles": 9.9,
+ "eevee": 0.7
},
"car-paint": {
- "cycles": 4.2,
- "eevee": 0.3
+ "cycles": 14.3,
+ "eevee": 0.5
},
"character": {
- "cycles": 4.1,
- "eevee": 0.3
+ "cycles": 7.7,
+ "eevee": 0.4
},
"dark-shaft": {
- "cycles": 13.7,
- "eevee": 0.8
- },
- "fog-room": {
- "cycles": 14.5,
- "eevee": 0.9
- },
- "fog-valley": {
- "cycles": 12.4,
- "eevee": 0.8
+ "cycles": 129.3,
+ "eevee": 67.2
},
"fog": {
- "cycles": 14.5,
- "eevee": 0.9
+ "cycles": 58.3,
+ "eevee": 1.4
+ },
+ "fog-room": {
+ "cycles": 29.4,
+ "eevee": 2.7
},
"foliage": {
- "cycles": 5.0,
- "eevee": 0.4
+ "cycles": 4.4,
+ "eevee": 0.9
},
"glass": {
- "cycles": 4.9,
- "eevee": 0.3
+ "cycles": 18.9,
+ "eevee": 0.5
},
"light-linking": {
- "cycles": 2.9,
- "eevee": 0.3
+ "cycles": 6.9,
+ "eevee": 0.6
},
"lit-interior": {
- "cycles": 8.5,
- "eevee": 0.4
+ "cycles": 33.5,
+ "eevee": 0.6
},
"long-street": {
- "cycles": 3.7,
- "eevee": 0.3
+ "cycles": 10.1,
+ "eevee": 0.4
},
"material-spheres": {
- "cycles": 5.1,
- "eevee": 0.3
+ "cycles": 21.5,
+ "eevee": 0.4
},
"megacity-dusk": {
- "cycles": 9.3,
- "eevee": 0.7
- },
- "metal-room": {
- "cycles": 9.0,
- "eevee": 0.3
+ "cycles": 22.1,
+ "eevee": 1.5
},
"metal": {
- "cycles": 4.4,
- "eevee": 0.3
+ "cycles": 21,
+ "eevee": 1.8
+ },
+ "metal-room": {
+ "cycles": 164.9,
+ "eevee": 41.9
},
"mountain-valley": {
- "cycles": 15.5,
- "eevee": 11.3
+ "cycles": 13,
+ "eevee": 28.3
},
"outdoor-hdri": {
- "cycles": 3.7,
- "eevee": 0.3
+ "cycles": 12.3,
+ "eevee": 0.5
},
"spot-area": {
- "cycles": 3.4,
- "eevee": 0.3
+ "cycles": 8.7,
+ "eevee": 0.6
},
"temple-hall": {
- "cycles": 16.0,
- "eevee": 0.8
+ "cycles": 57.7,
+ "eevee": 1.1
}
},
"graphics": {
@@ -105,7 +101,7 @@
"gpu-vs-eevee": 0.0581,
"cpu-vs-cycles": 0.1344,
"cpu-vs-eevee": 0.0579,
- "eevee-vs-cycles": 0.1099,
+ "eevee-vs-cycles": 0.1098,
"gpu-vs-cpu": 0.0067
},
"brick-graph": {
@@ -128,8 +124,8 @@
"gpu-vs-cycles": 0.1029,
"gpu-vs-eevee": 0.0855,
"cpu-vs-cycles": 0.1026,
- "cpu-vs-eevee": 0.0855,
- "eevee-vs-cycles": 0.0985,
+ "cpu-vs-eevee": 0.0854,
+ "eevee-vs-cycles": 0.0984,
"gpu-vs-cpu": 0.0062
},
"car-paint": {
@@ -149,16 +145,16 @@
"gpu-vs-cpu": 0.0065
},
"dark-shaft": {
- "gpu-vs-cycles": 0.0558,
- "gpu-vs-eevee": 0.2644,
- "cpu-vs-cycles": 0.0559,
- "cpu-vs-eevee": 0.2642,
- "eevee-vs-cycles": 0.2654,
- "gpu-vs-cpu": 0.0031,
- "region-pixels": 0.0989,
- "region-gpu-vs-cycles": 0.1277,
- "region-gpu-vs-eevee": 0.2631,
- "region-eevee-vs-cycles": 0.2645
+ "gpu-vs-cycles": 0.0619,
+ "gpu-vs-eevee": 0.2808,
+ "cpu-vs-cycles": 0.0618,
+ "cpu-vs-eevee": 0.2807,
+ "eevee-vs-cycles": 0.2653,
+ "gpu-vs-cpu": 0.0024,
+ "region-pixels": 0.099,
+ "region-gpu-vs-cycles": 0.1858,
+ "region-gpu-vs-eevee": 0.2997,
+ "region-eevee-vs-cycles": 0.2643
},
"fog": {
"gpu-vs-cycles": 0.2256,
@@ -169,22 +165,22 @@
"gpu-vs-cpu": 0.0085
},
"fog-room": {
- "gpu-vs-cycles": 0.1036,
- "gpu-vs-eevee": 0.3635,
- "cpu-vs-cycles": 0.1036,
- "cpu-vs-eevee": 0.363,
+ "gpu-vs-cycles": 0.1049,
+ "gpu-vs-eevee": 0.3917,
+ "cpu-vs-cycles": 0.1047,
+ "cpu-vs-eevee": 0.3915,
"eevee-vs-cycles": 0.373,
- "gpu-vs-cpu": 0.0066,
- "region-pixels": 0.2428,
- "region-gpu-vs-cycles": 0.1617,
- "region-gpu-vs-eevee": 0.3269,
- "region-eevee-vs-cycles": 0.3147
+ "gpu-vs-cpu": 0.0043,
+ "region-pixels": 0.243,
+ "region-gpu-vs-cycles": 0.2405,
+ "region-gpu-vs-eevee": 0.3662,
+ "region-eevee-vs-cycles": 0.3146
},
"fog-valley": {
"gpu-vs-cycles": 0.1855,
- "gpu-vs-eevee": 0.1442,
+ "gpu-vs-eevee": 0.1443,
"cpu-vs-cycles": 0.1857,
- "cpu-vs-eevee": 0.1446,
+ "cpu-vs-eevee": 0.1447,
"eevee-vs-cycles": 0.1952,
"gpu-vs-cpu": 0.012
},
@@ -200,8 +196,8 @@
"gpu-vs-cycles": 0.1034,
"gpu-vs-eevee": 0.0996,
"cpu-vs-cycles": 0.1034,
- "cpu-vs-eevee": 0.0999,
- "eevee-vs-cycles": 0.1008,
+ "cpu-vs-eevee": 0.1,
+ "eevee-vs-cycles": 0.1009,
"gpu-vs-cpu": 0.0083
},
"light-linking": {
@@ -232,7 +228,7 @@
"gpu-vs-cycles": 0.1293,
"gpu-vs-eevee": 0.0756,
"cpu-vs-cycles": 0.1291,
- "cpu-vs-eevee": 0.0754,
+ "cpu-vs-eevee": 0.0753,
"eevee-vs-cycles": 0.1053,
"gpu-vs-cpu": 0.007
},
@@ -265,7 +261,7 @@
"gpu-vs-eevee": 0.2692,
"cpu-vs-cycles": 0.1765,
"cpu-vs-eevee": 0.2676,
- "eevee-vs-cycles": 0.1893,
+ "eevee-vs-cycles": 0.1879,
"gpu-vs-cpu": 0.0124
},
"outdoor-hdri": {
@@ -285,16 +281,16 @@
"gpu-vs-cpu": 0.0032
},
"temple-hall": {
- "gpu-vs-cycles": 0.0646,
- "gpu-vs-eevee": 0.2326,
- "cpu-vs-cycles": 0.0647,
- "cpu-vs-eevee": 0.2325,
+ "gpu-vs-cycles": 0.0659,
+ "gpu-vs-eevee": 0.2394,
+ "cpu-vs-cycles": 0.0659,
+ "cpu-vs-eevee": 0.2393,
"eevee-vs-cycles": 0.2341,
- "gpu-vs-cpu": 0.0021,
- "region-pixels": 0.0961,
- "region-gpu-vs-cycles": 0.2418,
- "region-gpu-vs-eevee": 0.2913,
- "region-eevee-vs-cycles": 0.2453
+ "gpu-vs-cpu": 0.0016,
+ "region-pixels": 0.0958,
+ "region-gpu-vs-cycles": 0.2805,
+ "region-gpu-vs-eevee": 0.3061,
+ "region-eevee-vs-cycles": 0.2455
}
}
}
diff --git a/bench/reference/images/brick-room.jpg b/bench/reference/images/brick-room.jpg
index b248c60b..46a0e848 100644
Binary files a/bench/reference/images/brick-room.jpg and b/bench/reference/images/brick-room.jpg differ
diff --git a/bench/reference/images/brushed-film.jpg b/bench/reference/images/brushed-film.jpg
index e80926c3..3dbdab84 100644
Binary files a/bench/reference/images/brushed-film.jpg and b/bench/reference/images/brushed-film.jpg differ
diff --git a/bench/reference/images/car-paint.jpg b/bench/reference/images/car-paint.jpg
index 8be8dbbb..45f76e61 100644
Binary files a/bench/reference/images/car-paint.jpg and b/bench/reference/images/car-paint.jpg differ
diff --git a/bench/reference/images/dark-shaft.jpg b/bench/reference/images/dark-shaft.jpg
index a6a65bc5..50e597ff 100644
Binary files a/bench/reference/images/dark-shaft.jpg and b/bench/reference/images/dark-shaft.jpg differ
diff --git a/bench/reference/images/fog-room.jpg b/bench/reference/images/fog-room.jpg
index 87b49981..aa00ff2b 100644
Binary files a/bench/reference/images/fog-room.jpg and b/bench/reference/images/fog-room.jpg differ
diff --git a/bench/reference/images/fog-valley.jpg b/bench/reference/images/fog-valley.jpg
index 9ec49adb..7bf7e5f1 100644
Binary files a/bench/reference/images/fog-valley.jpg and b/bench/reference/images/fog-valley.jpg differ
diff --git a/bench/reference/images/glass.jpg b/bench/reference/images/glass.jpg
index 5e4475ce..8b695191 100644
Binary files a/bench/reference/images/glass.jpg and b/bench/reference/images/glass.jpg differ
diff --git a/bench/reference/images/light-linking.jpg b/bench/reference/images/light-linking.jpg
index 8e6a7d86..caa72283 100644
Binary files a/bench/reference/images/light-linking.jpg and b/bench/reference/images/light-linking.jpg differ
diff --git a/bench/reference/images/lit-interior.jpg b/bench/reference/images/lit-interior.jpg
index 7bba6028..8b82b680 100644
Binary files a/bench/reference/images/lit-interior.jpg and b/bench/reference/images/lit-interior.jpg differ
diff --git a/bench/reference/images/material-spheres.jpg b/bench/reference/images/material-spheres.jpg
index 4de771a4..efc2f507 100644
Binary files a/bench/reference/images/material-spheres.jpg and b/bench/reference/images/material-spheres.jpg differ
diff --git a/bench/reference/images/megacity-dusk.jpg b/bench/reference/images/megacity-dusk.jpg
index c8fdd467..649ee1f8 100644
Binary files a/bench/reference/images/megacity-dusk.jpg and b/bench/reference/images/megacity-dusk.jpg differ
diff --git a/bench/reference/images/metal-room.jpg b/bench/reference/images/metal-room.jpg
index 8eed5114..7a659b32 100644
Binary files a/bench/reference/images/metal-room.jpg and b/bench/reference/images/metal-room.jpg differ
diff --git a/bench/reference/images/metal.jpg b/bench/reference/images/metal.jpg
index d0ab70a0..d75f90cf 100644
Binary files a/bench/reference/images/metal.jpg and b/bench/reference/images/metal.jpg differ
diff --git a/bench/reference/images/spot-area.jpg b/bench/reference/images/spot-area.jpg
index b57442bd..3e491803 100644
Binary files a/bench/reference/images/spot-area.jpg and b/bench/reference/images/spot-area.jpg differ
diff --git a/bench/reference/images/temple-hall.jpg b/bench/reference/images/temple-hall.jpg
index 14e7c6b4..7ddeee85 100644
Binary files a/bench/reference/images/temple-hall.jpg and b/bench/reference/images/temple-hall.jpg differ