3D engine that AI agents drive
Merge remote-tracking branch 'origin/main' into merged/fix-bake-gaps
Nguyen Xuan An70477dc28935
diff --cc CHANGELOG.mdindex f84d924a,b1050778..7db86578--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -2,7 -2,7 +2,8 @@@## 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). `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 `sculpt` and `shrinkwrap` mesh edits (part of issue #47; surface patches and a stack form are not built). `sculpt` applies up to 32 inflate, displace and smooth strokes to the vertices of the selected faces; `shrinkwrap` moves them onto a primitive, to the nearest point or projected along a direction, with an offset. Both are in `scene_capabilities` (`meshSculpt`) and in the `mesh_edit` schema, with the tool schema total unchanged (the face rule and tag prefix descriptions were shortened to pay for them). The stroke maths moved to `src/sculpt-strokes.js` and serves `sculptGeometry` too. Four Blender golden cases (two Shrinkwrap modifier comparisons; the sculpt reference runs the same brush formula on Blender's mesh), hostile input tests, and the suite task `ball-badge`, which needs a plate bent onto a ball.- 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 --cc bench/size/baseline.jsonindex 6c0564d5,9a7e4805..87410f8f--- a/bench/size/baseline.json+++ b/bench/size/baseline.json@@@ -129,9 -129,9 +129,9 @@@"brotli": 4675},"entry:light-bake": {- "min": 72625,- "gzip": 26403,- "brotli": 23331- "min": 69343,- "gzip": 25450,- "brotli": 22506++ "min": 72900,++ "gzip": 26484,++ "brotli": 23361},"entry:path-tracer": {"min": 33334,@@@ -144,24 -144,24 +144,24 @@@"brotli": 762},"entry:agent-scene": {- "min": 210288,- "gzip": 65233,- "brotli": 57078- "min": 211305,- "gzip": 65638,- "brotli": 57433++ "min": 211468,++ "gzip": 65703,++ "brotli": 57500},"entry:agent-scene+lazy": {- "min": 648991,- "gzip": 223385,- "brotli": 197442- "min": 651394,- "gzip": 224241,- "brotli": 197961++ "min": 656357,++ "gzip": 225836,++ "brotli": 199349},"entry:agent-asset": {- "min": 305595,- "gzip": 96912,- "brotli": 85164- "min": 306611,- "gzip": 97325,- "brotli": 85543++ "min": 306775,++ "gzip": 97383,++ "brotli": 85592},"entry:agent-asset+lazy": {- "min": 686065,- "gzip": 235104,- "brotli": 207462- "min": 688467,- "gzip": 235968,- "brotli": 207983++ "min": 693431,++ "gzip": 237556,++ "brotli": 209425},"entry:hdri": {"min": 8075,@@@ -199,14 -199,14 +199,14 @@@"brotli": 71399},"scene:agent-scene": {- "min": 321456,- "gzip": 96009,- "brotli": 83598- "min": 322503,- "gzip": 96434,- "brotli": 83931++ "min": 322662,++ "gzip": 96484,++ "brotli": 84041},"scene:agent-scene+lazy": {- "min": 760164,- "gzip": 254165,- "brotli": 223917- "min": 762587,- "gzip": 255037,- "brotli": 224422++ "min": 767546,++ "gzip": 256611,++ "brotli": 225945}}}diff --cc bench/size/budgets.jsonindex be19ca6f,4a24588b..6ad39dc4--- a/bench/size/budgets.json+++ b/bench/size/budgets.json@@@ -1,5 -1,5 +1,5 @@@{-- "archiveBytes": 801000,++ "archiveBytes": 815000,"goals": {"lit-box": 50000,"gltf-box": 80000,