3D engine that AI agents drive
Merge origin/main into material layers
Nguyen Xuan An7549fede6db6
diff --cc CHANGELOG.mdindex dd34bb63,6dd805da..467422fb--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -2,7 -2,8 +2,9 @@@## Unreleased+- Add anisotropy and iridescence material layers, and a depth of field for each timeline shot (part of issue #51). Recipe materials take `anisotropy` and `anisotropyRotation` (highlights stretch along a grain, as `KHR_materials_anisotropy`) and `iridescence`, `iridescenceIor` and `iridescenceThickness` (a thin film that shifts reflection colour with the view angle, as `KHR_materials_iridescence`, after Belcour and Barla). Both are compiled out of the shader unless a part uses them, the MCP schema takes them with one short line each, and glTF import and export read and write the two extensions, so they no longer warn as accepted but not rendered. Transmissive materials draw in their own pass and ignore both; `scene_inspect` diagnostics say so. Recipe materials already accepted `clearcoat`, `transmission`, `thickness` and `ior` with the `surface` tag (a demo film that could not ask for them was running an older build, and its murky marble came from the `liquid` tag, which absorbs by thickness): `scene_capabilities` now lists every layer with its range under `scene.materialLayers`, and `npm run smoke:material-layers` renders a glass ball through the real MCP server and checks that the stripes behind it are bent. A timeline shot also takes `focusDistance` (0.01 to 100000 m) and `blur` (0 to 1), which replace the recipe depth of field for that shot only; sampling stays stateless, so a seek gives the same bytes as the frame in a sequence. `bench/reference` gets a `brushed-film` scene scored against Cycles and EEVEE, and the 11 older scenes did not move by more than 0.002 against Cycles.+ - Add `67js/addons/path-tracer` (part of issue #57; the Cycles comparison is partial). `renderPathTracedImage({ parts, environment, camera }, options)` draws a still by CPU path tracing against the triangle BVH of the light bake, with next-event estimation for the sun, point, spot and area lights, an importance-sampled environment map, GGX metal, clear coat, glass, maps and cutouts, and a wavelet denoiser, on up to eight module workers. An `image` render job selects it with `settings.renderer: { type: "pathTracer", samples, bounces, denoise, seed, maxSeconds }`; the same recipe and seed give the same PNG, a job past `maxSeconds` fails with no image, and samples, size and ray work are bounded. It loads on demand: the core bundle and the agent scene do not carry it (the limits live in `src/path-tracer-capabilities.js`, listed under `jobs.pathTracer` in `scene_capabilities`; the tool schemas gain one `renderer` field inside the total budget). `npm run reference -- --path-tracer` scores it against Cycles: better than the rasterizer on 7 of the 11 reference scenes (`lit-interior` 0.5055 to 0.1993, `spot-area` 0.1242 to 0.0639), worse on `outdoor-hdri`, `character` and `fog`, mean 0.171 against 0.189. Not drawn: volume fog, normal maps, translucent leaves, caustics, lights seen in mirrors. `src/ray-query.js` now holds the ray query and light falloff that `light-bake` used to carry. `npm run smoke:path-tracer` checks it through MCP.+ - Test the docs and the MCP server on clients other than Claude Code (part of issue #69). New `npm run check:tool-schemas` and `tests/other-clients.test.js` check all 22 tool definitions against rules other clients apply: name characters and length, a description under 1024 characters, an object root, a type on every constrained schema, resolvable `$ref`, declared `required` fields, a strict JSON Schema 2020-12 compile (Ajv 8, now a dev dependency) and an empty-argument call. Reports for OpenAI `strict: true` and for Gemini's documented keyword subset list each gap with its schema path; the test fails when a new kind of gap appears. Measured: the MCP SDK client and the MCP Inspector CLI list the 22 tools and call `scene_create`; a draft-07 Ajv compile rejects every tool (`$schema`, then `prefixItems`), strict OpenAI tools would reject the optional-heavy schemas, and nothing was run on Codex, Cursor, Gemini or any non-Anthropic model. A cold Haiku read of only the README and `llms.txt` installed the package and rendered a box but found no route to a PNG without MCP, so `docs/guide.md` gains a tested "Render a PNG from a script without MCP" recipe that the README and `llms.txt` point to; `docs/mcp.md` gains an "Other clients and models" table and no longer pins the standalone launch to 0.9.1. A test checks that every page `llms.txt` and the README link to exists. Schema bytes are unchanged.- Fix the next agent tool errors (part of issue #66). `scene_review` and `scene_look` with `labels` on an imported asset failed with "needs the mesh code" because asset creation loaded the on-demand scene modules only for mesh edits; it now always does, and a test walks every preview path in a fresh process. `geometries` and `materials` are optional in a recipe. A failed `scene_create` says no scene was created and to call it again. `scene_inspect` on an asset accepts a source-node ID that holds one part and names the parts of one that holds several.diff --cc package.jsonindex 7a872fcf,3ae17134..e9c6dabd--- a/package.json+++ b/package.json@@@ -103,8 -104,8 +104,9 @@@"smoke:agent-assets": "node scripts/smoke-agent-assets.mjs","smoke:agent-render-jobs": "node scripts/smoke-agent-render-jobs.mjs","smoke:render-passes": "node scripts/smoke-render-passes.mjs",+ "smoke:path-tracer": "node scripts/smoke-path-tracer.mjs","smoke:film-timeline": "node scripts/smoke-film-timeline.mjs",+ "smoke:material-layers": "node scripts/smoke-material-layers.mjs","smoke:agent-motion": "node scripts/smoke-agent-motion.mjs","smoke:agent-physics": "node scripts/smoke-agent-physics.mjs","smoke:agent-cloth": "node scripts/smoke-agent-cloth.mjs",