Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Make the room probe the default with a bake, keep the probe report, and fix the frame-time and reference notes (Part of #55)

Nguyen Xuan An322e1982041d
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 265fd337..6da2c34c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,7 +2,7 @@
## Unreleased
-- Add reflection probes and a `metal-room` reference scene (part of issue #55, which stays open). `bake.probes` ('room' or up to 4 `{ position, radius? }`) traces the room around a point once, prefilters it through `createEnvironmentResources` and lets nearby parts reflect it (specular only, no parallax, not in GLB). Off by default: without a bake the rooms score 0.02 to 0.06 better against Cycles, but with a bake the picture did not change and open scenes score worse. Core growth is 48 bytes gzip (`lit-box`). `npm run reference -- --probes` and `frame-time.mjs` take the new variant.
+- Add reflection probes and a `metal-room` reference scene (part of issue #55, which stays open). `bake.probes` ('room' or up to 4 `{ position, radius? }`) traces the room around a point once, prefilters it through `createEnvironmentResources` and lets nearby parts reflect it (specular only, no parallax, not in GLB). A recipe with `bake` places a `'room'` probe unless `bake.probes` is `false`: against Cycles a probe lowered the score in every baked room (`lit-interior` 0.1444 to 0.1213, `brick-room` 0.1515 to 0.1266, `metal-room` 0.1754 to 0.1537) and in the unbaked rooms (0.02 to 0.06), while a hand placed probe in an open scene scores worse. The bake report now keeps the placed probes under `probes` (the resolved setting used to hide it). The reference harness `--scene` option says it does not rescore, and `frame-time.mjs` prints medians of three rounds. The earlier note that a probe changed nothing on a baked room was wrong. Core growth is 48 bytes gzip (`lit-box`). `npm run reference -- --probes` and `frame-time.mjs` take the new variant.
- Add the `weighted_normal` and `smooth_by_angle` modifiers as edits and stack nodes (part of issue #42). `smooth_by_angle` marks edges over an angle sharp and the rest smooth, overriding the geometry `smoothAngle`; `weighted_normal` stores an area-weighted normal per corner that the render extraction uses as is. The edge attribute `smooth` is new.
- Add the `lattice`, `curve`, `hook` and `wave` modifiers as edits and stack nodes (part of issue #42). `lattice` moves up to 64 control points of a grid over the mesh bounds, `curve` bends a mesh along a Catmull-Rom path, `hook` pulls the vertices near a point and `wave` is a travelling ripple that matches Blender 5.2 at the same frame on two cases. Lists are bounded and the errors name the limit.
diff --git a/bench/reference/README.md b/bench/reference/README.md
index 095db445..8f22d3f5 100644
--- a/bench/reference/README.md
+++ b/bench/reference/README.md
@@ -40,7 +40,7 @@ Light bake (issue #55): `npm run reference -- --bake lit-interior` bakes bounced
`brushed-film` (issue #51) holds a brushed gold sphere (`anisotropy` 0.8), a dark sphere with a thin film (`iridescence`, IOR 1.3, 400 nm) and a silver sphere with the same film. `render-blender.py` maps the glTF anisotropy model onto Blender's aspect ratio (alpha along the tangent is `mix(alpha, 1, strength^2)`, so Blender gets Anisotropic = (1 - alpha / alpha_tangent) / 0.9 and the geometric-mean roughness) and feeds a UV-map Tangent node, because Blender's default tangent is a different field: with the default tangent the first run scored 0.1673 against Cycles and the highlight ran in rings where 67js had bands; with the UV tangent it scores 0.1613 and the highlight direction matches. Thin film goes to Principled Thin Film Thickness and IOR. EEVEE draws no thin film, so its sphere stays black. The two models are not the same: Blender's film is its own Fresnel integration, 67js uses Belcour and Barla at the view angle, so match the colours by eye in the image, not by the score alone. Measured 2026-11-01 on the RTX 3060 and SwiftShader. Before and after adding anisotropy and iridescence, every older scene scored the same against Cycles and EEVEE to four digits (largest change 0.0000, limit 0.002), because their shaders compile the two layers out.
-`metal-room` (issue #55) is the `lit-interior` room with a mirror sphere, a gold sphere and a glossy floor, to show what reflection probes do: 0.5128 against Cycles without a probe and 0.4520 with one (`npm run reference -- --skip-blender --probes metal-room`; with `--bake` the score is 0.1754 either way). `--probes [ids]` adds probes to the named scenes; open scenes use a hand placed probe from `PROBE_SPECIFICATIONS` in `harness.js`, and score worse (`metal` 0.1868 to 0.2246, `material-spheres` 0.1598 to 0.1740). Every scene without a probe re-scored within 0.0001 of its earlier baseline.
+`metal-room` (issue #55) is the `lit-interior` room with a mirror sphere, a gold sphere and a glossy floor, to show what reflection probes do: 0.5128 against Cycles without a probe and 0.4520 with one (`npm run reference -- --skip-blender --probes metal-room`; with `--bake` the score is 0.1754 without a probe and 0.1537 with one). `--probes [ids]` adds probes to the named scenes; open scenes use a hand placed probe from `PROBE_SPECIFICATIONS` in `harness.js`, and score worse (`metal` 0.1868 to 0.2246, `material-spheres` 0.1598 to 0.1740). Every scene without a probe re-scored within 0.0001 of its earlier baseline (a full rerun on 2026-11-01 matched the committed `baseline.json` exactly). With `--bake`, adding `--probes` lowers the score in the three rooms: `lit-interior` 0.1444 to 0.1213, `brick-room` 0.1515 to 0.1266, `metal-room` 0.1754 to 0.1537. `--scene` renders one scene and does not rescore. `node bench/reference/frame-time.mjs lit-interior gpu` prints medians of three rounds: 1.73 ms plain, 1.90 ms baked, 2.04 ms baked with a probe (RTX 3060, 2026-11-01), against 106.7 s for the path tracer in `path-tracer.json`.
The mean against Cycles is 0.198 for 67js and 0.160 for EEVEE. The mean difference between the RTX 3060 and SwiftShader is 0.007.
diff --git a/bench/reference/frame-time.mjs b/bench/reference/frame-time.mjs
index 20a15a1a..ef913c59 100644
--- a/bench/reference/frame-time.mjs
+++ b/bench/reference/frame-time.mjs
@@ -26,11 +26,18 @@ try {
// cascades, each with a still camera and with a camera that moves every frame.
const variants = process.argv.includes('--cascades')
? [0, 3, 0, 3].flatMap(cascades => [false, true].map(orbit => ({ bake: false, cascades, orbit })))
- : [[false, false], [true, false], [true, true], [false, true], [false, false], [true, false], [true, true], [false, true]].map(([bake, probes]) => ({ bake, probes }));
+ : [1, 2, 3].flatMap(round => (round % 2 ? [[false, false], [true, false], [true, true], [false, true]] : [[false, true], [true, true], [true, false], [false, false]]).map(([bake, probes]) => ({ bake, probes })));
for (const variant of variants) {
results.push({ ...variant, ...(await page.evaluate(([id, options]) => window.measureReferenceFrameTime(id, options), [sceneId, variant])) });
}
- console.log(JSON.stringify({ sceneId, backend, results }, null, 1));
+ const medianOf = values => values.sort((first, second) => first - second)[Math.floor(values.length / 2)];
+ const summary = {};
+ for (const result of results) {
+ const key = result.baked ? (result.probes ? 'bake+probes' : 'bake') : (result.probes ? 'probes' : 'plain');
+ (summary[key] ??= []).push(result.medianMilliseconds);
+ }
+ const medianByVariant = Object.fromEntries(Object.entries(summary).map(([key, values]) => [key, Number(medianOf(values).toFixed(3))]));
+ console.log(JSON.stringify({ sceneId, backend, medianMillisecondsByVariant: medianByVariant, results }, null, 1));
} finally {
await browser.close();
await server.close();
diff --git a/bench/reference/run.mjs b/bench/reference/run.mjs
index fc1afdab..295645f0 100644
--- a/bench/reference/run.mjs
+++ b/bench/reference/run.mjs
@@ -159,3 +159,7 @@ if (!onlyScene || pathTracerFlag) {
'python', '-I', 'bench/reference/score.py', WORK_DIRECTORY, OUTPUT_DIRECTORY, ...(pathTracerFlag ? ['--path-tracer'] : []), ...(sceneSet ? [`--${sceneSet}`] : []),
]);
}
+else {
+ // Scoring reads every scene in the work directory, so a run of one scene would mix new and old renders; it leaves the scores as they were.
+ console.log('--scene renders one scene and does not score it. Run without --scene to rescore; the numbers in baseline.json are unchanged.');
+}
diff --git a/bench/size/budgets.json b/bench/size/budgets.json
index 96432618..40b6ede3 100644
--- a/bench/size/budgets.json
+++ b/bench/size/budgets.json
@@ -11,8 +11,8 @@
"entry:nature": 13200,
"entry:motion": 13600,
"entry:canvas2d": 9400,
- "entry:gltf": 49600,
- "entry:gltf+lazy": 52900,
+ "entry:gltf": 52800,
+ "entry:gltf+lazy": 56150,
"entry:modeling": 8700,
"entry:sculpt": 2500,
"entry:surface": 10100,
@@ -33,20 +33,20 @@
"entry:light-bake": 27300,
"entry:path-tracer": 14400,
"entry:texture-set": 900,
- "entry:agent-scene": 68600,
- "entry:agent-scene+lazy": 243950,
- "entry:agent-asset": 100600,
- "entry:agent-asset+lazy": 255550,
+ "entry:agent-scene": 72300,
+ "entry:agent-scene+lazy": 249500,
+ "entry:agent-asset": 103850,
+ "entry:agent-asset+lazy": 260900,
"entry:hdri": 3300,
"entry:camera-effects": 8600,
"entry:render-passes": 1700,
- "entry:material-layer-shaders": 20100,
- "entry:light-linking": 18500,
+ "entry:material-layer-shaders": 20300,
+ "entry:light-linking": 18650,
"entry:cascaded-shadows": 27300,
"scene:lit-box": 61400,
"scene:gltf-box": 82500,
"scene:gltf-box+lazy": 85700,
- "scene:agent-scene": 99900,
- "scene:agent-scene+lazy": 274800
+ "scene:agent-scene": 100600,
+ "scene:agent-scene+lazy": 278300
}
}
diff --git a/bench/tool-cost-budgets.json b/bench/tool-cost-budgets.json
index c98c46c0..28a84e08 100644
--- a/bench/tool-cost-budgets.json
+++ b/bench/tool-cost-budgets.json
@@ -1,5 +1,5 @@
{
- "measured": "2026-10-31, from scripts/measure-tool-cost.mjs; raised by 800 total and 150 for scene_apply for branch and labels fields (no new tool); raised by 650 total and 80 for scene_apply for clip layers, bone masks and retargeting through MCP; raised by 20 for scene_create and 20 for the scene_capabilities result after merging the expression language with the material graph; was 373388 schema bytes before shared IDs and recipe references; trimmed after the render-passes merge: material graph, depth of field, motion blur and passes details moved to scene_capabilities, budgets set to the measured value plus 0.5% (total 188267, scene_capabilities result 5167); raised by 95 for scene_apply and 690 for the scene_capabilities result for node relations; curve and text geometry entries shortened to a pointer at scene_capabilities curveText, budgets set to the measured value plus 0.5% (total 189468, scene_capabilities result 6399); then six modifier ops (weld, triangulate, edge_split, smooth, simple_deform, cast) added as one compact schema entry with details in scene_capabilities meshModifiers, entry and mesh_stack description shortened: total 190382 (budget unchanged at 190420), mesh_edit 34216 (budget 34220), scene_capabilities result 7042 (budget 7050); mesh_stack 11682 (budget 11690); after merging imported mesh topology with the modifier ops: raised the total to 190480 (measured 190471), mesh_edit to 34300 (measured 34293) and the scene_capabilities result to 7520 (measured 7512) for imported mesh edits; then cloth (recipe cloth, set-cloth, grid geometry) added with the total unchanged at 190480 (measured 189159): physics descriptions shortened and set-physics now takes the same record reference as set-motion, scene_create raised to 62150 and scene_apply lowered to 44130, scene_capabilities result raised to 8190 (measured 8176) for the cloth details; then particles and hair (recipe `particles`, set-particles) added with the total unchanged at 190480 (measured 189642, scene_create raised to 62350 and scene_apply to 44370 for the recipe particles reference and set-particles): the section is one record reference described in scene_capabilities, so the scene_capabilities result rose to 9570 (measured 9523) for the particle and hair fields; after merging the film timeline (recipe timeline, set-timeline) with particles: total 190719 (budget 190730), scene_create 62464, scene_apply 44620, scene_capabilities result 9902; then the path tracer renderer setting (drop z.int bounds, integers still checked by the job validator): total raised to 190830 (measured 190818); after merging the render limits and light bake with the path tracer: measured total 190013, scene_create raised to 62680 (measured 62667), scene_apply to 44860 (measured 44852) and the scene_capabilities result to 10620 (measured 10613) for the bake section and job size limits; then material layers anisotropy and iridescence (issue #51): the 16 layer fields take one short line each in the schema and their ranges and notes moved to scene_capabilities scene.materialLayers, so the scene_capabilities result rose to 12230 (measured 12168); then the worker bake limit added workerMaxSeconds to the bake limits (result 13361, budget raised to 13370); then the sculpt and shrinkwrap mesh edits (issue #47) with the total unchanged at 190830 (measured 190612): the face rule and tag prefix descriptions shortened (the face rule text repeats in every select field), so mesh_edit rose to 33980 (measured 33960) and mesh_stack fell to 11030 (measured 11014), and the scene_capabilities result rose to 13350 (measured 13338) for the meshSculpt notes; then recipe light links and shadow cascades (issue #52): environment fields added to the shared environment schema with the total unchanged at 190830 (measured 190507) by shortening its descriptions, and the scene_capabilities result raised to 13870 (measured 13865) for lightLinking and shadowCascades; then the nine remaining modifiers (issue #42: screw, skin, wireframe, lattice, curve, hook, wave, weighted_normal, smooth_by_angle) added their notes to meshModifiers and a free modifier record replaced the modifier schema entry, so the schemas shrank and the scene_capabilities result rose to 15900 (measured 15814); path query of scene_inspect (issue #64): one record field of 205 bytes in the scene_inspect schema (total 190732, within its budget) and the navigation notes in scene_capabilities, so the result rose to 14500 (measured 14494)",
+ "measured": "2026-10-31, from scripts/measure-tool-cost.mjs; raised by 800 total and 150 for scene_apply for branch and labels fields (no new tool); raised by 650 total and 80 for scene_apply for clip layers, bone masks and retargeting through MCP; raised by 20 for scene_create and 20 for the scene_capabilities result after merging the expression language with the material graph; was 373388 schema bytes before shared IDs and recipe references; trimmed after the render-passes merge: material graph, depth of field, motion blur and passes details moved to scene_capabilities, budgets set to the measured value plus 0.5% (total 188267, scene_capabilities result 5167); raised by 95 for scene_apply and 690 for the scene_capabilities result for node relations; curve and text geometry entries shortened to a pointer at scene_capabilities curveText, budgets set to the measured value plus 0.5% (total 189468, scene_capabilities result 6399); then six modifier ops (weld, triangulate, edge_split, smooth, simple_deform, cast) added as one compact schema entry with details in scene_capabilities meshModifiers, entry and mesh_stack description shortened: total 190382 (budget unchanged at 190420), mesh_edit 34216 (budget 34220), scene_capabilities result 7042 (budget 7050); mesh_stack 11682 (budget 11690); after merging imported mesh topology with the modifier ops: raised the total to 190480 (measured 190471), mesh_edit to 34300 (measured 34293) and the scene_capabilities result to 7520 (measured 7512) for imported mesh edits; then cloth (recipe cloth, set-cloth, grid geometry) added with the total unchanged at 190480 (measured 189159): physics descriptions shortened and set-physics now takes the same record reference as set-motion, scene_create raised to 62150 and scene_apply lowered to 44130, scene_capabilities result raised to 8190 (measured 8176) for the cloth details; then particles and hair (recipe `particles`, set-particles) added with the total unchanged at 190480 (measured 189642, scene_create raised to 62350 and scene_apply to 44370 for the recipe particles reference and set-particles): the section is one record reference described in scene_capabilities, so the scene_capabilities result rose to 9570 (measured 9523) for the particle and hair fields; after merging the film timeline (recipe timeline, set-timeline) with particles: total 190719 (budget 190730), scene_create 62464, scene_apply 44620, scene_capabilities result 9902; then the path tracer renderer setting (drop z.int bounds, integers still checked by the job validator): total raised to 190830 (measured 190818); after merging the render limits and light bake with the path tracer: measured total 190013, scene_create raised to 62680 (measured 62667), scene_apply to 44860 (measured 44852) and the scene_capabilities result to 10620 (measured 10613) for the bake section and job size limits; then material layers anisotropy and iridescence (issue #51): the 16 layer fields take one short line each in the schema and their ranges and notes moved to scene_capabilities scene.materialLayers, so the scene_capabilities result rose to 12230 (measured 12168); then the worker bake limit added workerMaxSeconds to the bake limits (result 13361, budget raised to 13370); then the sculpt and shrinkwrap mesh edits (issue #47) with the total unchanged at 190830 (measured 190612): the face rule and tag prefix descriptions shortened (the face rule text repeats in every select field), so mesh_edit rose to 33980 (measured 33960) and mesh_stack fell to 11030 (measured 11014), and the scene_capabilities result rose to 13350 (measured 13338) for the meshSculpt notes; then recipe light links and shadow cascades (issue #52): environment fields added to the shared environment schema with the total unchanged at 190830 (measured 190507) by shortening its descriptions, and the scene_capabilities result raised to 13870 (measured 13865) for lightLinking and shadowCascades; then the nine remaining modifiers (issue #42: screw, skin, wireframe, lattice, curve, hook, wave, weighted_normal, smooth_by_angle) added their notes to meshModifiers and a free modifier record replaced the modifier schema entry, so the schemas shrank and the scene_capabilities result rose to 15900 (measured 15814); path query of scene_inspect (issue #64): one record field of 205 bytes in the scene_inspect schema (total 190732, within its budget) and the navigation notes in scene_capabilities, so the result rose to 14500 (measured 14494); reflection probes (issue #55): the bake.probes line, and the scene_capabilities result raised to 16600 (measured 16541) after merging with main",
"schemaTotalBytes": 190830,
"schemaToolBytes": {
"scene_create": 62930,
@@ -10,7 +10,7 @@
},
"schemaOtherToolBytes": 4000,
"resultBytes": {
- "scene_capabilities": 16700,
+ "scene_capabilities": 16600,
"scene_create": 1400,
"scene_inspect": 1400,
"mesh_inspect": 1200,
diff --git a/docs/light-bake.md b/docs/light-bake.md
index 4b2a66e1..aa67a307 100644
--- a/docs/light-bake.md
+++ b/docs/light-bake.md
@@ -66,11 +66,13 @@ import { applyReflectionProbes } from '67js/addons/reflection-probes';
const { parts: probedParts } = applyReflectionProbes(parts, lighting, [{ position: [0, 1.5, 0], radius: 6 }], { environment, environmentMap: environment.map, rotation: environment.map.rotation });
```
-In a recipe, `bake.probes` is `'room'` (one probe in the middle of the parts' bounds, kept only when at least 90 percent of its rays hit a part, so an open scene gets none) or a list of up to 4 `{ position, radius? }`; absent or `false` means none. It is off by default because the measurement below does not show it helping a baked room. The report has `bake.probes` (placed probes, `partsWithProbe`, `skipped`, `glb`). A probe is not written to GLB: glTF has no standard for it.
+In a recipe, `bake.probes` is `'room'` (one probe in the middle of the parts' bounds, kept only when at least 90 percent of its rays hit a part, so an open scene gets none) or a list of up to 4 `{ position, radius? }`; a recipe with `bake` gets `'room'` unless `probes` is set, and `false` opts out. A bake brings the probe along because it lowered the score of all three baked rooms below. The report has `bake.probes` (placed probes, `partsWithProbe`, `skipped`, `glb`). A probe is not written to GLB: glTF has no standard for it.
Cost: a scene without a probe loads none of this and its fragment shader is unchanged (the renderer links through the material field `environmentProbe`, which batches parts by probe, and one shader slot that only a probe scene fills). With a probe the prefilter runs once when the first batch that uses it draws, and nothing after.
-Measured against Cycles (FLIP, GPU; `npm run reference -- --skip-blender --probes ...`, 2026-11-01): `lit-interior` 0.5055 to 0.4791, `brick-room` 0.5102 to 0.4828, `metal-room` 0.5128 to 0.4520. Open scenes get worse with a hand placed probe: `material-spheres` 0.1598 to 0.1740, `metal` 0.1868 to 0.2246 (the probe sits among the objects and each sphere reflects itself where it should reflect the others). With the bake on, the picture was byte identical with and without probes in all three rooms (0.1444, 0.1515, 0.1754): the reason is not found, so the combination is unproven.
+Measured against Cycles (FLIP, GPU; `npm run reference -- --skip-blender --probes ...`, 2026-11-01): `lit-interior` 0.5055 to 0.4791, `brick-room` 0.5102 to 0.4828, `metal-room` 0.5128 to 0.4520. Open scenes get worse with a hand placed probe: `material-spheres` 0.1598 to 0.1740, `metal` 0.1868 to 0.2246 (the probe sits among the objects and each sphere reflects itself where it should reflect the others). With the bake on, the probe lowers the score in all three rooms (measured 2026-11-01, `--bake` against `--bake --probes`, GPU): `lit-interior` 0.1444 to 0.1213, `brick-room` 0.1515 to 0.1266, `metal-room` 0.1754 to 0.1537. An earlier note here said the picture was byte identical with and without a probe on a baked room. It was not: rendered side by side in one page, `metal-room` with a bake differs in 507,573 of 518,400 pixels (largest channel step 199) between the two, and the saved PNGs differ. The earlier report is not reproduced, and its cause was not found (a `--scene` run of `npm run reference` does not rescore, so an old score can be read as a new one).
+
+Cost per frame (RTX 3060, `lit-interior`, medians of three alternating rounds of 200 frames, 960 by 540, 2026-11-01): 1.73 ms plain, 1.90 ms with the bake, 2.04 ms with bake and probe, 1.65 ms with a probe alone. The bake and the probe cost a little per frame (the spread between rounds of the same variant was 0.2 ms), so they do not make a frame faster. What the bake replaces is the path tracer for indirect light: 106.7 s for `lit-interior` at 64 samples on the CPU, or 238 s at 32 samples in the first measurement, against about 6 s of bake once.
## Limits
diff --git a/docs/parity.md b/docs/parity.md
index 2a28c488..62e6a600 100644
--- a/docs/parity.md
+++ b/docs/parity.md
@@ -186,7 +186,7 @@ To move to a new Blender release, run `node scripts/parity-manual-snapshot.mjs`.
| Physics > Collision | partial | Rapier collisions with sensors (enter and leave events) and 16 collision layers with masks, in code and recipes. `scene_inspect` reports contacts and resting state. | [physics-colliders](../tests/physics-colliders.test.js) | #61 |
| Physics > Baking Physics Simulations | partial | Physics records to a timeline in code or when a recipe scene is created, on the main thread. | [film-physics](../tests/film-physics.test.js) | #61 |
| Physics > Simulation Nodes | missing | No node graph. | | #43 |
-| Rendering > Render Engines > EEVEE | partial | A WebGL2 rasterizer with PBR, one directional shadow, 8 point lights, fog and bloom. Reflection probes exist behind `bake.probes` (specular only, no parallax; [light-bake](light-bake.md)); no irradiance or box probes. | [renderer](../tests/renderer.test.js), [scores against EEVEE](../bench/reference/baseline.json) | #52, #53, #55, #56 |
+| Rendering > Render Engines > EEVEE | partial | A WebGL2 rasterizer with PBR, one directional shadow, 8 point lights, fog and bloom. Reflection probes exist behind `bake.probes` (on by default with a bake; specular only, no parallax; [light-bake](light-bake.md)); no irradiance or box probes. | [renderer](../tests/renderer.test.js), [scores against EEVEE](../bench/reference/baseline.json) | #52, #53, #55, #56 |
| Rendering > Render Engines > Cycles | partial | A CPU path tracer (`addons/path-tracer`, or `settings.renderer` on an image render job; [path-tracer](path-tracer.md)) draws diffuse, GGX metal, clear coat, glass, maps, cutouts, the sun, point, spot and area lights with soft shadows and the environment map, with a denoiser. At 32 samples its FLIP score against Cycles is better than the rasterizer's on 7 of the 11 reference scenes and worse on `outdoor-hdri`, `character`, `fog` (no volume fog) and `foliage` (equal to 0.0003); the mean is 0.171 against 0.189 (`npm run reference -- --path-tracer`, [bench/reference/path-tracer.json](../bench/reference/path-tracer.json)). It draws normal and metallic-roughness maps (issue #129) and runs about 2.8 times faster per thread, and 3.5 to 3.9 times with the shadow-ray change (inferred from 8,360 to about 30,000 paths per second on the demo room), than at that table, whose scores and seconds predate both (the second table in the reference README has the current ones); it draws them on box-projected materials too, can stop converged pixels on request (`noiseThreshold`, off by default because it costs `spot-area` score, see the reference README), and finishes a 1920 by 1080 still of a 181,708 triangle room at 64 samples in 246 s on 8 threads with `noiseThreshold` 0.03 (about 8 to 9 minutes with every sample, inferred) under a job limit now 600 s; it does not trace volume fog, translucent leaves, occlusion or emissive maps or light linking, and it is not Cycles parity (its floor is darker than Cycles' in `character` and `outdoor-hdri`, cause not found). `addons/light-bake` bakes bounced light from point, spot and area lights and the sun into a lightmap for each part, on the CPU with ray tracing; recipes reach it through the `bake` section and `set-bake` (draft, standard or fine presets, shrunk deterministically to a ray work budget of 10 million so a preset finishes on a 56 part room; scene_inspect reports what it used, whether it reduced, bake seconds and skipped parts, which include hair, particle and cloth nodes), patterned, textured and emissive parts bake through a second UV set and a `lightMap` slot, GLB export writes the map approximately as `TEXCOORD_1` emissive, but there are no reflection probes and no baked AO. On `lit-interior` it brings the score against Cycles from 0.5055 to 0.1444 (`npm run reference -- --bake lit-interior`). | [light-bake](../tests/light-bake.test.js), [path-tracer](../tests/path-tracer.test.js), [recipe bake](../tests/agent-bake.test.js), [frame time](../bench/reference/frame-time.mjs), [lit-interior scene](../bench/reference/scenes.js) | #55, #57, #128 |
| Rendering > Render Engines > Workbench | out of scope | A viewport engine for working by hand. | | |
| Rendering > Cameras | partial | Perspective, orthographic views, focal length, animated paths, depth of field from depth and camera motion blur, both repeatable per frame. Object motion blur and bokeh shapes are missing. | [camera-path](../tests/camera-path.test.js), [camera](../tests/camera.test.js), [render-passes](../tests/render-passes.test.js) | #54 |
diff --git a/src/agent-bake.js b/src/agent-bake.js
index 36be2d90..1b34a044 100644
--- a/src/agent-bake.js
+++ b/src/agent-bake.js
@@ -29,8 +29,11 @@ export function normalizeAgentBake(input) {
}
resolved[field] = finiteNumber(input[field], `Bake ${field}`, minimum, maximum);
}
- // Absent or false: no probes. 'room' puts one in the middle of an enclosed room; a list places them.
- if (input.probes !== undefined) {
+ // Absent means 'room', one probe in the middle of an enclosed room (an open scene gets none). false opts out; a list places them.
+ // Measured against Cycles, a probe lowered the FLIP score of every baked room, so a bake brings one along.
+ if (input.probes === undefined) {
+ resolved.probes = 'room';
+ } else {
resolved.probes = input.probes === false || input.probes === 'room' ? input.probes : normalizeProbeList(input.probes);
}
for (const field of ['samples', 'bounces']) {
@@ -210,6 +213,6 @@ export function bakeAgentParts(parts, worldMatrices, environment, settings, gene
});
// Probes are placed here, on the page, because they build maps and materials; their trace ran above.
const placed = probeTrace ? placeProbes(bakedParts, probeTrace) : null;
- return { parts: Object.freeze(placed ? placed.parts : bakedParts), report: { ...(placed ? { probes: placed.report } : {}), ...settings, used, reduced, texels: report.texels, rayWork: report.rayWork, seconds: report.seconds,
+ return { parts: Object.freeze(placed ? placed.parts : bakedParts), report: { ...settings, ...(placed ? { probes: placed.report } : {}), used, reduced, texels: report.texels, rayWork: report.rayWork, seconds: report.seconds,
bakedParts: report.parts.length, skipped: report.skipped } };
}
diff --git a/src/agent-scene-capabilities.js b/src/agent-scene-capabilities.js
index 08b285e2..6c7700cb 100644
--- a/src/agent-scene-capabilities.js
+++ b/src/agent-scene-capabilities.js
@@ -249,7 +249,7 @@ export const AGENT_SCENE_CAPABILITIES = Object.freeze({
}),
// Recipe bake: bounced light written into lightmaps at build time (src/light-bake.js, loaded on demand).
bake: Object.freeze({
- fields: 'preset, or samples (1-256), bounces (1-3), texelsPerUnit (1-12) over it; probes room or up to 4 {position, radius?}. Same recipe, same bytes.',
+ fields: 'preset, or samples (1-256), bounces (1-3), texelsPerUnit (1-12) over it; probes room by default, false for none, or up to 4 {position, radius?}. Same recipe, same bytes.',
presets: BAKE_PRESETS,
notes: 'Bounced light from point, spot, area and key lights. Reruns when parts, lights, materials or bake change. Skips alpha, skin, morph, hair, cloth (bake.skipped). A preset shrinks to fit (bake.used, bake.reduced); explicit settings fail over maxPathWork or past maxSeconds. No environment map or specular. Probes (off by default): specular only, none in glTF.',
limits: Object.freeze({ maxSeconds: BAKE_MAXIMUM_SECONDS, workerMaxSeconds: BAKE_WORKER_MAXIMUM_SECONDS, maxPathWork: BAKE_EXPLICIT_PATH_WORK_LIMIT, maxPointLights: 8 }),
diff --git a/tests/agent-bake.test.js b/tests/agent-bake.test.js
index 9559a799..dd64e5e8 100644
--- a/tests/agent-bake.test.js
+++ b/tests/agent-bake.test.js
@@ -40,9 +40,9 @@ function lightmapBytes(part) {
}
test('bake presets and fields resolve to plain numbers within their ranges', () => {
- assert.deepEqual(normalizeAgentBake({ preset: 'fine' }), BAKE_PRESETS.fine);
- assert.deepEqual(normalizeAgentBake({}), BAKE_PRESETS.standard);
- assert.deepEqual(normalizeAgentBake({ preset: 'draft', samples: 48 }), { ...BAKE_PRESETS.draft, samples: 48 });
+ assert.deepEqual(normalizeAgentBake({ preset: 'fine' }), { ...BAKE_PRESETS.fine, probes: 'room' });
+ assert.deepEqual(normalizeAgentBake({}), { ...BAKE_PRESETS.standard, probes: 'room' });
+ assert.deepEqual(normalizeAgentBake({ preset: 'draft', samples: 48 }), { ...BAKE_PRESETS.draft, samples: 48, probes: 'room' });
assert.equal(normalizeAgentBake(null), null);
});
@@ -207,7 +207,7 @@ test('a preset on a 56 part room shrinks to the path work budget, finishes, and
test('a preset that already fits is not reduced', () => {
const bake = createAgentScene(closedRoom()).inspect().bake;
assert.equal(bake.reduced, false);
- assert.deepEqual(bake.used, BAKE_PRESETS.draft);
+ assert.deepEqual(bake.used, { ...BAKE_PRESETS.draft, probes: 'room' });
});
test('explicit settings over the hard limit fail up front with a lower setting to try', () => {
@@ -231,7 +231,7 @@ test('explicit settings far above the preset budget run when they fit the hard l
try {
const bake = createAgentScene(largeRoom(explicit)).inspect().bake;
assert.equal(bake.reduced, false);
- assert.deepEqual(bake.used, explicit);
+ assert.deepEqual(bake.used, { ...explicit, probes: 'room' });
assert.ok(bake.texels * explicit.samples * explicit.bounces > BAKE_PRESET_PATH_WORK);
} finally {
performance.now = realNow;
@@ -285,3 +285,10 @@ test('a cloth sheet is skipped by the bake and still has no lightmap after a see
}
assert.ok(scene.parts.find(part => part.name === 'floor').material.emissiveMap);
});
+
+test('a bake places a room probe unless bake.probes is false', () => {
+ const withProbe = createAgentScene(closedRoom()).inspect().bake;
+ assert.equal(withProbe.probes.placed.length, 1);
+ const optedOut = createAgentScene(closedRoom({ bake: { preset: 'draft', probes: false } })).inspect().bake;
+ assert.equal(optedOut.probes, false);
+});
diff --git a/tests/reflection-probes.test.js b/tests/reflection-probes.test.js
index 9567b034..564023e5 100644
--- a/tests/reflection-probes.test.js
+++ b/tests/reflection-probes.test.js
@@ -85,8 +85,9 @@ test('probe lists are validated', () => {
assert.deepEqual(roomCentreProbe(closedRoom()).position.map(Math.round), [0, 2, 0]);
});
-test('bake.probes accepts false, room, a list or nothing', () => {
- assert.equal(normalizeAgentBake({}).probes, undefined);
+test('bake.probes defaults to room, and false opts out', () => {
+ assert.equal(normalizeAgentBake({}).probes, 'room');
+ assert.equal(normalizeAgentBake({ preset: 'draft' }).probes, 'room');
assert.equal(normalizeAgentBake({ probes: false }).probes, false);
assert.equal(normalizeAgentBake({ probes: 'room' }).probes, 'room');
assert.deepEqual(normalizeAgentBake({ probes: [{ position: [0, 1, 0] }] }).probes, [{ position: [0, 1, 0] }]);
@@ -96,3 +97,14 @@ test('the probe shader code compiles in only when asked for', () => {
assert.doesNotMatch(createFragmentShader(), /probeEnabled/);
assert.match(createFragmentShader(['probe']), /probeEnabled > 0.5\) surroundings/);
});
+
+test('a probe on a light-mapped part keeps its light map fields and still reads live colour', () => {
+ const lightMap = { width: 2, height: 2, data: new Uint8Array(16) };
+ const lightMapped = placed('mirror', ball, [0, 1, 0], [0.5, 0.5, 0.5], { metallic: 1, roughness: 0.05, lightMap, lightMapScale: 2, emission: 0.5 });
+ const [probed] = applyReflectionProbes([lightMapped], lamp, [{ position: [0, 1, 0], radius: 5 }], {}).parts;
+ assert.ok(probed.material.environmentProbe);
+ assert.equal(probed.material.lightMap, lightMap);
+ assert.equal(probed.material.lightMapScale, 2);
+ lightMapped.material.color = [0.2, 0.3, 0.4];
+ assert.deepEqual(probed.material.color, [0.2, 0.3, 0.4]);
+});