Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Make object probes opt in for the reference suite and restore the committed baseline (part of issue #167)

Nguyen Xuan An7ea2abe77dd6
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0bec4d2d..33fca1d5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,7 +2,7 @@
## Unreleased
-- Show the floor and the other parts in smooth metal (part of issue #167, which stays open). `traceObjectProbes` in `src/probe-trace.js` gives each part with `metallic` of at least 0.5 and `roughness` of at most 0.6 a reflection probe of its own, traced from the middle of the part without it (up to 8 parts, lit by direct light and the environment's diffuse light), and `placeProbes` assigns it. `metal` scores 0.1294 to 0.1036 against Cycles (EEVEE 0.0916), `brushed-film` 0.1149 to 0.1029, `car-paint` 0.1059 to 0.1038, `material-spheres` 0.1312 to 0.1293; every scene without a reflective part is unchanged to four digits and draws the same frame (`metal` 1.51 ms plain, 1.58 ms with four probes). `npm run reference` places them by default; recipes do not yet.
+- Show the floor and the other parts in smooth metal (part of issue #167, which stays open). `traceObjectProbes` in `src/probe-trace.js` gives each part with `metallic` of at least 0.5 and `roughness` of at most 0.6 a reflection probe of its own, traced from the middle of the part without it (up to 8 parts, lit by direct light and the environment's diffuse light), and `placeProbes` assigns it. `metal` scores 0.1294 to 0.1036 against Cycles (EEVEE 0.0916), `brushed-film` 0.1149 to 0.1029, `car-paint` 0.1059 to 0.1038, `material-spheres` 0.1312 to 0.1293; every scene without a reflective part is unchanged to four digits and draws the same frame (`metal` 1.51 ms plain, 1.58 ms with four probes). `npm run reference -- --object-probes` places them (opt in; the committed baseline is unchanged); recipes do not yet.
- Remove the AGPL-3.0 `@codepawlhq/orglet-ui` package, React and react-dom from the website (issue #176). The site now uses its own tokens and button in `src/site-tokens.css` and `src/site-controls.js`, and screenshots of the pages match before and after. The site JavaScript drops from 1,778,425 to 1,531,367 bytes. The published package was never affected.
- A renderer no longer draws its shadow map a second time on the first frame when the frame has no assembly; the constructor already drew it. On `mountain-valley` that removes 9.72 million shadow triangles from the first frame, with identical pictures (issue #171). `node bench/reference/profile-scene.mjs <scene>` prints where a scene's time goes, and `frame-time.mjs --plain` measures scenes that are too large for the light bake.
diff --git a/bench/reference/README.md b/bench/reference/README.md
index 3757db69..2a5c028a 100644
--- a/bench/reference/README.md
+++ b/bench/reference/README.md
@@ -212,9 +212,9 @@ A probe at the middle of the object and traced without it is the only option the
`traceObjectProbes(parts, lighting, options)` in `src/probe-trace.js` finds the parts with `metallic` of at least 0.5 and `roughness` of at most 0.6, traces one 128 by 64 map at the middle of each one's bounds with that part left out, and returns the same shape as `traceProbes` plus the index of the part. `placeProbes` gives each such part its own probe. More than 8 reflective parts (lamp posts, spires) get none, because they read as shapes and not as mirrors. A trace shades a hit with the direct light, the part's colour (half the colour for metal) and the environment map's diffuse light. A ray that misses reads the environment map.
-`npm run reference` places these probes by default on every scene that has no bake and no `--probes` flag; `--no-object-probes` draws the old sky-only reflections, and `--object-probes` with `--probes` names the scenes. There is no recipe field: a recipe scene does not place object probes yet, because the recipe path has no map of the sky to light the floor in the reflection (the procedural sky is a colour gradient), and that is the next piece of work.
+`npm run reference -- --object-probes [<id>,<id>]` places these probes on the named scenes (every scene when no ids follow). It is opt in, like `--bake` and `--probes`, and the committed `baseline.json` and `images/` are the default run without it (`metal` 0.1294 again, confirmed on 2026-11-02). The scores below are from a full run with the flag. There is no recipe field: a recipe scene does not place object probes yet, because the recipe path has no map of the sky to light the floor in the reflection (the procedural sky is a colour gradient), and that is the next piece of work.
-### Scores against Cycles (GPU, full rescore, 2026-11-02)
+### Scores against Cycles with `--object-probes` (GPU, full rescore, 2026-11-02)
| Scene | Before | After | EEVEE |
| --- | --- | --- | --- |
diff --git a/bench/reference/baseline.json b/bench/reference/baseline.json
index ccedf9a0..8b3ee0e5 100644
--- a/bench/reference/baseline.json
+++ b/bench/reference/baseline.json
@@ -117,18 +117,18 @@
"gpu-vs-cpu": 0.0071
},
"brushed-film": {
- "gpu-vs-cycles": 0.1029,
- "gpu-vs-eevee": 0.0855,
- "cpu-vs-cycles": 0.1026,
- "cpu-vs-eevee": 0.0854,
+ "gpu-vs-cycles": 0.1149,
+ "gpu-vs-eevee": 0.1004,
+ "cpu-vs-cycles": 0.1146,
+ "cpu-vs-eevee": 0.1004,
"eevee-vs-cycles": 0.0984,
- "gpu-vs-cpu": 0.0062
+ "gpu-vs-cpu": 0.0061
},
"car-paint": {
- "gpu-vs-cycles": 0.1038,
- "gpu-vs-eevee": 0.065,
- "cpu-vs-cycles": 0.1035,
- "cpu-vs-eevee": 0.065,
+ "gpu-vs-cycles": 0.1059,
+ "gpu-vs-eevee": 0.0679,
+ "cpu-vs-cycles": 0.1056,
+ "cpu-vs-eevee": 0.0679,
"eevee-vs-cycles": 0.0844,
"gpu-vs-cpu": 0.0059
},
@@ -201,10 +201,10 @@
"gpu-vs-cpu": 0.0095
},
"material-spheres": {
- "gpu-vs-cycles": 0.1293,
- "gpu-vs-eevee": 0.0756,
- "cpu-vs-cycles": 0.1291,
- "cpu-vs-eevee": 0.0753,
+ "gpu-vs-cycles": 0.1312,
+ "gpu-vs-eevee": 0.0748,
+ "cpu-vs-cycles": 0.131,
+ "cpu-vs-eevee": 0.0745,
"eevee-vs-cycles": 0.1053,
"gpu-vs-cpu": 0.007
},
@@ -217,20 +217,20 @@
"gpu-vs-cpu": 0.0281
},
"metal": {
- "gpu-vs-cycles": 0.1036,
- "gpu-vs-eevee": 0.0782,
- "cpu-vs-cycles": 0.1033,
- "cpu-vs-eevee": 0.0783,
+ "gpu-vs-cycles": 0.1294,
+ "gpu-vs-eevee": 0.0952,
+ "cpu-vs-cycles": 0.1291,
+ "cpu-vs-eevee": 0.0953,
"eevee-vs-cycles": 0.0916,
- "gpu-vs-cpu": 0.0064
+ "gpu-vs-cpu": 0.0067
},
"metal-room": {
- "gpu-vs-cycles": 0.5076,
- "gpu-vs-eevee": 0.1082,
- "cpu-vs-cycles": 0.5072,
- "cpu-vs-eevee": 0.1088,
+ "gpu-vs-cycles": 0.5128,
+ "gpu-vs-eevee": 0.108,
+ "cpu-vs-cycles": 0.5124,
+ "cpu-vs-eevee": 0.1086,
"eevee-vs-cycles": 0.5262,
- "gpu-vs-cpu": 0.0062
+ "gpu-vs-cpu": 0.0061
},
"mountain-valley": {
"gpu-vs-cycles": 0.3473,
diff --git a/bench/reference/images/brushed-film.jpg b/bench/reference/images/brushed-film.jpg
index 3dbdab84..1d518448 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 45f76e61..ccf683a4 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/material-spheres.jpg b/bench/reference/images/material-spheres.jpg
index c4a158d7..58400c5f 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/metal-room.jpg b/bench/reference/images/metal-room.jpg
index 7a659b32..06a8d1fc 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 d75f90cf..c5770a51 100644
Binary files a/bench/reference/images/metal.jpg and b/bench/reference/images/metal.jpg differ
diff --git a/bench/reference/run.mjs b/bench/reference/run.mjs
index 02bbdac9..11e72922 100644
--- a/bench/reference/run.mjs
+++ b/bench/reference/run.mjs
@@ -53,8 +53,10 @@ const skyOnlyOptions = skyOnlyFlag >= 0 ? { skyOnly: true, texelsPerUnit: skyTex
const probesFlag =argumentsGiven.indexOf('--probes');
const probesValue = probesFlag >= 0 ? argumentsGiven[probesFlag + 1] : undefined;
const probedSceneIds = probesFlag >= 0 && probesValue && !probesValue.startsWith('--') ? probesValue.split(',') : null;
-// --object-probes turns the --probes scenes into one probe per reflective part (traceObjectProbes) instead of a hand placed one.
-const objectProbes = argumentsGiven.includes('--object-probes');
+// --object-probes [<id>,<id>] gives each reflective part of the named scenes (every scene when no ids follow) a probe of its own (traceObjectProbes).
+const objectProbesFlag = argumentsGiven.indexOf('--object-probes');
+const objectProbesValue = objectProbesFlag >= 0 ? argumentsGiven[objectProbesFlag + 1] : undefined;
+const objectProbeSceneIds = objectProbesFlag >= 0 && objectProbesValue && !objectProbesValue.startsWith('--') ? objectProbesValue.split(',') : null;
const cascadesFlag = argumentsGiven.indexOf('--cascades');
const cascades = cascadesFlag >= 0 ? Number(argumentsGiven[cascadesFlag + 1]) : 0;
const ambientFlag = argumentsGiven.indexOf('--ambient');
@@ -87,10 +89,9 @@ async function renderBackend(backend, serverUrl, graphics) {
const describe = backend === 'gpu';
const probesThisScene = probesFlag >= 0 && (probedSceneIds === null || probedSceneIds.includes(id));
const bakesThisScene = bakeFlag >= 0 && (bakedSceneIds === null || bakedSceneIds.includes(id));
- // A scene with no probe of its own and no bake gets one probe per reflective part, the way an engine would place them
- // automatically. --no-object-probes draws the sky-only reflections instead.
- const automaticProbes = !probesThisScene && !bakesThisScene && !argumentsGiven.includes('--no-object-probes');
- const probes = probesThisScene ? (objectProbes ? 'objects' : true) : automaticProbes ? 'objects' : false;
+ // Object probes are opt in: a recipe does not place them yet, so the baseline scores what a user gets by default.
+ const objectProbesThisScene = objectProbesFlag >= 0 && (objectProbeSceneIds === null || objectProbeSceneIds.includes(id));
+ const probes = objectProbesThisScene ? 'objects' : probesThisScene;
const bake = bakesThisScene ? { ...skyOnlyOptions } : null;
const result = await page.evaluate(([sceneId, shouldDescribe, ambientOcclusion, ambientOcclusionRadius, bakeOptions, cascadeCount, withProbes, ambientScale]) => window.renderReferenceScene(sceneId, { describe: shouldDescribe, ambientOcclusion, ambientOcclusionRadius, bake: bakeOptions, cascades: cascadeCount, probes: withProbes, ambient: ambientScale }), [id, describe, ambientOcclusion, ambientOcclusionRadius, bake, cascades, probes, ambient]);
if (result.glError !== 0) throw new Error(`${id} on ${backend} gave WebGL error ${result.glError}.`);