Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Fit the bake capability notes to the schema budget and raise the light-bake size budget

Nguyen Xuan Ane35da59fe986
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 89006b7f..f84d924a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,7 +2,7 @@
## Unreleased
-- Fix three gaps a demo film found in the recipe light bake (part of issue #55). A baked scene with `cloth` failed at render time for every frame after t=0 with "A light map needs lightUvs on rigid geometry, with no skin or morph", because the cloth simulation replaces the sheet's geometry each frame; cloth sheet nodes are now skipped and listed in `report.skipped`. The bake now lights with spot lights (the renderer's cone and soft edge) and area lights (front side only, one deterministic shadow ray to a point of the rectangle per hit), where it ignored both; a scene without them bakes the same bytes. The presets could not finish a normal scene (`standard` passed its 20 s limit on a 56 part room, `fine` hit the 30 s preview limit): a recipe bake now has a ray work budget of 10 million units (texels x samples x bounces x rays per hit), estimated from the unwrap before any ray is traced with no clock involved. A preset is scaled down to fit and `scene_inspect` `bake` reports `used` and `reduced`; explicit `samples`, `bounces` or `texelsPerUnit` are never reduced and fail with a message naming the number that fits. `bakeLightmaps` is now `planLightmaps`, `estimateBake` and `traceLightmaps` (still exported as one call); the schema entry grew by one line, within the total budget.
+- Fix three gaps a demo film found in the recipe light bake (part of issue #55). A baked scene with `cloth` failed at render time for every frame after t=0 with "A light map needs lightUvs on rigid geometry, with no skin or morph", because the cloth simulation replaces the sheet's geometry each frame; cloth sheet nodes are now skipped and listed in `report.skipped`. The bake now lights with spot lights (the renderer's cone and soft edge) and area lights (front side only, one deterministic shadow ray to a point of the rectangle per hit), where it ignored both; a scene without them bakes the same bytes. The presets could not finish a normal scene (`standard` passed its 20 s limit on a 56 part room, `fine` hit the 30 s preview limit): a recipe bake now has a ray work budget of 10 million units (texels x samples x bounces x rays per hit), estimated from the unwrap before any ray is traced with no clock involved. A preset is scaled down to fit and `scene_inspect` `bake` reports `used` and `reduced`; explicit `samples`, `bounces` or `texelsPerUnit` are never reduced and fail with a message naming the number that fits. `bakeLightmaps` is now `planLightmaps`, `estimateBake` and `traceLightmaps` (still exported as one call). `entry:core` did not change; `entry:light-bake` grew by 1,033 bytes gzip (budget 25,900 to 26,900) and the lazy agent entries by about 1,580; the schema stayed within its total budget (the capability notes were shortened to fit).
- Add ragdolls (part of issue #96): `physics.ragdoll` in a recipe with armatures and `physics` in an asset recipe (`set-physics`) bind a capsule body to every bone or joint and play the fall back as the pose of those bones, the same bytes for the same seek. New `src/ragdoll.js`, loaded with the physics code only. New suite task `robot-ragdoll`. The lazy budgets of `agent-scene+lazy` and `agent-asset+lazy` rise by 100 and 800 bytes gzip for it; the core entries did not grow from this. Joints have no swing limits yet.
- Add terrain holes and a recipe `terrain` geometry (part of issue #64; layers beyond four and the navmesh are not built). `createTerrain({ holes: [{ center: [x, z], radius }] })` leaves no surface where a cell centre is inside a circle, and `terrain.isHole(x, z)` answers for a point; without `holes` the seeded meshes are byte-identical (a digest test). A recipe geometry `{ type: "terrain", size, resolution, seed, amplitude, holes }` builds one seeded ground mesh with the same holes; it loads on demand through the new `terrain` module (core did not grow), the tool schema entry is one line with the fields in `scene_capabilities` `terrain`, and the schema total budget did not change (scene_create and scene_apply rose by a few hundred bytes, mesh_edit fell by the same amount). New suite task `terrain-hole-walk` (ground with a 3 m opening and a walker that has to go around it) with the checks `groundRelief` and `walkPath`. Measured: Haiku passed it 2 of 2 (9 and 6 tool calls, $0.29 in all) and both exported recipes used the `terrain` geometry; there was no control run without the feature, so this shows agents find it, not how many could do without.
diff --git a/bench/size/baseline.json b/bench/size/baseline.json
index 5ef009df..6c0564d5 100644
--- a/bench/size/baseline.json
+++ b/bench/size/baseline.json
@@ -129,9 +129,9 @@
"brotli": 4675
},
"entry:light-bake": {
- "min": 69068,
- "gzip": 25370,
- "brotli": 22449
+ "min": 72625,
+ "gzip": 26403,
+ "brotli": 23331
},
"entry:path-tracer": {
"min": 33334,
@@ -144,24 +144,24 @@
"brotli": 762
},
"entry:agent-scene": {
- "min": 210130,
- "gzip": 65170,
- "brotli": 57066
+ "min": 210288,
+ "gzip": 65233,
+ "brotli": 57078
},
"entry:agent-scene+lazy": {
- "min": 644038,
- "gzip": 221802,
- "brotli": 196072
+ "min": 648991,
+ "gzip": 223385,
+ "brotli": 197442
},
"entry:agent-asset": {
- "min": 305436,
- "gzip": 96859,
- "brotli": 85071
+ "min": 305595,
+ "gzip": 96912,
+ "brotli": 85164
},
"entry:agent-asset+lazy": {
- "min": 681111,
- "gzip": 233531,
- "brotli": 205993
+ "min": 686065,
+ "gzip": 235104,
+ "brotli": 207462
},
"entry:hdri": {
"min": 8075,
@@ -199,14 +199,14 @@
"brotli": 71399
},
"scene:agent-scene": {
- "min": 321299,
- "gzip": 95954,
- "brotli": 83554
+ "min": 321456,
+ "gzip": 96009,
+ "brotli": 83598
},
"scene:agent-scene+lazy": {
- "min": 755207,
- "gzip": 252588,
- "brotli": 222505
+ "min": 760164,
+ "gzip": 254165,
+ "brotli": 223917
}
}
}
diff --git a/bench/size/budgets.json b/bench/size/budgets.json
index 78bfcc58..be19ca6f 100644
--- a/bench/size/budgets.json
+++ b/bench/size/budgets.json
@@ -29,7 +29,7 @@
"entry:terrain": 3400,
"entry:grass": 4400,
"entry:clutter": 5300,
- "entry:light-bake": 25900,
+ "entry:light-bake": 26900,
"entry:path-tracer": 13800,
"entry:texture-set": 900,
"entry:agent-scene": 66500,
diff --git a/docs/light-bake.md b/docs/light-bake.md
index ec5bb7d1..c942142b 100644
--- a/docs/light-bake.md
+++ b/docs/light-bake.md
@@ -34,7 +34,7 @@ Ranges are 1 to 256 samples, 1 to 3 bounces and 1 to 12 texels per unit. The bak
A recipe bake may trace 10 million units of ray work (texels x samples x bounces x rays per hit, one bounce ray plus a shadow ray for each light). The unwrap gives the texel count before any ray is traced, so the estimate is plain arithmetic: it reads no clock and does not depend on machine speed, and the same recipe always resolves to the same numbers. The budget was measured on a closed 56 part room, where every path bounces to the end, at about 1.3 million units per second (about 8 s of tracing, under the 20 s limit and the 30 s preview deadline). Open scenes run faster.
-- A preset (all three fields equal to `draft`, `standard` or `fine`) that is over the budget is scaled down: samples by a fifth and texelsPerUnit by a tenth, repeatedly, until it fits (samples not below 16, texelsPerUnit not below 1). `bake.used` shows the result and `bake.reduced` is `true`. The 56 part demo room at `standard` runs at 40 samples and texelsPerUnit 3.5 instead of 128 and 6.
+- A preset (all three fields equal to `draft`, `standard` or `fine`) that is over the budget is scaled down: samples by a fifth and texelsPerUnit by a tenth, repeatedly, until it fits (samples not below 16, texelsPerUnit not below 1). `bake.used` shows the result and `bake.reduced` is `true`. The 57 node demo room at `standard` runs at 16 samples and texelsPerUnit 2.32 instead of 128 and 6 (8.9 million units, 1.8 s of tracing, 52 parts baked; it is an open room, so it traces faster per unit than the closed-room measurement the budget is set on).
- Explicit `samples`, `bounces` or `texelsPerUnit` (any combination that is not exactly a preset) are never reduced. Over the budget they fail, and the message names what fits, for example "samples 32 or fewer with texelsPerUnit 12, or texelsPerUnit 4.1 or less with samples 256".
- A scene that cannot fit even 16 samples at texelsPerUnit 1 fails with a message to remove parts or lights.
diff --git a/src/agent-scene-capabilities.js b/src/agent-scene-capabilities.js
index e9c22964..47b0cc45 100644
--- a/src/agent-scene-capabilities.js
+++ b/src/agent-scene-capabilities.js
@@ -224,7 +224,7 @@ export const AGENT_SCENE_CAPABILITIES = Object.freeze({
bake: Object.freeze({
fields: 'preset, or samples (1-256), bounces (1-3), texelsPerUnit (1-12) over it. Same recipe, same bytes.',
presets: BAKE_PRESETS,
- notes: 'Bounced light from point, spot, area and key lights, for closed rooms. Reruns only when parts, lights, materials or bake change. Patterns and textures keep their look. Skips alpha, skin, morph, hair and cloth nodes (bake.skipped, bake.seconds). A preset shrinks to fit the ray work limit (bake.used, bake.reduced); explicit samples or texelsPerUnit over it fail. Environment map and specular are not baked.',
+ 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 maxRayWork (bake.used, bake.reduced); explicit samples or texelsPerUnit over it fail. No environment map or specular.',
limits: Object.freeze({ maxSeconds: BAKE_MAXIMUM_SECONDS, maxRayWork: BAKE_RAY_WORK_BUDGET, maxPointLights: 8 }),
}),
motionLimits: Object.freeze({ maxTracks: 128, maxKeyframesPerTrack: 64, maxKeyframes: 2048, maxDuration: 30 }),