3D engine that AI agents drive
Merge remote-tracking branch 'origin/main' into HEAD
Nguyen Xuan Anfc9f47d1544e
diff --cc CHANGELOG.mdindex 4f6caa84,c71b390c..614e1b4a--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -2,8 -2,9 +2,11 @@@## Unreleased+- Add bounded field expressions: a JSON language of math, comparison, logic, vectors, seeded noise and attributes (position, normal, index, tags) that compiles once to closures over typed arrays and never executes a string. It limits nodes (64), depth (12), elements (250,000) and node-evaluations (8 million) before it evaluates, and only reads operator names from a fixed table. It drives a `{ "field": expression }` face selection rule, `set_position` and `displace` as edits and stack nodes, and a `where` filter for instances. `displace` and `set_position` match Blender's Displace modifier and a Geometry Nodes Set Position node in five new golden cases+- Add `instances` on a recipe node: repeat its geometry at the points of a grid, a seeded scatter in a box or the surface of a geometry, with `where`, `yaw`, `alignToNormal` and `scale`, at most 2048 candidate points. It expands to ordinary nodes that share geometry and material, so the renderer draws one instanced batch. Add the `pillar-court` task to the agent modeling suite+ - Add the `scene_export_glb` MCP tool (22 tools now) and morph weight clips in `exportGlb`. The tool writes the active recipe or imported asset scene as a GLB under `<jobs>/exports/` with a server-chosen name and returns the path, byte count and SHA-256; it takes no path, keeps the newest eight files and refuses more than 32 MiB. It exports the current pose (pattern textures, imported textures, skins, morph weights, IK as posed), `motionTime` seeks authored motion first, and `clip` adds an imported asset's source clip. Clip tracks with `property: 'weights'` write a SCALAR sampler of one weight per target. Checked in Blender 5.2: a patterned recipe opens with 2 meshes and 3 images, the robot with IK opens as 1 armature, 43 bones and 20 meshes, and its Walking clip as one action of 23 frames. Nothing in `src/index.js` changes, so no size budget moves+ - Add material layers: `clearcoat` and `clearcoatRoughness`, `transmission` with `thickness`, `ior`, `attenuationColor` and `attenuationDistance`, `sheenColor` and `sheenRoughness`, and `specular` and `specularColor`. Recipes, the MCP schema, glTF import and export (`KHR_materials_clearcoat`, `transmission`, `volume`, `ior`, `specular`, `sheen`) all take them, each checked at the boundary. Transmission refracts the opaque scene like the `liquid` material. Anisotropy and iridescence are not rendered yet. Import of those two still warns+ - Change the glTF import of the six layer extensions above from accepted-and-ignored to rendered, so `asset.warnings` no longer lists them- Add spot lights (`environment.spotLights`, 8), rectangular area lights (`environment.areaLights`, 4) and shadows for point and spot lights (`castShadow: true`). Intensity of a spot light is candela, as for a point light, with Blender's cone mask. Area lights use a representative point, within 1.2 percent of Cycles on the axis. Shadows share one 2048 x 3072 depth atlas of 24 tiles (24 MiB, allocated on first use): a point light takes 6 and a spot light 1, and a request for more is an error. The shader code and the atlas exist only in a scene that uses them. Recipes get all of it through `set-environment`, the MCP schema and `scene_capabilities` (`maxSpotLights`, `maxAreaLights`, `localShadows`). Cascaded directional shadows and light linking are not part of this- Add ten cutting and repair edits: `fill_holes`, `dissolve_faces`, `dissolve_edges`, `dissolve_verts`, `dissolve_limited`, `bisect_plane` (with `fill`, `clearInner`, `clearOuter`), `bridge_edge_loops` (with `segments`), `subdivide_edges`, `grid_fill` and `knife_project`. Each tags what it makes, and the edge rule `{ "open": true }` picks boundary edges. The lint message for an open boundary now suggests `fill_holes`. 18 new cases match Blender in counts, face sizes, area, volume and positions; the knife is compared only with a straight plane cut and differs where a face runs along the projection directiondiff --cc bench/size/baseline.jsonindex 05fb5094,8cd460f9..3fb03289--- a/bench/size/baseline.json+++ b/bench/size/baseline.json@@@ -14,9 -14,9 +14,9 @@@},"bundles": {"entry:core": {- "min": 261051,- "gzip": 74713,- "brotli": 63726- "min": 268768,- "gzip": 76732,- "brotli": 65413++ "min": 269168,++ "gzip": 76869,++ "brotli": 65593},"entry:model": {"min": 40093,@@@ -64,9 -64,9 +64,9 @@@"brotli": 12998},"entry:mesh": {-- "min": 130796,-- "gzip": 43755,-- "brotli": 38368++ "min": 144153,++ "gzip": 48359,++ "brotli": 41816},"entry:shrinkwrap": {"min": 56188,@@@ -129,14 -129,14 +129,14 @@@"brotli": 762},"entry:agent-scene": {- "min": 338801,- "gzip": 107187,- "brotli": 91567- "min": 344496,- "gzip": 108633,- "brotli": 92877++ "min": 363196,++ "gzip": 115077,++ "brotli": 97971},"entry:agent-asset": {- "min": 365325,- "gzip": 114605,- "brotli": 98079- "min": 371020,- "gzip": 116055,- "brotli": 99302++ "min": 389720,++ "gzip": 122420,++ "brotli": 104242},"entry:hdri": {"min": 8075,@@@ -144,19 -144,19 +144,19 @@@"brotli": 2801},"scene:lit-box": {- "min": 194282,- "gzip": 53065,- "brotli": 45377+ "min": 200858,+ "gzip": 54820,+ "brotli": 46863},"scene:gltf-box": {- "min": 251444,- "gzip": 71774,- "brotli": 61619+ "min": 258708,+ "gzip": 73797,+ "brotli": 63362},"scene:agent-scene": {- "min": 437383,- "gzip": 133081,- "brotli": 113464- "min": 444099,- "gzip": 134816,- "brotli": 114839++ "min": 462799,++ "gzip": 141241,++ "brotli": 120198}}}diff --cc bench/size/budgets.jsonindex 0d088513,24bbc9e3..709f802b--- a/bench/size/budgets.json+++ b/bench/size/budgets.json@@@ -5,7 -5,7 +5,7 @@@"agent-scene": 100000},"budgets": {- "entry:core": 76300,- "entry:core": 78300,++ "entry:core": 78500,"entry:model": 14400,"entry:nature": 13200,"entry:motion": 13600,@@@ -15,7 -15,7 +15,7 @@@"entry:sculpt": 2500,"entry:surface": 10100,"entry:mesh-query": 15900,- "entry:mesh": 48400,- "entry:mesh": 44700,++ "entry:mesh": 49400,"entry:shrinkwrap": 18300,"entry:surface-attachment": 11800,"entry:physics": 16500,@@@ -28,11 -28,11 +28,11 @@@"entry:grass": 4400,"entry:clutter": 5300,"entry:texture-set": 900,- "entry:agent-scene": 113700,- "entry:agent-asset": 121100,- "entry:agent-scene": 110900,- "entry:agent-asset": 118400,++ "entry:agent-scene": 117400,++ "entry:agent-asset": 124900,"entry:hdri": 3300,- "scene:lit-box": 54200,- "scene:gltf-box": 73300,- "scene:agent-scene": 139500+ "scene:lit-box": 56000,+ "scene:gltf-box": 75300,- "scene:agent-scene": 137600++ "scene:agent-scene": 144100}}diff --cc src/agent-scene.jsindex 327e724b,a42ef91e..36dfd26b--- a/src/agent-scene.js+++ b/src/agent-scene.js@@@ -7,8 -7,8 +7,9 @@@ import { normalizeAgentLook } from './aimport { normalizeAgentMotion, compileAgentMotion } from './agent-motion.js';import { meshReport, generateMeshGeometry, MESH_SMOOTH_ANGLE_DEFAULT } from './agent-mesh.js';import { normalizeMeshEdits, normalizeMeshStack } from './mesh-recipe.js';+import { expandInstancedNodes } from './mesh-instances.js';import { AGENT_SCENE_CAPABILITIES, AGENT_SCENE_DEFAULT_LIMITS, MAX_MATERIAL_PATTERNS, RECIPE_ALPHA_MODES } from './agent-scene-capabilities.js';+ import { MATERIAL_LAYER_FIELDS, validateMaterialLayers } from './material-layers.js';import { materialPatternTextures, normalizeMaterialPattern } from './material-patterns.js';export { AGENT_SCENE_CAPABILITIES, AGENT_SCENE_DEFAULT_LIMITS };export { normalizeAgentLook, resolveAgentShadow } from './agent-look.js';