Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Shorten the curve and text geometry schema

Nguyen Xuan An40b2fcee0817
diff --git a/bench/tool-cost-budgets.json b/bench/tool-cost-budgets.json
index d8898e1c..f24e86d8 100644
--- a/bench/tool-cost-budgets.json
+++ b/bench/tool-cost-budgets.json
@@ -1,16 +1,16 @@
{
- "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",
- "schemaTotalBytes": 189210,
+ "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)",
+ "schemaTotalBytes": 190420,
"schemaToolBytes": {
- "scene_create": 60495,
- "scene_apply": 46320,
+ "scene_create": 61220,
+ "scene_apply": 46850,
"mesh_edit": 33875,
- "scene_create_asset": 19450,
+ "scene_create_asset": 19310,
"mesh_stack": 11335
},
"schemaOtherToolBytes": 4000,
"resultBytes": {
- "scene_capabilities": 5885,
+ "scene_capabilities": 6435,
"scene_create": 1400,
"scene_inspect": 1400,
"mesh_inspect": 1200,
diff --git a/docs/agent-scene.md b/docs/agent-scene.md
index fb22ec89..b2053082 100644
--- a/docs/agent-scene.md
+++ b/docs/agent-scene.md
@@ -47,8 +47,7 @@ The normal frame loop can render retained parts without calling inspection or ex
### On-demand code
-Mesh editing, `lathe`, `extrude`, `tube` and `curve` geometry, `text` geometry with its font, material `pattern` and `motion` load on demand, so a recipe of
-Mesh editing, `lathe`, `extrude` and `tube` geometry, material `pattern`, `motion` and node `relations` load on demand, so a recipe of
+Mesh editing, `lathe`, `extrude`, `tube` and `curve` geometry, `text` geometry with its font, material `pattern`, `motion` and node `relations` load on demand, so a recipe of
primitives pays about half the bytes. `createAgentScene` and `apply` stay synchronous. When a recipe uses one of them,
load its code first; a missing module throws an error that names this call.
diff --git a/scripts/mcp-server.mjs b/scripts/mcp-server.mjs
index 972b788f..7f815131 100644
--- a/scripts/mcp-server.mjs
+++ b/scripts/mcp-server.mjs
@@ -61,7 +61,7 @@ const materialPattern = z.strictObject({
seed: z.number().int().min(0).max(2147483647).optional(),
axis: z.enum(['x', 'y', 'z']).optional().describe('Object axis the grain runs along. Defaults to y.'),
resolution: z.union([z.literal(256), z.literal(512), z.literal(1024)]).optional().describe('Texture size. Defaults to 512; each pattern takes about 4 MiB at 512.'),
-}).describe('Procedural texture baked for this material. By default it needs no UVs and is projected along the object axes; mapping uv follows the geometry UVs instead. color then tints it (defaults to white), and roughness and metallic scale it.');
+}).describe('Procedural texture; box mapping needs no UVs. color tints it, roughness and metallic scale it.');
function layerNumber(field, description) {
const [minimum, maximum] = MATERIAL_LAYER_SCALAR_RANGES[field];
return z.number()
@@ -454,7 +454,7 @@ const physics = z.strictObject({
gravity: vector3.optional().describe('Defaults to [0, -9.81, 0].'),
bodies: z.array(physicsBody).min(1).max(64),
joints: z.array(physicsJoint).max(64).optional().describe('Joint bodies are the node IDs of physics bodies.'),
-}).describe('Rigid-body physics recorded offline with Rapier at 60 steps a second, then played back by time like motion: scene_look and scene_review motionTime seek into the recording, so a seek back shows the identical frame. Bodies are recipe nodes; scene_inspect reports contacts, sensor events and resting state as numbers. Needs the optional peer dependency @dimforge/rapier3d-compat. A node cannot have a physics body and a motion translation or rotation track.');
+}).describe('Rigid-body physics recorded offline with Rapier at 60 steps a second and played back by time: motionTime seeks into the recording. Bodies are recipe nodes; scene_inspect reports contacts and resting state. Needs the optional peer @dimforge/rapier3d-compat. A node cannot have both a body and a motion translation or rotation track.');
// The full motion schema (tracks, ik, constraints, drivers) is in scene_create's recipe. scene_apply and asset recipes
// take the same object, validated by the backend, without repeating about 35 KB of schema in each tool.
const recipeMotionReference = z.record(z.string(), z.unknown()).describe('The same object as recipe.motion in scene_create: duration, loop, tracks, ik, constraints, drivers. Read that tool for the fields. On an imported asset it also takes layers, up to 8 clips played at motion time before tracks and ik: { clip (scene_inspect animations id), mask: { joints, descendants, exclude } of node IDs, weight, speed, offset, loop, additive, reference, bones: { clip node: asset node } to retarget by name, morph }. A masked layer waves while another walks.');
diff --git a/src/agent-scene-capabilities.js b/src/agent-scene-capabilities.js
index 7fa54c74..cf9179f9 100644
--- a/src/agent-scene-capabilities.js
+++ b/src/agent-scene-capabilities.js
@@ -29,8 +29,8 @@ export const CURVE_TEXT_LIMITS = Object.freeze({
verticesPerCharacterSegment: 640, verticesPerCustomCharacterSegment: 2400, maxPointsPerGlyph: 128,
});
export const CURVE_TEXT_DETAILS = Object.freeze({
- curve: 'Cubic Bezier sweep. points: [x,y,z] (smooth automatic handles) or {position, handleIn?, handleOut?} with handles as absolute positions (a lone handle is mirrored). radius (0.05), taper: radius factors 0+ spread along the length, e.g. [1,0.2], profile: [[x,y]...] cross-section in radius units (default round, radialSegments 8; sharp corners stay flat shaded), resolution: samples per span (12), closed. Open curves get flat caps.',
- text: 'Extruded text in the XY plane, first baseline on y=0, reading along +X, facing +Z, centred through depth. text (use \n for lines), size (1, em height), depth (0.2), align left|center|right, curveSegments 1-16 per outline curve (4), font (default DejaVu Sans, printable ASCII; other fonts come from registerAgentSceneFont in code, not MCP).',
+ curve: 'Cubic Bezier sweep. points: [x,y,z] or {position, handleIn?, handleOut?}. radius (0.05), taper, profile ([[x,y]...]), radialSegments, resolution, closed. See docs/modeling.md.',
+ text: 'Extruded text, baseline y=0 along +X, facing +Z. text (\n for lines), size (1), depth (0.2), align left|center|right, curveSegments, font. See docs/modeling.md.',
});
export const MATERIAL_MAPPINGS = Object.freeze(['box', 'uv']);
export const MATERIAL_GRAPH_NODES = Object.freeze({
@@ -84,7 +84,12 @@ export const AGENT_SCENE_CAPABILITIES = Object.freeze({
materialPatterns: MATERIAL_PATTERN_TYPES, maxMaterialPatterns: MAX_MATERIAL_PATTERNS,
materialMappings: MATERIAL_MAPPINGS,
renderPasses: Object.freeze({ names: RENDER_PASS_NAMES, files: 'render-<pass>.png or frame-N-<pass>.png, raw and unantialiased; opaque and cutout geometry only', depth: `16 bits in red and green over ${RENDER_PASS_DEPTH_RANGE} m`, objectId: '24 bits in RGB; the job result lists the part names' }),
- curveText: Object.freeze({ ...CURVE_TEXT_LIMITS, details: CURVE_TEXT_DETAILS }),
+ curveText: Object.freeze({
+ maxCurvePoints: CURVE_TEXT_LIMITS.maxCurvePoints, maxProfilePoints: CURVE_TEXT_LIMITS.maxProfilePoints,
+ maxTextCharacters: CURVE_TEXT_LIMITS.maxTextCharacters, maxTextLines: CURVE_TEXT_LIMITS.maxTextLines,
+ verticesPerCharacterSegment: CURVE_TEXT_LIMITS.verticesPerCharacterSegment,
+ details: CURVE_TEXT_DETAILS,
+ }),
materialGraph: Object.freeze({ outputs: MATERIAL_GRAPH_OUTPUTS, operators: MATERIAL_GRAPH_OPERATORS, ...MATERIAL_GRAPH_LIMITS, nodes: MATERIAL_GRAPH_NODES }),
fixedResources: false, dynamicTopology: true, checkpoints: true, positiveScaleOnly: true,
authoredLook: true, maxPointLights: 8,