3D engine that AI agents drive
Add sculpt and shrinkwrap mesh edits
Nguyen Xuan An0e7d0c82b6a7
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex e11aca4e..b1050778 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -2,6 +2,8 @@## Unreleased+- 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.- Bake patterned, textured and emissive parts, and skip hair hosts (part of issue #128). A recipe `bake` used to skip every part with a pattern, a map or emission (31 parts, the floor and every wall, in the demo room) and failed `scene_create` with "Textured geometry requires UV channel 0" on a node that hosts hair. Those parts now keep `uvs` and their look and take the bounced light through a new `lightMap` material slot on a second UV set (`geometry.lightUvs`); the fragment shader adds `color * (1 - metallic) * lightMap * lightMapScale`, so a brick pattern tints its own bounced light. Hair and particle host nodes are skipped and listed in `report.skipped`. The shader branch compiles out of scenes with no light map; the renderer carries about 650 bytes of gzip for it in `entry:core` (see `docs/light-bake.md` for the measured sizes). GLB export writes `TEXCOORD_1` and the light map as the emissive texture (an approximation: glTF has no light map slot). The path tracer ignores baked maps by design. New reference scene `brick-room` (a recipe-built closed brick room).diff --git a/bench/agent-modeling/check.mjs b/bench/agent-modeling/check.mjsindex fa41fd69..30ee76ee 100644--- a/bench/agent-modeling/check.mjs+++ b/bench/agent-modeling/check.mjs@@ -65,6 +65,32 @@ function checkWalkPath(check, measures) {return { pass: problems.length === 0, detail: [...new Set(problems)].slice(0, 3).join('; ') || `${WALK_SAMPLES} samples around the opening, on the ground` };}+/** Every vertex of a node lies between two distances of a point, and the node spreads over a minimum extent. */+function checkShell(check, measures) {+ const positions = measures.nodePositions(check.node);+ if (!positions) return { pass: false, detail: `no drawn node ${check.node}` };+ const low = [Infinity, Infinity, Infinity];+ const high = [-Infinity, -Infinity, -Infinity];+ let nearest = Infinity;+ let farthest = 0;+ for (let offset = 0; offset < positions.length; offset += 3) {+ const distance = Math.hypot(positions[offset] - check.centre[0], positions[offset + 1] - check.centre[1], positions[offset + 2] - check.centre[2]);+ nearest = Math.min(nearest, distance);+ farthest = Math.max(farthest, distance);+ for (let axis = 0; axis < 3; axis++) {+ low[axis] = Math.min(low[axis], positions[offset + axis]);+ high[axis] = Math.max(high[axis], positions[offset + axis]);+ }+ }+ const problems = [];+ if (nearest < check.min) problems.push(`a vertex is ${round(nearest)} m from the centre, under ${check.min}`);+ if (farthest > check.max) problems.push(`a vertex is ${round(farthest)} m from the centre, over ${check.max}`);+ check.spread.forEach((minimum, axis) => {+ if (high[axis] - low[axis] < minimum) problems.push(`${'xyz'[axis]} spreads ${round(high[axis] - low[axis])} m, under ${minimum}`);+ });+ return { pass: problems.length === 0, detail: problems.join('; ') || `${check.node} between ${round(nearest)} and ${round(farthest)} m of the centre` };+}+function checkOne(check, measures) {switch (check.kind) {case 'lint':@@ -154,6 +180,8 @@ function checkOne(check, measures) {}case 'walkPath':return checkWalkPath(check, measures);+ case 'shell':+ return checkShell(check, measures);case 'bendsToward': {const root = measures.nodePosition(check.from, check.time);const middle = measures.nodePosition(check.node, check.time);diff --git a/bench/agent-modeling/measure.mjs b/bench/agent-modeling/measure.mjsindex 6075fba6..688b334d 100644--- a/bench/agent-modeling/measure.mjs+++ b/bench/agent-modeling/measure.mjs@@ -444,6 +444,10 @@ export async function measureRecipe(recipe) {const part = scene.parts.find(candidate => candidate.name === name);return part ? surfaceHeightAt(worldGeometry(part), pointX, pointZ) : null;},+ nodePositions(name) {+ const part = scene.parts.find(candidate => candidate.name === name);+ return part ? worldGeometry(part).positions : null;+ },nodeBounds(name) {const part = scene.parts.find(candidate => candidate.name === name);return part ? boundsOfPositions(worldGeometry(part).positions) : null;diff --git a/bench/agent-modeling/references.mjs b/bench/agent-modeling/references.mjsindex bac14096..0ceac603 100644--- a/bench/agent-modeling/references.mjs+++ b/bench/agent-modeling/references.mjs@@ -467,6 +467,23 @@ export const REFERENCES = {] }],[{ id: 'soap', geometry: 'soap', translation: [0, 0.015, 0] }],),+ 'ball-badge': scene(+ [+ { id: 'ball', type: 'sphere' },+ {+ id: 'badge', type: 'mesh', base: { type: 'grid', segments: 16 },+ edits: [+ { op: 'set_position', position: { vec: [{ mul: [{ attr: 'position', component: 'x' }, 0.8] }, { mul: [{ attr: 'position', component: 'y' }, 0.8] }, 1.6] } },+ { op: 'shrinkwrap', target: { type: 'sphere' }, mode: 'project', direction: [0, 0, -1], offset: 0.02 },+ { op: 'solidify', thickness: 0.02, offset: -1 },+ ],+ },+ ],+ [+ { id: 'ball', geometry: 'ball', translation: [0, 0.5, 0], scale: [0.5, 0.5, 0.5] },+ { id: 'badge', geometry: 'badge', translation: [0, 0.5, 0], scale: [0.5, 0.5, 0.5] },+ ],+ ),pebble: scene([{ id: 'pebble', type: 'mesh', base: { type: 'box', bevel: 0 }, stack: [{ op: 'subdivide', levels: 3 }] }],[{ id: 'pebble', geometry: 'pebble', translation: [0, PEBBLE_SIZE[1] / 2, 0], scale: PEBBLE_SIZE.map(size => size / SUBDIVIDED_CUBE_SPAN) }],diff --git a/bench/agent-modeling/results/2026-10-31-23-18-haiku-sculpt-cold.json b/bench/agent-modeling/results/2026-10-31-23-18-haiku-sculpt-cold.jsonnew file mode 100644index 00000000..bcfa749e--- /dev/null+++ b/bench/agent-modeling/results/2026-10-31-23-18-haiku-sculpt-cold.json@@ -0,0 +1,148 @@+{+ "run": "2026-10-31-23-18-haiku-sculpt-cold",+ "model": "claude-haiku-5-5",+ "date": "2026-10-31T23:25:43.735Z",+ "skill": false,+ "runsPerTask": 2,+ "passed": 2,+ "tasks": 2,+ "toolCalls": 19,+ "costUsd": 0.37,+ "byModel": {+ "claude-haiku-5-5": {+ "runs": 2,+ "passed": 2,+ "successRate": 1,+ "toolCalls": 19,+ "toolErrors": 3,+ "inputTokens": 2543691,+ "outputTokens": 20190,+ "costUsd": 0.37,+ "tasks": {+ "ball-badge": {+ "runs": 2,+ "passed": 2,+ "successRate": 1,+ "toolCalls": 19,+ "toolErrors": 3,+ "inputTokens": 2543691,+ "outputTokens": 20190,+ "costUsd": 0.37+ }+ }+ }+ },+ "records": [+ {+ "task": "ball-badge",+ "attempt": 1,+ "pass": true,+ "passed": 6,+ "total": 6,+ "failed": [],+ "model": "claude-haiku-5-5",+ "toolCalls": 10,+ "toolErrors": 1,+ "toolsByName": {+ "ToolSearch": 1,+ "scene_capabilities": 1,+ "scene_create": 1,+ "mesh_inspect": 1,+ "mesh_edit": 2,+ "scene_apply": 2,+ "scene_look": 1,+ "scene_export_recipe": 1,+ "scene_dispose": 1+ },+ "features": {+ "geometryTypes": [+ "sphere",+ "mesh"+ ],+ "meshOperations": [+ "subdivide_edges",+ "set_position"+ ],+ "motionIk": [],+ "motionTracks": 0+ },+ "look": {+ "silhouette": {+ "views": {+ "front": 0.9993,+ "side": 0.999,+ "three-quarter": 0.9991+ },+ "mean": 0.9991+ },+ "images": [+ "artifacts/agent-modeling/2026-10-31-23-18-haiku-sculpt-cold/look/1/ball-badge-front.png",+ "artifacts/agent-modeling/2026-10-31-23-18-haiku-sculpt-cold/look/1/ball-badge-side.png",+ "artifacts/agent-modeling/2026-10-31-23-18-haiku-sculpt-cold/look/1/ball-badge-three-quarter.png"+ ]+ },+ "turns": 12,+ "costUsd": 0.18854315000000002,+ "inputTokens": 1332151,+ "outputTokens": 9835,+ "wallSeconds": 159,+ "exitCode": 0,+ "stopped": "success"+ },+ {+ "task": "ball-badge",+ "attempt": 2,+ "pass": true,+ "passed": 6,+ "total": 6,+ "failed": [],+ "model": "claude-haiku-5-5",+ "toolCalls": 9,+ "toolErrors": 2,+ "toolsByName": {+ "ToolSearch": 1,+ "scene_capabilities": 1,+ "scene_create": 3,+ "mesh_edit": 1,+ "scene_inspect": 1,+ "scene_look": 1,+ "scene_export_recipe": 1,+ "scene_dispose": 1+ },+ "features": {+ "geometryTypes": [+ "sphere",+ "mesh"+ ],+ "meshOperations": [+ "subdivide_edges",+ "set_position"+ ],+ "motionIk": [],+ "motionTracks": 0+ },+ "look": {+ "silhouette": {+ "views": {+ "front": 0.9993,+ "side": 0.9988,+ "three-quarter": 0.9988+ },+ "mean": 0.999+ },+ "images": [+ "artifacts/agent-modeling/2026-10-31-23-18-haiku-sculpt-cold/look/2/ball-badge-front.png",+ "artifacts/agent-modeling/2026-10-31-23-18-haiku-sculpt-cold/look/2/ball-badge-side.png",+ "artifacts/agent-modeling/2026-10-31-23-18-haiku-sculpt-cold/look/2/ball-badge-three-quarter.png"+ ]+ },+ "turns": 11,+ "costUsd": 0.17938708000000003,+ "inputTokens": 1211540,+ "outputTokens": 10355,+ "wallSeconds": 151,+ "exitCode": 0,+ "stopped": "success"+ }+ ]+}diff --git a/bench/agent-modeling/tasks.mjs b/bench/agent-modeling/tasks.mjsindex a53f3328..e01f7dbb 100644--- a/bench/agent-modeling/tasks.mjs+++ b/bench/agent-modeling/tasks.mjs@@ -343,6 +343,21 @@ faces and no sharp edges, resting on the ground.`,{ kind: 'triangles', min: 200 },],},+ {+ id: 'ball-badge',+ prompt: `A ball with a badge on it, as two nodes. Node ball: a sphere of radius 0.5 m resting on the ground, centred on X = 0 and Z = 0.+Node badge: a thin plate that was a flat square 0.4 m by 0.4 m (X by Y) and 0.01 m thick, bent so it follows the ball's curved+surface over the front of the ball (+Z side) and centred on it, with its back face lying on the ball (within 5 mm) and its front+face 0.01 m outside it. The plate must keep a smooth grid of at least 12 by 12 cells so the curve is round, and be one closed solid.`,+ checks: [+ { kind: 'lint' },+ { kind: 'parts', max: 2 },+ { kind: 'ground' },+ { kind: 'size', expected: [1, 1, null] },+ { kind: 'shell', node: 'badge', centre: [0, 0.5, 0], min: 0.495, max: 0.515, spread: [0.35, 0.35, 0.04] },+ { kind: 'triangles', min: 500 },+ ],+ },{id: 'crate-uv',prompt: `A wooden crate that will get a tiled wood texture. The body is a 0.6 m cube. Each of its four sides has adiff --git a/bench/size/baseline.json b/bench/size/baseline.jsonindex 5ef009df..9a7e4805 100644--- a/bench/size/baseline.json+++ b/bench/size/baseline.json@@ -55,8 +55,8 @@},"entry:sculpt": {"min": 5937,- "gzip": 2391,- "brotli": 2184+ "gzip": 2398,+ "brotli": 2172},"entry:surface": {"min": 29893,@@ -69,9 +69,9 @@"brotli": 12998},"entry:mesh": {- "min": 218339,- "gzip": 73718,- "brotli": 62495+ "min": 224773,+ "gzip": 75662,+ "brotli": 64228},"entry:shrinkwrap": {"min": 56188,@@ -129,9 +129,9 @@"brotli": 4675},"entry:light-bake": {- "min": 69068,- "gzip": 25370,- "brotli": 22449+ "min": 69343,+ "gzip": 25450,+ "brotli": 22506},"entry:path-tracer": {"min": 33334,@@ -144,24 +144,24 @@"brotli": 762},"entry:agent-scene": {- "min": 210130,- "gzip": 65170,- "brotli": 57066+ "min": 211305,+ "gzip": 65638,+ "brotli": 57433},"entry:agent-scene+lazy": {- "min": 644038,- "gzip": 221802,- "brotli": 196072+ "min": 651394,+ "gzip": 224241,+ "brotli": 197961},"entry:agent-asset": {- "min": 305436,- "gzip": 96859,- "brotli": 85071+ "min": 306611,+ "gzip": 97325,+ "brotli": 85543},"entry:agent-asset+lazy": {- "min": 681111,- "gzip": 233531,- "brotli": 205993+ "min": 688467,+ "gzip": 235968,+ "brotli": 207983},"entry:hdri": {"min": 8075,@@ -199,14 +199,14 @@"brotli": 71399},"scene:agent-scene": {- "min": 321299,- "gzip": 95954,- "brotli": 83554+ "min": 322503,+ "gzip": 96434,+ "brotli": 83931},"scene:agent-scene+lazy": {- "min": 755207,- "gzip": 252588,- "brotli": 222505+ "min": 762587,+ "gzip": 255037,+ "brotli": 224422}}}diff --git a/bench/size/budgets.json b/bench/size/budgets.jsonindex 78bfcc58..4a24588b 100644--- a/bench/size/budgets.json+++ b/bench/size/budgets.json@@ -17,7 +17,7 @@"entry:sculpt": 2500,"entry:surface": 10100,"entry:mesh-query": 15900,- "entry:mesh": 75200,+ "entry:mesh": 76200,"entry:shrinkwrap": 18300,"entry:surface-attachment": 11800,"entry:physics": 18000,diff --git a/bench/tool-cost-budgets.json b/bench/tool-cost-budgets.jsonindex 171d4a76..a64166d1 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; 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); then six modifier ops (weld, triangulate, edge_split, smooth, simple_deform, cast) added as one compact schema entry with details in scene_capabilities meshModifiers, entry and mesh_stack description shortened: total 190382 (budget unchanged at 190420), mesh_edit 34216 (budget 34220), scene_capabilities result 7042 (budget 7050); mesh_stack 11682 (budget 11690); after merging imported mesh topology with the modifier ops: raised the total to 190480 (measured 190471), mesh_edit to 34300 (measured 34293) and the scene_capabilities result to 7520 (measured 7512) for imported mesh edits; then cloth (recipe cloth, set-cloth, grid geometry) added with the total unchanged at 190480 (measured 189159): physics descriptions shortened and set-physics now takes the same record reference as set-motion, scene_create raised to 62150 and scene_apply lowered to 44130, scene_capabilities result raised to 8190 (measured 8176) for the cloth details; then particles and hair (recipe `particles`, set-particles) added with the total unchanged at 190480 (measured 189642, scene_create raised to 62350 and scene_apply to 44370 for the recipe particles reference and set-particles): the section is one record reference described in scene_capabilities, so the scene_capabilities result rose to 9570 (measured 9523) for the particle and hair fields; after merging the film timeline (recipe timeline, set-timeline) with particles: total 190719 (budget 190730), scene_create 62464, scene_apply 44620, scene_capabilities result 9902; then the path tracer renderer setting (drop z.int bounds, integers still checked by the job validator): total raised to 190830 (measured 190818); after merging the render limits and light bake with the path tracer: measured total 190013, scene_create raised to 62680 (measured 62667), scene_apply to 44860 (measured 44852) and the scene_capabilities result to 10620 (measured 10613) for the bake section and job size limits; then material layers anisotropy and iridescence (issue #51): the 16 layer fields take one short line each in the schema and their ranges and notes moved to scene_capabilities scene.materialLayers, so the scene_capabilities result rose to 12230 (measured 12168)",+ "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); then six modifier ops (weld, triangulate, edge_split, smooth, simple_deform, cast) added as one compact schema entry with details in scene_capabilities meshModifiers, entry and mesh_stack description shortened: total 190382 (budget unchanged at 190420), mesh_edit 34216 (budget 34220), scene_capabilities result 7042 (budget 7050); mesh_stack 11682 (budget 11690); after merging imported mesh topology with the modifier ops: raised the total to 190480 (measured 190471), mesh_edit to 34300 (measured 34293) and the scene_capabilities result to 7520 (measured 7512) for imported mesh edits; then cloth (recipe cloth, set-cloth, grid geometry) added with the total unchanged at 190480 (measured 189159): physics descriptions shortened and set-physics now takes the same record reference as set-motion, scene_create raised to 62150 and scene_apply lowered to 44130, scene_capabilities result raised to 8190 (measured 8176) for the cloth details; then particles and hair (recipe `particles`, set-particles) added with the total unchanged at 190480 (measured 189642, scene_create raised to 62350 and scene_apply to 44370 for the recipe particles reference and set-particles): the section is one record reference described in scene_capabilities, so the scene_capabilities result rose to 9570 (measured 9523) for the particle and hair fields; after merging the film timeline (recipe timeline, set-timeline) with particles: total 190719 (budget 190730), scene_create 62464, scene_apply 44620, scene_capabilities result 9902; then the path tracer renderer setting (drop z.int bounds, integers still checked by the job validator): total raised to 190830 (measured 190818); after merging the render limits and light bake with the path tracer: measured total 190013, scene_create raised to 62680 (measured 62667), scene_apply to 44860 (measured 44852) and the scene_capabilities result to 10620 (measured 10613) for the bake section and job size limits; then material layers anisotropy and iridescence (issue #51): the 16 layer fields take one short line each in the schema and their ranges and notes moved to scene_capabilities scene.materialLayers, so the scene_capabilities result rose to 12230 (measured 12168); then the sculpt and shrinkwrap mesh edits (issue #47) with the total unchanged at 190830 (measured 190612): the face rule and tag prefix descriptions shortened (the face rule text repeats in every select field), so mesh_edit rose to 33980 (measured 33960) and mesh_stack fell to 11030 (measured 11014), and the scene_capabilities result rose to 13350 (measured 13338) for the meshSculpt notes","schemaTotalBytes": 190830,"schemaToolBytes": {"scene_create": 62930,"scene_apply": 45020,- "mesh_edit": 33230,+ "mesh_edit": 33980,"scene_create_asset": 19310,- "mesh_stack": 11690+ "mesh_stack": 11030},"schemaOtherToolBytes": 4000,"resultBytes": {- "scene_capabilities": 12460,+ "scene_capabilities": 13350,"scene_create": 1400,"scene_inspect": 1400,"mesh_inspect": 1200,diff --git a/docs/mesh.md b/docs/mesh.mdindex 482c101b..6e49687e 100644--- a/docs/mesh.md+++ b/docs/mesh.md@@ -401,6 +401,39 @@ Blender comparison (`tests/fixtures/blender`): 4 decimate and 2 remesh cases oncompared with the Decimate (collapse) and Remesh (voxel) modifiers by face count, volume, area and the Hausdorff distance tothe input, because face counts differ. `differences.json` lists the remesh face counts, which differ by 2% and 7%.+### Sculpt and shrinkwrap++Two edits shape a mesh organically. Both take `select` (default every face) and move only the vertices of the selected+faces, so a tag confines them. Neither adds or removes faces, and the topology stays valid.++- `sculpt` (`strokes`, 1 to 32) applies brush strokes in order. A stroke has a `type` (`inflate` along the vertex+ normal, `displace` along its `direction`, `smooth` toward the mean of the neighbours, with a `strength` from 0 to 1),+ a `center`, a `radius` and a `strength` in mesh units (negative pushes in). The falloff is quintic, zero first and+ second derivatives at the rim. A stroke that crosses the edge of the selection leaves a step there. The stroke maths is+ shared with `sculptGeometry` (`src/sculpt-strokes.js`). More than 5 million vertex visits (vertices times strokes) is+ refused before it runs.+- `shrinkwrap` (`target`, `translation`, `rotation`, `scale`, `mode`, `direction`, `offset`, `maxDistance`,+ `onMiss`) moves each selected vertex onto the surface of a primitive, placed like a boolean cutter. `nearest` (the+ default) takes the closest point; `project` casts a ray along `direction` and takes the first hit. `offset` stands the+ vertex off along the face normal, on the side a projected vertex came from, as Blender does. A vertex with no hit+ is an error (`onMiss` "error") or stays put (`keep`). The queries use the BVH of `src/mesh-query.js`, at most 20+ million triangle tests per edit.++A decal is a grid base shrunk onto a curved target and then solidified:++```json+{ "id": "badge", "type": "mesh", "base": { "type": "grid", "segments": 16 }, "edits": [+ { "op": "set_position", "position": { "vec": [{ "mul": [{ "attr": "position", "component": "x" }, 0.8] }, { "mul": [{ "attr": "position", "component": "y" }, 0.8] }, 1.6] } },+ { "op": "shrinkwrap", "target": { "type": "sphere" }, "mode": "project", "direction": [0, 0, -1], "offset": 0.02 },+ { "op": "solidify", "thickness": 0.02, "offset": -1 }+] }+```++The Blender comparison (`tests/blender-golden.test.js`) has two shrinkwrap cases against the Shrinkwrap modifier, one+nearest and one projected with an offset, and two sculpt cases. Blender has no modifier for brush strokes that runs+without a viewport, so the sculpt reference applies the same brush formula to Blender's mesh and vertex normals.+The vertex positions agree within 0.001 in all four, with no accepted difference.+### UV unwrap`uv_unwrap` writes the corner attribute `uv` (and the edge attribute `seam`), as an edit or as a stack node. Itdiff --git a/docs/parity.md b/docs/parity.mdindex 16bfffe2..155ada96 100644--- a/docs/parity.md+++ b/docs/parity.md@@ -98,7 +98,7 @@ To move to a new Blender release, run `node scripts/parity-manual-snapshot.mjs`.| Modeling > Modifiers > Deform > Laplacian Deform Modifier | missing | No equivalent. | | || Modeling > Modifiers > Deform > Lattice Modifier | missing | No lattice. Not in the first slice of #42, which took the modifiers agents use most. | | #42 || Modeling > Modifiers > Deform > Mesh Deform Modifier | missing | No equivalent. | | |-| Modeling > Modifiers > Deform > Shrinkwrap Modifier | partial | `addons/shrinkwrap` works in code. Recipes can not reach it. | [shrinkwrap](../tests/shrinkwrap.test.js) | #42, #47 |+| Modeling > Modifiers > Deform > Shrinkwrap Modifier | partial | The `shrinkwrap` mesh edit moves the vertices of the selected faces onto a primitive, to the nearest point or projected along a direction, with an offset, a distance limit and keep-on-miss. Blender's modes beyond nearest surface point and projection along one axis, its vertex group and wrap-on-inside and outside modes are not here, and the target is a primitive, not another node. Compared with the Shrinkwrap modifier on a cylinder, nearest and projected with an offset. `addons/shrinkwrap` still serves code. | [mesh-sculpt-shrinkwrap](../tests/mesh-sculpt-shrinkwrap.test.js), [blender golden](../tests/blender-golden.test.js) | #42, #47 || Modeling > Modifiers > Deform > Simple Deform Modifier | partial | `simple_deform` edit and stack node: twist, bend, taper and stretch about x, y or z over the whole mesh extent. No limits, lock axes, origin object or vertex groups. | [mesh-modifiers](../tests/mesh-modifiers.test.js), [Blender results](../tests/fixtures/blender/golden.json) | #42 || Modeling > Modifiers > Deform > Smooth Modifier | done | `smooth` edit and stack node (factor and iterations over every vertex). Per-axis switches and vertex groups are not supported. | [mesh-modifiers](../tests/mesh-modifiers.test.js), [Blender results](../tests/fixtures/blender/golden.json) | || Modeling > Modifiers > Deform > Smooth Corrective Modifier | missing | No equivalent. | | |@@ -125,7 +125,7 @@ To move to a new Blender release, run `node scripts/parity-manual-snapshot.mjs`.| Sculpting & Painting > Brushes | out of scope | Brush settings for a hand. Strokes have explicit parameters. | | || Sculpting & Painting > Selection & Visibility | out of scope | Interface for a person in a paint mode. | | || Sculpting & Painting > Navigating in Paint Modes | out of scope | Interface for a person in a paint mode. | | |-| Sculpting & Painting > Sculpting | partial | Inflate, displace and smooth strokes in code. Recipes can not reach them, and there is no remesh during a stroke. | [sculpt](../tests/sculpt.test.js) | #47 |+| Sculpting & Painting > Sculpting | partial | The `sculpt` mesh edit applies up to 32 inflate, displace and smooth strokes to the vertices of the selected faces, so a tag confines them. No grab, pinch, crease or mask brushes, no dynamic topology and no remesh during a stroke. Blender has no modifier for brush strokes, so its golden runs the same quintic brush formula on Blender's own mesh and vertex normals; that checks the maths and the use of the mesh, not Blender's brush engine. | [sculpt](../tests/sculpt.test.js), [mesh-sculpt-shrinkwrap](../tests/mesh-sculpt-shrinkwrap.test.js), [blender golden](../tests/blender-golden.test.js) | #47 || Sculpting & Painting > Texture Paint | missing | No painting into textures. | | || Sculpting & Painting > Vertex Paint | partial | Imported vertex colors render. Recipes can not author them. | | || Sculpting & Painting > Weight Paint | partial | Automatic weights replace painting by hand. Skin weights are a mesh attribute, but there are no named vertex groups and no painting. | [rigging](../tests/rigging.test.js) | #46 |diff --git a/scripts/blender-golden.py b/scripts/blender-golden.pyindex 42a3a322..33de87fb 100644--- a/scripts/blender-golden.py+++ b/scripts/blender-golden.py@@ -260,7 +260,43 @@ def knife_project(bm, edit):bisect_plane(bm, {"point": list(start), "normal": list(normal)})+# Blender has no modifier for sculpt brushes that runs without a viewport, so the reference runs the same brush formula+# on Blender's own mesh: displacement along the angle-weighted vertex normal (inflate) or a fixed direction (displace),+# or a step toward the mean of the edge neighbours (smooth), scaled by a quintic falloff that has zero first and second+# derivatives at the rim and the centre value one.+def brush_falloff(relative):+ return 1 - relative**3 * (10 + relative * (-15 + 6 * relative))+++def sculpt(bm, edit):+ bm.verts.index_update()+ points = [vertex.co.copy() for vertex in bm.verts]+ normals = [vertex.normal.copy() for vertex in bm.verts]+ neighbours = [[edge.other_vert(vertex).index for edge in vertex.link_edges] for vertex in bm.verts]+ for stroke in edit["strokes"]:+ centre = Vector(stroke["center"])+ smoothing = stroke["type"] == "smooth"+ moved = [point.copy() for point in points] if smoothing else points+ for index, point in enumerate(points):+ distance = (point - centre).length+ if distance >= stroke["radius"] or stroke["strength"] == 0:+ continue+ weight = stroke["strength"] * brush_falloff(distance / stroke["radius"])+ if smoothing:+ if not neighbours[index]:+ continue+ mean = sum((points[other] for other in neighbours[index]), Vector((0, 0, 0))) / len(neighbours[index])+ moved[index] = point + (mean - point) * weight+ else:+ direction = normals[index] if stroke["type"] == "inflate" else Vector(stroke["direction"]).normalized()+ points[index] = point + direction * weight+ points = moved+ for vertex, point in zip(bm.verts, points):+ vertex.co = point++BMESH_OPERATIONS = {+ "sculpt": sculpt,"extrude_face_region": extrude_face_region,"extrude_individual": extrude_individual,"inset_region": inset_region,@@ -320,6 +356,27 @@ def add_boolean(mesh_object, edit, inputs):modifier.object = cutter+# Blender's Shrinkwrap modifier. Its projection runs along one axis, so the cases project along -Z.+def add_shrinkwrap(mesh_object, edit, inputs):+ target = new_object("Target", inputs[edit["target"]["type"]])+ target.location = edit.get("translation", [0, 0, 0])+ target.scale = edit.get("scale", [1, 1, 1])+ target.hide_render = True+ modifier = mesh_object.modifiers.new("Shrinkwrap", "SHRINKWRAP")+ modifier.target = target+ modifier.wrap_mode = "ON_SURFACE"+ modifier.offset = edit.get("offset", 0)+ if edit.get("mode", "nearest") == "project":+ if edit["direction"] != [0, 0, -1]:+ raise ValueError("The Blender golden projects along -Z only.")+ modifier.wrap_method = "PROJECT"+ modifier.use_project_z = True+ modifier.use_negative_direction = True+ modifier.use_positive_direction = False+ else:+ modifier.wrap_method = "NEAREST_SURFACEPOINT"++# Blender stores a crease from 0 to 1. Measured against 67js sharpness, crease squared times 10 is the sharpness.def add_subdivision(mesh_object, edit, _inputs):levels = edit.get("levels", 1)@@ -480,6 +537,7 @@ MODIFIERS = {"solidify": add_solidify,"boolean": add_boolean,"subdivide": add_subdivision,+ "shrinkwrap": add_shrinkwrap,}diff --git a/scripts/mcp-server.mjs b/scripts/mcp-server.mjsindex 3c9f458c..fe5b6687 100644--- a/scripts/mcp-server.mjs+++ b/scripts/mcp-server.mjs@@ -235,8 +235,8 @@ function primitiveGeometries(identified) {...(identified ? curveAndTextGeometries(id) : []),];}-const selectRule = z.record(z.string(), z.unknown()).describe('Face selection rule: {"all":true}, {"tag":"top"}, {"normal":[0,1,0],"maxAngle":10} (degrees), {"inside":{"min":[x,y,z],"max":[x,y,z]}} (centroids), {"faces":[indices]}, {"and":[rules]}, {"or":[rules]}, {"not":rule}, {"grow":rule,"steps":1}, {"boundary":rule}, {"field":expression} (nonzero at centroids). Tags: top, bottom, side, left, right, front, back, and <name>.cap, <name>.side, <name>.rim or a tag op.');-const editName = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,47}$/).optional().describe('Prefix for the tags this edit creates. Defaults to <op>-<index>.');+const selectRule = z.record(z.string(), z.unknown()).describe('Face rule: {"all":true}, {"tag":"top"}, {"normal":[0,1,0],"maxAngle":10}, {"inside":{"min":[x,y,z],"max":[x,y,z]}} (centroids), {"faces":[i]}, {"and"|"or":[rules]}, {"not":rule}, {"grow":rule,"steps":1}, {"boundary":rule}, {"field":expr}. Tags: top, bottom, side, left, right, front, back, <name>.cap|side|rim.');+const editName = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,47}$/).optional().describe('Tag prefix. Defaults to <op>-<index>.');const edgeRule = z.record(z.string(), z.unknown()).describe('Edge rule: {"all":true}, {"angle":30}, {"along":[x,y,z]}, {"between":[faceRule,faceRule]}, {"boundaryOf":faceRule} or {"open":true} for boundary edges (also {"open":{"inside":{"min":[x,y,z],"max":[x,y,z]}}}).');const meshEdit = z.discriminatedUnion('op', [z.strictObject({ op: z.literal('extrude_face_region'), select: selectRule.optional(), name: editName, offset: finite.describe('Distance along each connected region\'s average normal (negative pushes in).'), direction: vector3.optional().describe('Move along this direction instead of the normal.'), alongNormals: z.boolean().optional().describe('Move each vertex along its own normal instead, keeping the region joined: use for rings and curved bands.') }),@@ -282,6 +282,18 @@ const meshEdit = z.discriminatedUnion('op', [cutter: z.discriminatedUnion('type', primitiveGeometries(false)).describe('Closed cutting shape in the mesh\'s local space, before translation, rotation and scale. Faces it contributes get the tag <name>.cut.'),translation: vector3.optional(), rotation: quaternion.optional().describe('XYZW quaternion.'), scale: vector3.optional().describe('Positive per-axis scale.'),}).describe('Manifold boolean. Both the mesh and the cutter must be closed; mesh_inspect lists open edges.'),+ z.strictObject({+ op: z.literal('sculpt'), select: selectRule.optional(),+ strokes: z.array(z.strictObject({+ type: z.enum(['inflate', 'displace', 'smooth']), center: vector3, radius: finite, strength: finite, direction: vector3.optional(),+ })).min(1).max(32),+ }).describe('Brush strokes on the vertices of the selected faces, in order. Fields and units in scene_capabilities meshSculpt.'),+ z.strictObject({+ op: z.literal('shrinkwrap'), select: selectRule.optional(),+ target: z.record(z.string(), z.unknown()).describe('Primitive to wrap onto, a record like a boolean cutter ({"type":"sphere"}), placed by translation, rotation and scale.'),+ translation: vector3.optional(), rotation: quaternion.optional(), scale: vector3.optional(),+ mode: z.enum(['nearest', 'project']).optional(), direction: vector3.optional(), offset: finite.optional(), maxDistance: finite.optional(), onMiss: z.enum(['error', 'keep']).optional(),+ }).describe('Move the selected vertices onto the target surface, like Blender Shrinkwrap. Fields and defaults in scene_capabilities meshSculpt.'),]);const stackNodes = [z.strictObject({@@ -321,12 +333,12 @@ const stackNodes = [z.strictObject({op: z.literal('decimate'),ratio: z.number().gt(0).max(1).describe('Share of the triangles to keep, counted after triangulation. 0.25 keeps a quarter.'),- }).describe('Quadric edge collapse like the Decimate modifier of Blender. Open boundaries and the borders between tags stay in place, tags carry over, and uv and colour are dropped, so unwrap after it. The result reports triangles before and after, and stoppedEarly when constraints prevented the ratio.'),+ }).describe('Quadric edge collapse like Blender Decimate. Open boundaries and tag borders stay, tags carry over, uv and colour are dropped, so unwrap after it. Reports triangles and stoppedEarly.'),z.strictObject({op: z.literal('remesh'),voxelSize: z.number().positive().optional().describe('Edge of one grid cell. Give this or resolution.'),resolution: z.number().int().min(4).max(192).optional().describe('Cells along the longest side. Give this or voxelSize.'),- }).describe('Voxel remesh like the Remesh modifier of Blender: a closed quad surface of even cells. The mesh must be closed (fill_holes first); tags and attributes are dropped. Over 192 cells per side or 4 million cells is refused before it runs.'),+ }).describe('Voxel remesh like Blender Remesh: a closed quad surface of even cells. The mesh must be closed (fill_holes first); tags and attributes are dropped. Over 192 cells per side is refused.'),z.strictObject({op: z.enum(Object.keys(MODIFIER_OPERATIONS)),distance: z.number().optional(), minVertices: z.number().int().optional(), angle: z.number().optional(),@@ -668,7 +680,7 @@ export function createAgentMcpServer(runtime, { version = packageMetadata.versioregister('scene_create_asset', 'Create the active scene from a catalog GLB and editable asset recipe. Preserves supported maps, skins, morphs and clips. Dispose the existing scene first.', z.strictObject({ recipe: assetRecipe }), { ...edit, destructiveHint: false }, async argumentsValue => jsonResult(await runtime.createAsset(argumentsValue)));register('scene_inspect', 'Read revision, counts and selected nodes. For a recipe with physics, the result lists body final positions, resting times, contacts and sensor enter/leave events. Bounds describe authored geometry rather than shader displacement.', z.strictObject({ ...sessionFields, ids: z.array(identifier).max(4096).optional().describe('Selected node IDs. Omit to inspect scene order.'), kind: z.enum(['meshes', 'hierarchy']).optional().describe('Imported assets only: hierarchy exposes stable source-node IDs and joints.'), offset: z.number().int().min(0).max(4096).optional().describe('Imported assets only: pagination offset.'), limit: z.number().int().min(1).max(4096).optional().describe('Maximum returned node records. Defaults to 64.'), includeBounds: z.boolean().optional().describe('Include world geometry bounds. Defaults to false.') }), readOnly, async argumentsValue => jsonResult(await runtime.inspect(argumentsValue)));register('mesh_inspect', 'Check recipe geometries as polygon meshes: vertex, edge and face counts, triangles/quads/n-gons, connected and closed parts, face tags (top, bottom, side, left, right, front, back), bounds, and lint problems (non-manifold, inconsistent winding, inverted, degenerate, open, loose) with a suggested fix each. Also imported asset parts (mesh-0). Read-only and cached per geometry.', z.strictObject({ ...sessionFields, geometry: identifier.optional().describe('One geometry ID to check, as in mesh_edit.'), geometries: z.array(identifier).min(1).max(16).optional().describe('Geometry IDs to check. Omit both to check the first 16 geometries.') }), readOnly, async ({ geometry: geometryId, geometries, ...rest }) => jsonResult(await runtime.inspectMeshes({ ...rest, ...(geometries || geometryId ? { geometries: [...(geometries ?? []), ...(geometryId ? [geometryId] : [])] } : {}) })));- register('mesh_edit', 'Append edits to a recipe mesh geometry or an imported asset part such as mesh-0 (or replace its edit log), atomically like scene_apply: extrude, inset, delete, flip, translate with proportional falloff, merge by distance, tag, loop cut, bevel, mirror, array, solidify, UV unwrap, set_position and displace driven by field expressions (math, noise, attributes; also a {"field":expr} selection rule), and booleans (union, difference, intersect) with a primitive cutter. Edits that select no faces or break limits fail without changing the scene. Returns the new revision, render status and the mesh report with per-edit results (faces selected, tags created, size after).', z.strictObject({ ...sessionFields, expectedRevision, geometry: identifier.describe('ID of a geometry with type mesh, or an imported part such as mesh-0.'), edits: meshEdits.min(1), replace: z.boolean().optional().describe('Replace the whole edit log instead of appending.') }), edit, async argumentsValue => jsonResult(await runtime.editMesh(argumentsValue)));+ register('mesh_edit', 'Append edits to a recipe mesh geometry or an imported asset part such as mesh-0 (or replace its edit log), atomically like scene_apply: extrude, inset, delete, flip, translate with falloff, tag, loop cut, bevel, mirror, array, solidify, UV unwrap, set_position and displace with field expressions (math, noise, attributes), booleans with a primitive cutter, sculpt brush strokes and shrinkwrap onto a primitive. Edits that select no faces or break limits fail without changing the scene. Returns the new revision, render status and the mesh report with per-edit results.', z.strictObject({ ...sessionFields, expectedRevision, geometry: identifier.describe('ID of a geometry with type mesh, or an imported part such as mesh-0.'), edits: meshEdits.min(1), replace: z.boolean().optional().describe('Replace the whole edit log instead of appending.') }), edit, async argumentsValue => jsonResult(await runtime.editMesh(argumentsValue)));register('mesh_stack', 'Set the non-destructive modifier stack of a recipe mesh geometry (ops and fields: scene_capabilities meshModifiers), evaluated after its edits, each prefix cached. apply: n moves the first n nodes into the edit log, as Blender\'s Apply modifier. Atomic like scene_apply. Returns the revision, render status and mesh report.', z.strictObject({ ...sessionFields, expectedRevision, geometry: identifier.describe('ID of a geometry with type mesh.'), stack: meshStack.optional().describe('The whole new stack. Omit to keep the current stack (for example with apply).'), apply: z.number().int().min(0).max(16).optional() }), edit, async argumentsValue => jsonResult(await runtime.setMeshStack(argumentsValue)));register('scene_apply', 'Atomically edit transforms, look, camera or materials. Procedural scenes support membership and set-motion authoring. Imported assets support set-root, set-asset-node, set-motion and absolute set-animation sampling. Successful batches increment revision once.', z.strictObject({ ...sessionFields, expectedRevision, operations: z.array(operation).min(1).max(256).describe('Node/material/camera/root/animation commands use flat fields. Motion, look patches and add commands contain nested records. Backend validates each scene mode before publication.'), branch: branchName.optional().describe('Fork: store the result as this branch (up to 8), leaving the scene unchanged.') }), edit, async argumentsValue => jsonResult(await runtime.apply(argumentsValue)));register('scene_look', 'Render the active scene as a bounded PNG, optionally with part labels. Optional authored motionTime seeks without changing revision; null restores the authored base pose. Omit to retain the last preview pose.', z.strictObject({ ...sessionFields, motionTime: z.number().min(0).max(3600).nullable().optional(), width: z.number().int().min(64).max(1024).default(768).describe('PNG width in pixels.'), height: z.number().int().min(64).max(1024).default(512).describe('PNG height in pixels.'), labels: labelsFlag }), readOnly, async argumentsValue => {diff --git a/skills/build-67js-scene/references/mesh-modeling.md b/skills/build-67js-scene/references/mesh-modeling.mdindex ca7c587d..2bca742b 100644--- a/skills/build-67js-scene/references/mesh-modeling.md+++ b/skills/build-67js-scene/references/mesh-modeling.md@@ -291,6 +291,23 @@ Other edits take the same shape, for example:- `subdivide_edges` splits chosen edges; with all four edges of a quad chosen it makes a grid.- `knife_project` cuts along a polyline projected along `direction`, front and back. Start and end the line outside the mesh.+## Organic shapes and decals++`sculpt` pushes vertices with brush strokes: `inflate` along the normal, `displace` along a `direction`, `smooth` toward the+neighbours. A tag in `select` keeps the strokes to a region. It does not add faces, so subdivide first when the form needs+more detail. `shrinkwrap` moves vertices onto a primitive `target` (nearest point, or `project` along a `direction`) and+stands them `offset` off it: a flat grid base shrunk onto a ball is a label or decal that follows the curve, and+`solidify` makes it a closed plate. Place the sheet in front of the target first, in the mesh's local space, and give it+enough `segments` for the curve.++```json+{ "id": "badge", "type": "mesh", "base": { "type": "grid", "segments": 16 }, "edits": [+ { "op": "set_position", "position": { "vec": [{ "mul": [{ "attr": "position", "component": "x" }, 0.8] }, { "mul": [{ "attr": "position", "component": "y" }, 0.8] }, 1.6] } },+ { "op": "shrinkwrap", "target": { "type": "sphere" }, "mode": "project", "direction": [0, 0, -1], "offset": 0.02 },+ { "op": "solidify", "thickness": 0.02, "offset": -1 }+] }+```+## Giving a part a surfaceA material `pattern` textures any part with no UVs, after any edits. `size` is metres per repeat, so it stays right ondiff --git a/src/agent-scene-capabilities.js b/src/agent-scene-capabilities.jsindex 282ede34..5732a886 100644--- a/src/agent-scene-capabilities.js+++ b/src/agent-scene-capabilities.js@@ -118,6 +118,12 @@ export const MESH_MODIFIER_NOTES = Object.freeze({cast: 'sphere about the origin: factor 0 to 1 (0.5), size radius (0 = mean vertex distance).',});+// Organic shaping edits. Details stay here so the tool schemas stay small.+export const MESH_SCULPT_NOTES = Object.freeze({+ sculpt: 'strokes run in order on the vertices of the selected faces; other vertices stay, so a tag confines them. A stroke has type inflate (along the vertex normal), displace (along direction, needed) or smooth (strength 0 to 1), center and radius, strength in mesh units (negative pushes in). Falloff is smooth to zero at the radius. For bulges, dents and softened forms.',+ shrinkwrap: 'target is a primitive record placed by translation, rotation and scale. mode nearest (default) moves each selected vertex to the closest point; project moves it along direction (needed) to the first hit. offset (default 0) stands it off along the normal, on the side it came from. maxDistance limits the search; onMiss error (default) or keep. To lay a flat grid sheet onto a curved target as a decal, use enough cells to follow the curve, then solidify.',+});+export const AGENT_SCENE_CAPABILITIES = Object.freeze({format: '67js.scene', schemaVersion: 1,geometryTypes: Object.freeze(['box', 'cylinder', 'sphere', 'torus', 'lathe', 'extrude', 'tube', 'curve', 'text', 'grid', 'terrain', 'mesh']),@@ -125,6 +131,7 @@ export const AGENT_SCENE_CAPABILITIES = Object.freeze({meshEdits: Object.freeze({ operations: Object.freeze(Object.keys(MESH_EDIT_OPERATIONS)), maxEdits: MAX_MESH_EDITS }),meshStack: Object.freeze({ operations: STACK_OPERATIONS, maxNodes: MAX_STACK_NODES }),meshModifiers: MESH_MODIFIER_NOTES,+ meshSculpt: MESH_SCULPT_NOTES,fieldExpressions: Object.freeze({operators: FIELD_OPERATOR_NAMES, attributes: FIELD_ATTRIBUTES,maxNodes: MAX_FIELD_NODES, maxDepth: MAX_FIELD_DEPTH, maxElements: MAX_FIELD_ELEMENTS,diff --git a/src/mesh-field-edits.js b/src/mesh-field-edits.jsindex eca0f8eb..7c1e5041 100644--- a/src/mesh-field-edits.js+++ b/src/mesh-field-edits.js@@ -17,7 +17,7 @@ export function withPositions(mesh, positions) {}/** One flag per vertex: set when the vertex belongs to a face the rule selects. Without a rule, every vertex. */-function selectedVertices(mesh, rule) {+export function selectedVertices(mesh, rule) {const flags = new Uint8Array(mesh.vertexCount);if (!rule) {flags.fill(1);diff --git a/src/mesh-operations.js b/src/mesh-operations.jsindex 572e4397..96c271d4 100644--- a/src/mesh-operations.js+++ b/src/mesh-operations.js@@ -46,9 +46,18 @@ export const MESH_EDIT_OPERATIONS = Object.freeze({displace: { fields: ['select', 'field', 'strength', 'midlevel', 'direction'], tags: [] },decimate: { fields: ['ratio'], tags: [] },remesh: { fields: ['voxelSize', 'resolution'], tags: [] },+ sculpt: { fields: ['select', 'strokes'], tags: [] },+ shrinkwrap: { fields: ['select', 'target', 'translation', 'rotation', 'scale', 'mode', 'direction', 'offset', 'maxDistance', 'onMiss'], tags: [] },...MODIFIER_OPERATIONS,});+// Limits of the sculpt and shrinkwrap edits, and their vocabulary, as plain data.+export const SCULPT_STROKE_TYPES = Object.freeze(['inflate', 'displace', 'smooth']);+export const MAX_SCULPT_STROKES = 32;+export const MAX_SCULPT_VISITS = 5_000_000;+export const SHRINKWRAP_MODES = Object.freeze(['nearest', 'project']);+export const MAX_SHRINKWRAP_TRIANGLE_TESTS = 20_000_000;+export const STACK_OPERATIONS = Object.freeze(['mirror', 'array', 'solidify', 'bevel', 'uv_unwrap', 'subdivide', 'set_position', 'displace', 'decimate', 'remesh', ...Object.keys(MODIFIER_OPERATIONS)]);export const MAX_STACK_NODES = 16;diff --git a/src/mesh-recipe.js b/src/mesh-recipe.jsindex bdf75c2e..acdb7864 100644--- a/src/mesh-recipe.js+++ b/src/mesh-recipe.js@@ -16,8 +16,12 @@ import { setPosition, displaceMesh, DISPLACE_DIRECTIONS } from './mesh-field-ediimport { subdivideMesh, subdivisionSize, MAX_SUBDIVISION_LEVELS, MAX_CREASE_SHARPNESS } from './mesh-subdivide.js';import { decimateMesh } from './mesh-decimate.js';import { isModifierOperation, normalizeModifierEdit, runModifierEdit } from './mesh-modifiers.js';+import { sculptMesh, checkSculptBudget } from './mesh-sculpt.js';+import { shrinkwrapMesh } from './mesh-shrinkwrap.js';import { remeshMesh, remeshGridSize, MAX_REMESH_RESOLUTION } from './mesh-remesh.js';-import { MESH_EDIT_OPERATIONS, MAX_MESH_EDITS, STACK_OPERATIONS, MAX_STACK_NODES } from './mesh-operations.js';+import {+ MESH_EDIT_OPERATIONS, MAX_MESH_EDITS, STACK_OPERATIONS, MAX_STACK_NODES, SCULPT_STROKE_TYPES, MAX_SCULPT_STROKES, SHRINKWRAP_MODES,+} from './mesh-operations.js';export { MESH_EDIT_OPERATIONS, MAX_MESH_EDITS, STACK_OPERATIONS, MAX_STACK_NODES };// Replayable edit log for agent recipes. Each edit is plain JSON; names follow Blender's bmesh.ops where they match.@@ -51,6 +55,45 @@ function checkedField(expression, index, label, kind) {return expression;}+/** translation, rotation (XYZW quaternion) and scale that place a primitive in the mesh's local space. */+function normalizePlacement(edit, normalized, index) {+ normalized.translation = edit.translation === undefined ? [0, 0, 0] : vector(edit.translation, index, 'translation');+ normalized.scale = edit.scale === undefined ? [1, 1, 1] : vector(edit.scale, index, 'scale');+ if (normalized.scale.some(value => value <= 0)) throw editError(index, 'scale components must be positive');+ if (edit.rotation === undefined) {+ normalized.rotation = [0, 0, 0, 1];+ return;+ }+ if (!Array.isArray(edit.rotation) || edit.rotation.length !== 4) throw editError(index, 'rotation is an XYZW quaternion');+ const rotation = edit.rotation.map(component => finiteNumber(component, index, 'rotation'));+ const length = Math.hypot(...rotation);+ if (length === 0) throw editError(index, 'rotation quaternion must be nonzero');+ normalized.rotation = rotation.map(component => component / length);+}++function normalizeStroke(stroke, index, strokeIndex) {+ const label = `strokes[${strokeIndex}]`;+ if (!stroke || typeof stroke !== 'object' || Array.isArray(stroke)) throw editError(index, `${label} must be an object`);+ for (const key of Object.keys(stroke)) {+ if (!['type', 'center', 'radius', 'strength', 'direction'].includes(key)) throw editError(index, `${label} does not take ${key}; fields: type, center, radius, strength, direction`);+ }+ if (!SCULPT_STROKE_TYPES.includes(stroke.type)) throw editError(index, `${label}.type must be one of ${SCULPT_STROKE_TYPES.join(', ')}`);+ const normalized = {+ type: stroke.type,+ center: vector(stroke.center, index, `${label}.center`),+ radius: finiteNumber(stroke.radius, index, `${label}.radius`, { minimum: 0, exclusiveMinimum: true }),+ strength: finiteNumber(stroke.strength, index, `${label}.strength`),+ };+ if (stroke.type === 'smooth' && (normalized.strength < 0 || normalized.strength > 1)) throw editError(index, `${label}.strength of a smooth stroke is from 0 to 1`);+ if (stroke.type === 'displace') {+ normalized.direction = vector(stroke.direction, index, `${label}.direction`);+ if (normalized.direction.every(component => component === 0)) throw editError(index, `${label}.direction must be nonzero`);+ } else if (stroke.direction !== undefined) {+ throw editError(index, `${label}.direction applies only to a displace stroke`);+ }+ return normalized;+}+/** Validate an edit list without running it. Returns normalized copies with default names filled in. */export function normalizeMeshEdits(edits) {if (!Array.isArray(edits)) throw new TypeError('edits must be an array.');@@ -112,20 +155,34 @@ export function normalizeMeshEdits(edits) {throw editError(index, 'cutter must be a primitive record such as { "type": "cylinder", "segments": 32 }');}normalized.cutter = edit.cutter;- normalized.translation = edit.translation === undefined ? [0, 0, 0] : vector(edit.translation, index, 'translation');- normalized.scale = edit.scale === undefined ? [1, 1, 1] : vector(edit.scale, index, 'scale');- if (normalized.scale.some(value => value <= 0)) throw editError(index, 'scale components must be positive');- if (edit.rotation === undefined) {- normalized.rotation = [0, 0, 0, 1];- } else {- if (!Array.isArray(edit.rotation) || edit.rotation.length !== 4) throw editError(index, 'rotation is an XYZW quaternion');- const rotation = edit.rotation.map(component => finiteNumber(component, index, 'rotation'));- const length = Math.hypot(...rotation);- if (length === 0) throw editError(index, 'rotation quaternion must be nonzero');- normalized.rotation = rotation.map(component => component / length);- }+ normalizePlacement(edit, normalized, index);break;}+ case 'sculpt':+ if (!Array.isArray(edit.strokes) || edit.strokes.length < 1 || edit.strokes.length > MAX_SCULPT_STROKES) {+ throw editError(index, `strokes must be an array of 1 to ${MAX_SCULPT_STROKES} brush strokes`);+ }+ normalized.strokes = edit.strokes.map((stroke, strokeIndex) => normalizeStroke(stroke, index, strokeIndex));+ break;+ case 'shrinkwrap':+ if (!edit.target || typeof edit.target !== 'object' || Array.isArray(edit.target) || typeof edit.target.type !== 'string') {+ throw editError(index, 'target must be a primitive record such as { "type": "sphere", "radius": 0.5 }');+ }+ normalized.target = edit.target;+ normalizePlacement(edit, normalized, index);+ if (!SHRINKWRAP_MODES.includes(edit.mode ?? 'nearest')) throw editError(index, `mode must be one of ${SHRINKWRAP_MODES.join(', ')}`);+ normalized.mode = edit.mode ?? 'nearest';+ if (normalized.mode === 'project') {+ normalized.direction = vector(edit.direction, index, 'direction');+ if (normalized.direction.every(component => component === 0)) throw editError(index, 'direction must be nonzero');+ } else if (edit.direction !== undefined) {+ throw editError(index, 'direction applies only to mode project');+ }+ normalized.offset = edit.offset === undefined ? 0 : finiteNumber(edit.offset, index, 'offset', { minimum: 0 });+ if (edit.maxDistance !== undefined) normalized.maxDistance = finiteNumber(edit.maxDistance, index, 'maxDistance', { minimum: 0 });+ if (!['error', 'keep'].includes(edit.onMiss ?? 'error')) throw editError(index, 'onMiss must be error or keep');+ normalized.onMiss = edit.onMiss ?? 'error';+ break;case 'mirror':if (!['x', 'y', 'z'].includes(edit.axis ?? 'x')) throw editError(index, 'axis must be x, y or z');normalized.axis = edit.axis ?? 'x';@@ -237,6 +294,14 @@ function checkSubdivideBudget(mesh, edit, limits, index) {function checkArrayBudget(mesh, edit, limits, index) {checkCutBudget(mesh, edit, limits, index);+ if (edit.op === 'sculpt') {+ try {+ checkSculptBudget(mesh, edit.strokes.length);+ } catch (error) {+ throw new error.constructor(`Mesh edit ${index} (sculpt): ${error.message}`);+ }+ return;+ }if (edit.op === 'subdivide') {checkSubdivideBudget(mesh, edit, limits, index);return;@@ -285,6 +350,11 @@ export function transformMesh(mesh, { translation, rotation, scale }) {});}+function runShrinkwrap(current, edit, resolveCutter) {+ if (!resolveCutter) throw new TypeError('shrinkwrap needs a target resolver; recipe meshes provide one.');+ return shrinkwrapMesh(current, transformMesh(resolveCutter(edit.target), edit), edit);+}+/** Run one normalized edit on MeshData and describe what it did. */function runEdit(current, edit, index, { resolveCutter, limits }) {const result = { op: edit.op };@@ -372,6 +442,17 @@ function runEdit(current, edit, index, { resolveCutter, limits }) {result.movedVertices = outcome.movedVertices;return { mesh: outcome.mesh, result };}+ if (edit.op === 'sculpt' || edit.op === 'shrinkwrap') {+ let outcome;+ try {+ outcome = edit.op === 'sculpt' ? sculptMesh(current, edit) : runShrinkwrap(current, edit, resolveCutter);+ } catch (error) {+ throw new error.constructor(`Mesh edit ${index} (${edit.op}): ${error.message}`);+ }+ result.movedVertices = outcome.movedVertices;+ if (outcome.missedVertices) result.missedVertices = outcome.missedVertices;+ return { mesh: outcome.mesh, result };+ }if (edit.op === 'subdivide') {let subdivided;try {diff --git a/src/mesh-sculpt.js b/src/mesh-sculpt.jsnew file mode 100644index 00000000..2513b535--- /dev/null+++ b/src/mesh-sculpt.js@@ -0,0 +1,57 @@+import { prepareStrokes, applyStroke } from './sculpt-strokes.js';+import { vertexNormals } from './mesh-normals.js';+import { selectedVertices, withPositions } from './mesh-field-edits.js';+import { MAX_SCULPT_STROKES, MAX_SCULPT_VISITS } from './mesh-operations.js';++// The sculpt mesh edit: brush strokes (inflate, displace, smooth) on the vertices of the selected faces. The stroke+// maths is shared with sculptGeometry. Vertices outside the selection stay where they are, so a tag confines a stroke+// to a region; a stroke that crosses the region border leaves a step there, and a smooth stroke still reads its+// neighbours across the border.++/** The vertices as stroke groups: a point, a unit normal and the neighbouring groups (only when a stroke smooths). */+function strokeGroups(mesh, needsNeighbours) {+ const normals = vertexNormals(mesh);+ const groups = [];+ for (let vertex = 0; vertex < mesh.vertexCount; vertex++) {+ const offset = vertex * 3;+ groups.push({+ point: Array.from(mesh.positions.subarray(offset, offset + 3)),+ normal: Array.from(normals.subarray(offset, offset + 3)),+ neighbors: needsNeighbours ? new Set() : null,+ });+ }+ if (needsNeighbours) {+ for (let edge = 0; edge < mesh.edgeVertices.length; edge += 2) {+ const first = mesh.edgeVertices[edge];+ const second = mesh.edgeVertices[edge + 1];+ groups[first].neighbors.add(second);+ groups[second].neighbors.add(first);+ }+ }+ return groups;+}++/** Refuse an edit whose strokes are too many, or whose vertex visits would run too long, before it starts. */+export function checkSculptBudget(mesh, strokeCount) {+ if (strokeCount > MAX_SCULPT_STROKES) throw new RangeError(`A sculpt edit takes at most ${MAX_SCULPT_STROKES} strokes. Split the work into several sculpt edits.`);+ if (mesh.vertexCount * strokeCount > MAX_SCULPT_VISITS) throw new RangeError('Sculpting would visit too many vertices. Use fewer strokes or a coarser mesh.');+}++/** Apply strokes to the vertices of the faces `select` picks (every face without a rule). */+export function sculptMesh(mesh, { select, strokes }) {+ const prepared = prepareStrokes(strokes);+ const needsNeighbours = prepared.some(stroke => stroke.type === 'smooth');+ const groups = strokeGroups(mesh, needsNeighbours);+ for (const stroke of prepared) applyStroke(groups, stroke);+ const flags = selectedVertices(mesh, select);+ const positions = new Float32Array(mesh.positions);+ let movedVertices = 0;+ for (let vertex = 0; vertex < mesh.vertexCount; vertex++) {+ if (!flags[vertex]) continue;+ const moved = groups[vertex].point;+ const changed = moved.some((value, axis) => Math.fround(value) !== positions[vertex * 3 + axis]);+ if (changed) movedVertices++;+ positions.set(moved, vertex * 3);+ }+ return { mesh: withPositions(mesh, positions), movedVertices };+}diff --git a/src/mesh-shrinkwrap.js b/src/mesh-shrinkwrap.jsnew file mode 100644index 00000000..4cc43be4--- /dev/null+++ b/src/mesh-shrinkwrap.js@@ -0,0 +1,57 @@+import { createMeshQueryIndex } from './mesh-query.js';+import { triangulatedSurface } from './mesh-surface-distance.js';+import { selectedVertices, withPositions } from './mesh-field-edits.js';+import { MAX_SHRINKWRAP_TRIANGLE_TESTS } from './mesh-operations.js';++// The shrinkwrap mesh edit, after Blender's Shrinkwrap modifier: the vertices of the selected faces move onto a target+// surface, either to the nearest point (mode "nearest") or along a direction (mode "project"), and stand `offset` off+// it along the surface normal. The target is a closed or open primitive in the mesh's local space, placed like a+// boolean cutter. The same BVH queries as the shrinkwrap addon do the work.++function findSurface(index, origin, { mode, direction, maxDistance }, remainingTests) {+ if (mode === 'project') return index.project({ origin, direction, maxDistance, maxTriangleTests: remainingTests });+ return index.nearest(origin, { maxDistance, maxTriangleTests: remainingTests });+}++// A projected vertex stands off on the side it came from, as in Blender, so a sheet projected from outside a closed+// target stays outside and one projected from inside stays inside. A nearest-point vertex stands off along the face normal.+function standOffSide(normal, { mode, direction }) {+ if (mode !== 'project') return 1;+ return normal[0] * direction[0] + normal[1] * direction[1] + normal[2] * direction[2] > 0 ? -1 : 1;+}++/**+ * Move the selected vertices onto `target` (MeshData in the same space as `mesh`). Returns the new mesh, how many+ * vertices moved and how many found no surface (kept in place when `onMiss` is "keep", an error otherwise).+ */+export function shrinkwrapMesh(mesh, target, edit) {+ const { select, offset, onMiss } = edit;+ const flags = selectedVertices(mesh, select);+ const surface = triangulatedSurface(target);+ const index = createMeshQueryIndex({ positions: new Float32Array(surface.positions), indices: surface.indices });+ const positions = new Float32Array(mesh.positions);+ let movedVertices = 0;+ let missedVertices = 0;+ let triangleTests = 0;+ try {+ for (let vertex = 0; vertex < mesh.vertexCount; vertex++) {+ if (!flags[vertex]) continue;+ const remainingTests = MAX_SHRINKWRAP_TRIANGLE_TESTS - triangleTests;+ if (remainingTests <= 0) throw new RangeError('Shrinkwrap searched too many triangles. Select fewer faces or use a simpler target.');+ const origin = Array.from(mesh.positions.subarray(vertex * 3, vertex * 3 + 3));+ const found = findSurface(index, origin, edit, remainingTests);+ triangleTests += found.triangleTests;+ if (!found.hit) {+ missedVertices++;+ if (onMiss === 'error') throw new RangeError(`Shrinkwrap found no surface for vertex ${vertex}. Raise maxDistance, change the direction, or set onMiss to keep.`);+ continue;+ }+ const side = standOffSide(found.hit.normal, edit);+ for (let axis = 0; axis < 3; axis++) positions[vertex * 3 + axis] = found.hit.point[axis] + found.hit.normal[axis] * side * offset;+ movedVertices++;+ }+ } finally {+ index.dispose();+ }+ return { mesh: withPositions(mesh, positions), movedVertices, missedVertices };+}diff --git a/src/sculpt-strokes.js b/src/sculpt-strokes.jsnew file mode 100644index 00000000..32d7ab8d--- /dev/null+++ b/src/sculpt-strokes.js@@ -0,0 +1,68 @@+// Brush strokes shared by sculptGeometry (triangle geometry) and the sculpt mesh edit (polygon meshes). A stroke moves+// groups of coincident vertices: each group has a point, a unit normal and, for smoothing, its neighbouring groups.++export function finite(value, name) {+ if (!Number.isFinite(value) || !Number.isFinite(Math.fround(value))) {+ throw new TypeError(`${name} must be a finite Float32 value.`);+ }+ return value;+}++function vector(input, name) {+ if ((!Array.isArray(input) && !ArrayBuffer.isView(input)) || input.length !== 3) {+ throw new TypeError(`${name} must contain three components.`);+ }+ return Array.from(input, value => finite(value, name));+}++export function prepareStrokes(strokes) {+ return strokes.map(stroke => {+ if (!['inflate', 'displace', 'smooth'].includes(stroke?.type)) {+ throw new TypeError('Sculpt stroke type must be inflate, displace or smooth.');+ }+ const center = vector(stroke.center, 'center');+ const radius = finite(stroke.radius, 'radius');+ const strength = finite(stroke.strength, 'strength');+ if (Math.fround(radius) <= 0) throw new RangeError('Brush radius must remain positive at Float32 precision.');+ if (stroke.type === 'smooth' && (strength < 0 || strength > 1)) {+ throw new RangeError('Smooth strength must be within zero and one.');+ }+ let direction;+ if (stroke.type === 'displace') {+ direction = vector(stroke.direction, 'direction');+ const length = Math.hypot(...direction);+ if (length === 0) throw new RangeError('Displace direction cannot be zero.');+ direction = direction.map(value => value / length);+ }+ return { type: stroke.type, center, radius, strength, direction };+ });+}++export function applyStroke(groups, stroke) {+ const next = stroke.type === 'smooth' ? groups.map(group => [...group.point]) : null;+ for (let index = 0; index < groups.length; index++) {+ const group = groups[index];+ const distance = Math.hypot(...group.point.map((value, axis) => value - stroke.center[axis]));+ if (distance >= stroke.radius || stroke.strength === 0) continue;+ const relative = distance / stroke.radius;+ // Quintic falloff has zero first and second derivatives at both ends.+ const falloff = 1 - relative ** 3 * (10 + relative * (-15 + 6 * relative));+ if (stroke.type === 'smooth') {+ if (!group.neighbors.size) continue;+ const mean = [0, 0, 0];+ for (const neighbor of group.neighbors) {+ for (let axis = 0; axis < 3; axis++) mean[axis] += groups[neighbor].point[axis] / group.neighbors.size;+ }+ for (let axis = 0; axis < 3; axis++) {+ next[index][axis] += (mean[axis] - group.point[axis]) * stroke.strength * falloff;+ }+ } else {+ const direction = stroke.type === 'inflate' ? group.normal : stroke.direction;+ for (let axis = 0; axis < 3; axis++) group.point[axis] += direction[axis] * stroke.strength * falloff;+ }+ }+ if (next) groups.forEach((group, index) => { group.point = next[index]; });+ for (const group of groups) {+ for (const value of group.point) finite(value, 'Sculpt result');+ }+}diff --git a/src/sculpt.js b/src/sculpt.jsindex 85ed7ea9..46ad7806 100644--- a/src/sculpt.js+++ b/src/sculpt.js@@ -1,18 +1,5 @@import { recomputeNormals } from './geometry-normals.js';--function finite(value, name) {- if (!Number.isFinite(value) || !Number.isFinite(Math.fround(value))) {- throw new TypeError(`${name} must be a finite Float32 value.`);- }- return value;-}--function vector(input, name) {- if ((!Array.isArray(input) && !ArrayBuffer.isView(input)) || input.length !== 3) {- throw new TypeError(`${name} must contain three components.`);- }- return Array.from(input, value => finite(value, name));-}+import { finite, prepareStrokes, applyStroke } from './sculpt-strokes.js';function limit(value, maximum, name) {if (!Number.isSafeInteger(value) || value < 1 || value > maximum) {@@ -54,28 +41,6 @@ function validateGeometry(geometry, maxVertices, maxTriangles) {return count;}-function prepareStrokes(strokes) {- return strokes.map(stroke => {- if (!['inflate', 'displace', 'smooth'].includes(stroke?.type)) {- throw new TypeError('Sculpt stroke type must be inflate, displace or smooth.');- }- const center = vector(stroke.center, 'center');- const radius = finite(stroke.radius, 'radius');- const strength = finite(stroke.strength, 'strength');- if (Math.fround(radius) <= 0) throw new RangeError('Brush radius must remain positive at Float32 precision.');- if (stroke.type === 'smooth' && (strength < 0 || strength > 1)) {- throw new RangeError('Smooth strength must be within zero and one.');- }- let direction;- if (stroke.type === 'displace') {- direction = vector(stroke.direction, 'direction');- const length = Math.hypot(...direction);- if (length === 0) throw new RangeError('Displace direction cannot be zero.');- direction = direction.map(value => value / length);- }- return { type: stroke.type, center, radius, strength, direction };- });-}function positionGroups(geometry, count, smooth) {const lookup = new Map();@@ -114,34 +79,6 @@ function positionGroups(geometry, count, smooth) {return { groups, groupIds };}-function applyStroke(groups, stroke) {- const next = stroke.type === 'smooth' ? groups.map(group => [...group.point]) : null;- for (let index = 0; index < groups.length; index++) {- const group = groups[index];- const distance = Math.hypot(...group.point.map((value, axis) => value - stroke.center[axis]));- if (distance >= stroke.radius || stroke.strength === 0) continue;- const relative = distance / stroke.radius;- // Quintic falloff has zero first and second derivatives at both ends.- const falloff = 1 - relative ** 3 * (10 + relative * (-15 + 6 * relative));- if (stroke.type === 'smooth') {- if (!group.neighbors.size) continue;- const mean = [0, 0, 0];- for (const neighbor of group.neighbors) {- for (let axis = 0; axis < 3; axis++) mean[axis] += groups[neighbor].point[axis] / group.neighbors.size;- }- for (let axis = 0; axis < 3; axis++) {- next[index][axis] += (mean[axis] - group.point[axis]) * stroke.strength * falloff;- }- } else {- const direction = stroke.type === 'inflate' ? group.normal : stroke.direction;- for (let axis = 0; axis < 3; axis++) group.point[axis] += direction[axis] * stroke.strength * falloff;- }- }- if (next) groups.forEach((group, index) => { group.point = next[index]; });- for (const group of groups) {- for (const value of group.point) finite(value, 'Sculpt result');- }-}function triangleArea(positions, indices, offset) {const first = indices[offset] * 3;diff --git a/tests/fixtures/blender/cases.json b/tests/fixtures/blender/cases.jsonindex ad9b4569..6406e695 100644--- a/tests/fixtures/blender/cases.json+++ b/tests/fixtures/blender/cases.json@@ -142,7 +142,11 @@{ "id": "cast-sphere-bumpy", "input": "sphere-bumpy", "edit": {"op":"cast","factor":0.5} },{ "id": "decimate-bowl-half", "input": "bowl-open", "compare": "surface", "edit": {"op":"decimate","ratio":0.5} },{ "id": "remesh-sphere", "input": "sphere-bumpy", "compare": "surface", "edit": {"op":"remesh","voxelSize":0.1} },- { "id": "remesh-torus", "input": "torus-fine", "compare": "surface", "edit": {"op":"remesh","voxelSize":0.08} }+ { "id": "remesh-torus", "input": "torus-fine", "compare": "surface", "edit": {"op":"remesh","voxelSize":0.08} },+ { "id": "sculpt-inflate-sphere", "input": "sphere-bumpy", "edit": {"op":"sculpt","strokes":[{"type":"inflate","center":[0.5,0,0.9],"radius":0.8,"strength":0.12}]} },+ { "id": "sculpt-displace-smooth-grid", "input": "grid", "edit": {"op":"sculpt","strokes":[{"type":"displace","center":[1.5,1.5,0],"radius":2,"strength":0.6,"direction":[0,0,1]},{"type":"smooth","center":[1.5,1.5,0.3],"radius":1.8,"strength":0.7}]} },+ { "id": "shrinkwrap-nearest-cylinder", "input": "grid", "edit": {"op":"shrinkwrap","target":{"type":"cylinder"},"translation":[1.5,1.5,-1.5]} },+ { "id": "shrinkwrap-project-cap-offset", "input": "grid", "edit": {"op":"shrinkwrap","target":{"type":"cylinder"},"translation":[1.5,1.5,0],"mode":"project","direction":[0,0,-1],"offset":0.05,"onMiss":"keep"} }],"curves": [{diff --git a/tests/fixtures/blender/golden.json b/tests/fixtures/blender/golden.jsonindex b98a95f1..4dfca5ae 100644--- a/tests/fixtures/blender/golden.json+++ b/tests/fixtures/blender/golden.json@@ -31115,6 +31115,3345 @@"volume": 2.302192,"area": 13.48201,"hausdorff": 0.012668+ },+ "sculpt-inflate-sphere": {+ "vertexCount": 610,+ "edgeCount": 1248,+ "faceCount": 640,+ "faceSizes": {+ "3": 64,+ "4": 576+ },+ "volume": 4.234462,+ "area": 13.802393,+ "positions": [+ [+ -1.01605,+ -0.20211,+ 0.16408+ ],+ [+ -1.01605,+ 0.20211,+ -0.16408+ ],+ [+ -1.00654,+ -0.20021,+ 0.33345+ ],+ [+ -1.00654,+ 0.20021,+ -0.33345+ ],+ [+ -1.0,+ 0.0,+ 0.0+ ],+ [+ -0.98769,+ 0.0,+ -0.15643+ ],+ [+ -0.98769,+ 0.0,+ 0.15643+ ],+ [+ -0.98079,+ -0.19509,+ 0.0+ ],+ [+ -0.98079,+ 0.19509,+ 0.0+ ],+ [+ -0.96206,+ -0.3985,+ 0.16493+ ],+ [+ -0.96206,+ 0.3985,+ -0.16493+ ],+ [+ -0.95587,+ -0.39593,+ 0.33617+ ],+ [+ -0.95587,+ 0.39593,+ -0.33617+ ],+ [+ -0.95106,+ 0.0,+ -0.30902+ ],+ [+ -0.95106,+ 0.0,+ 0.30902+ ],+ [+ -0.94299,+ -0.18757,+ 0.48989+ ],+ [+ -0.94299,+ 0.18757,+ -0.48989+ ],+ [+ -0.92388,+ -0.38268,+ 0.0+ ],+ [+ -0.92388,+ 0.38268,+ 0.0+ ],+ [+ -0.92137,+ -0.18327,+ -0.14879+ ],+ [+ -0.92137,+ 0.18327,+ 0.14879+ ],+ [+ -0.89551,+ -0.37093,+ 0.49388+ ],+ [+ -0.89551,+ 0.37093,+ -0.49388+ ],+ [+ -0.89101,+ 0.0,+ -0.45399+ ],+ [+ -0.89101,+ 0.0,+ 0.45399+ ],+ [+ -0.86295,+ -0.35745,+ -0.14794+ ],+ [+ -0.86295,+ 0.35745,+ 0.14794+ ],+ [+ -0.85902,+ -0.17087,+ -0.28458+ ],+ [+ -0.85902,+ 0.17087,+ 0.28458+ ],+ [+ -0.83225,+ -0.16555,+ 0.61651+ ],+ [+ -0.83225,+ 0.16555,+ -0.61651+ ],+ [+ -0.83147,+ -0.55557,+ 0.0+ ],+ [+ -0.83147,+ 0.55557,+ 0.0+ ],+ [+ -0.83065,+ -0.55502,+ 0.15823+ ],+ [+ -0.83065,+ 0.55502,+ -0.15823+ ],+ [+ -0.81182,+ -0.54244,+ -0.15464+ ],+ [+ -0.81182,+ 0.54244,+ 0.15464+ ],+ [+ -0.80902,+ 0.0,+ -0.58779+ ],+ [+ -0.80902,+ 0.0,+ 0.58779+ ],+ [+ -0.80545,+ -0.53818,+ 0.31475+ ],+ [+ -0.80545,+ 0.53818,+ -0.31475+ ],+ [+ -0.80478,+ -0.16008,+ -0.41809+ ],+ [+ -0.80478,+ 0.16008,+ 0.41809+ ],+ [+ -0.80146,+ -0.33197,+ -0.28186+ ],+ [+ -0.80146,+ 0.33197,+ 0.28186+ ],+ [+ -0.78802,+ -0.32641,+ 0.6197+ ],+ [+ -0.78802,+ 0.32641,+ -0.6197+ ],+ [+ -0.7761,+ -0.51858,+ -0.30328+ ],+ [+ -0.7761,+ 0.51858,+ 0.30328+ ],+ [+ -0.75469,+ -0.15012,+ -0.55906+ ],+ [+ -0.75469,+ 0.15012,+ 0.55906+ ],+ [+ -0.75459,+ -0.5042,+ 0.46241+ ],+ [+ -0.75459,+ 0.5042,+ -0.46241+ ],+ [+ -0.75085,+ -0.31101,+ -0.4141+ ],+ [+ -0.75085,+ 0.31101,+ 0.4141+ ],+ [+ -0.72743,+ -0.72743,+ -0.16294+ ],+ [+ -0.72743,+ 0.72743,+ 0.16294+ ],+ [+ -0.7271,+ -0.48583,+ -0.44557+ ],+ [+ -0.7271,+ 0.48583,+ 0.44557+ ],+ [+ -0.71772,+ -0.71772,+ -0.3298+ ],+ [+ -0.71772,+ 0.71772,+ 0.3298+ ],+ [+ -0.70711,+ -0.70711,+ 0.0+ ],+ [+ -0.70711,+ 0.0,+ -0.70711+ ],+ [+ -0.70711,+ 0.0,+ 0.70711+ ],+ [+ -0.70711,+ 0.70711,+ 0.0+ ],+ [+ -0.70685,+ -0.29278,+ -0.55587+ ],+ [+ -0.70685,+ 0.29278,+ 0.55587+ ],+ [+ -0.69352,+ -0.13795,+ -0.70711+ ],+ [+ -0.69352,+ -0.13795,+ 0.70711+ ],+ [+ -0.69352,+ 0.13795,+ -0.70711+ ],+ [+ -0.69352,+ 0.13795,+ 0.70711+ ],+ [+ -0.68039,+ -0.45462,+ 0.59453+ ],+ [+ -0.68039,+ 0.45462,+ -0.59453+ ],+ [+ -0.67241,+ -0.67241,+ -0.48452+ ],+ [+ -0.67241,+ 0.67241,+ 0.48452+ ],+ [+ -0.66937,+ -0.66937,+ 0.14993+ ],+ [+ -0.66937,+ 0.66937,+ -0.14993+ ],+ [+ -0.66496,+ -0.44431,+ -0.58105+ ],+ [+ -0.66496,+ 0.44431,+ 0.58105+ ],+ [+ -0.65328,+ -0.2706,+ -0.70711+ ],+ [+ -0.65328,+ -0.2706,+ 0.70711+ ],+ [+ -0.65328,+ 0.2706,+ -0.70711+ ],+ [+ -0.65328,+ 0.2706,+ 0.70711+ ],+ [+ -0.62727,+ -0.62727,+ 0.28824+ ],+ [+ -0.62727,+ 0.62727,+ -0.28824+ ],+ [+ -0.60467,+ -0.12028,+ -0.84856+ ],+ [+ -0.60467,+ 0.12028,+ 0.84856+ ],+ [+ -0.59584,+ -0.59584,+ -0.61222+ ],+ [+ -0.59584,+ 0.59584,+ 0.61222+ ],+ [+ -0.58794,+ -0.39285,+ -0.70711+ ],+ [+ -0.58794,+ -0.39285,+ 0.70711+ ],+ [+ -0.58794,+ 0.39285,+ -0.70711+ ],+ [+ -0.58794,+ 0.39285,+ 0.70711+ ],+ [+ -0.58779,+ 0.0,+ -0.80902+ ],+ [+ -0.58779,+ 0.0,+ 0.80902+ ],+ [+ -0.58767,+ -0.58767,+ 0.42346+ ],+ [+ -0.58767,+ 0.58767,+ -0.42346+ ],+ [+ -0.58036,+ -0.86858,+ -0.16545+ ],+ [+ -0.58036,+ 0.86858,+ 0.16545+ ],+ [+ -0.57766,+ -0.86454,+ -0.33784+ ],+ [+ -0.57766,+ 0.86454,+ 0.33784+ ],+ [+ -0.57253,+ -0.23715,+ -0.85295+ ],+ [+ -0.57253,+ 0.23715,+ 0.85295+ ],+ [+ -0.55557,+ -0.83147,+ 0.0+ ],+ [+ -0.55557,+ 0.83147,+ 0.0+ ],+ [+ -0.54832,+ -0.10907,+ 0.76948+ ],+ [+ -0.54832,+ 0.10907,+ -0.76948+ ],+ [+ -0.54828,+ -0.54828,+ 0.56336+ ],+ [+ -0.54828,+ 0.54828,+ -0.56336+ ],+ [+ -0.54119,+ -0.80995,+ -0.49634+ ],+ [+ -0.54119,+ 0.80995,+ 0.49634+ ],+ [+ -0.5171,+ -0.77389,+ 0.14742+ ],+ [+ -0.5171,+ 0.77389,+ -0.14742+ ],+ [+ -0.51355,+ -0.21272,+ 0.76508+ ],+ [+ -0.51355,+ 0.21272,+ -0.76508+ ],+ [+ -0.5,+ -0.5,+ -0.70711+ ],+ [+ -0.5,+ -0.5,+ 0.70711+ ],+ [+ -0.5,+ 0.5,+ -0.70711+ ],+ [+ -0.5,+ 0.5,+ 0.70711+ ],+ [+ -0.49433,+ -0.3303,+ -0.81829+ ],+ [+ -0.49433,+ 0.3303,+ 0.81829+ ],+ [+ -0.48312,+ -0.32281,+ 0.79974+ ],+ [+ -0.48312,+ 0.32281,+ -0.79974+ ],+ [+ -0.48048,+ -0.09557,+ -0.96147+ ],+ [+ -0.48048,+ 0.09557,+ 0.96147+ ],+ [+ -0.47909,+ -0.71701,+ 0.28019+ ],+ [+ -0.47909,+ 0.71701,+ -0.28019+ ],+ [+ -0.47538,+ -0.71145,+ -0.62167+ ],+ [+ -0.47538,+ 0.71145,+ 0.62167+ ],+ [+ -0.45629,+ -0.189,+ -0.9693+ ],+ [+ -0.45629,+ 0.189,+ 0.9693+ ],+ [+ -0.45399,+ 0.0,+ -0.89101+ ],+ [+ -0.45399,+ 0.0,+ 0.89101+ ],+ [+ -0.44884,+ -0.67174,+ 0.41164+ ],+ [+ -0.44884,+ 0.67174,+ -0.41164+ ],+ [+ -0.4329,+ -0.4329,+ 0.84264+ ],+ [+ -0.4329,+ 0.4329,+ -0.84264+ ],+ [+ -0.42355,+ -0.63389,+ 0.5539+ ],+ [+ -0.42355,+ 0.63389,+ -0.5539+ ],+ [+ -0.41006,+ -0.08157,+ 0.82055+ ],+ [+ -0.41006,+ 0.08157,+ -0.82055+ ],+ [+ -0.39835,+ -0.39835,+ -0.77539+ ],+ [+ -0.39835,+ 0.39835,+ 0.77539+ ],+ [+ -0.39285,+ -0.58794,+ -0.70711+ ],+ [+ -0.39285,+ -0.58794,+ 0.70711+ ],+ [+ -0.39285,+ 0.58794,+ -0.70711+ ],+ [+ -0.39285,+ 0.58794,+ 0.70711+ ],+ [+ -0.38647,+ -0.93303,+ -0.15995+ ],+ [+ -0.38647,+ 0.93303,+ 0.15995+ ],+ [+ -0.38448,+ -0.2569,+ -0.90754+ ],+ [+ -0.38448,+ 0.2569,+ 0.90754+ ],+ [+ -0.38268,+ -0.92388,+ 0.0+ ],+ [+ -0.38268,+ 0.92388,+ 0.0+ ],+ [+ -0.38258,+ -0.15847,+ 0.81272+ ],+ [+ -0.38258,+ 0.15847,+ -0.81272+ ],+ [+ -0.3772,+ -0.91064,+ -0.32026+ ],+ [+ -0.3772,+ 0.91064,+ 0.32026+ ],+ [+ -0.37048,+ -0.24754,+ 0.87447+ ],+ [+ -0.37048,+ 0.24754,+ -0.87447+ ],+ [+ -0.36947,+ -0.89198,+ 0.15292+ ],+ [+ -0.36947,+ 0.89198,+ -0.15292+ ],+ [+ -0.35338,+ -0.85314,+ -0.47051+ ],+ [+ -0.35338,+ 0.85314,+ 0.47051+ ],+ [+ -0.35071,+ -0.84668,+ 0.29777+ ],+ [+ -0.35071,+ 0.84668,+ -0.29777+ ],+ [+ -0.34538,+ -0.5169,+ 0.85566+ ],+ [+ -0.34538,+ 0.5169,+ -0.85566+ ],+ [+ -0.34261,+ -0.34261,+ 0.95093+ ],+ [+ -0.34261,+ 0.34261,+ -0.95093+ ],+ [+ -0.32856,+ -0.79322,+ 0.43747+ ],+ [+ -0.32856,+ 0.79322,+ -0.43747+ ],+ [+ -0.32705,+ -0.06505,+ -1.02626+ ],+ [+ -0.32705,+ 0.06505,+ 1.02626+ ],+ [+ -0.31656,+ -0.76425,+ -0.60101+ ],+ [+ -0.31656,+ 0.76425,+ 0.60101+ ],+ [+ -0.31058,+ -0.12865,+ -1.03462+ ],+ [+ -0.31058,+ 0.12865,+ 1.03462+ ],+ [+ -0.30902,+ 0.0,+ -0.95106+ ],+ [+ -0.30902,+ 0.0,+ 0.95106+ ],+ [+ -0.30773,+ -0.46055,+ -0.76238+ ],+ [+ -0.30773,+ 0.46055,+ 0.76238+ ],+ [+ -0.30263,+ -0.73062,+ 0.57456+ ],+ [+ -0.30263,+ 0.73062,+ -0.57456+ ],+ [+ -0.29943,+ -0.29943,+ -0.83109+ ],+ [+ -0.29943,+ 0.29943,+ 0.83109+ ],+ [+ -0.27911,+ -0.05553,+ 0.87586+ ],+ [+ -0.27911,+ 0.05552,+ -0.87585+ ],+ [+ -0.27575,+ -0.41269,+ 0.97412+ ],+ [+ -0.27575,+ 0.41269,+ -0.97412+ ],+ [+ -0.2706,+ -0.65328,+ -0.70711+ ],+ [+ -0.2706,+ -0.65328,+ 0.70711+ ],+ [+ -0.2706,+ 0.65328,+ -0.70711+ ],+ [+ -0.2706,+ 0.65328,+ 0.70711+ ],+ [+ -0.26171,+ -0.17487,+ -0.9687+ ],+ [+ -0.26171,+ 0.17488,+ 0.96871+ ],+ [+ -0.26044,+ -0.10786,+ 0.86755+ ],+ [+ -0.26041,+ 0.10787,+ -0.86749+ ],+ [+ -0.2522,+ -0.16847,+ 0.93344+ ],+ [+ -0.25217,+ 0.1685,+ -0.93341+ ],+ [+ -0.23321,+ -0.23319,+ 1.01503+ ],+ [+ -0.2332,+ 0.2332,+ -1.01501+ ],+ [+ -0.23,+ -0.55526,+ 0.82721+ ],+ [+ -0.23,+ 0.55526,+ -0.82721+ ],+ [+ -0.2287,+ -0.34227,+ -0.8079+ ],+ [+ -0.2287,+ 0.34227,+ 0.8079+ ],+ [+ -0.21988,+ -0.53083,+ -0.79082+ ],+ [+ -0.21988,+ 0.53083,+ 0.79082+ ],+ [+ -0.20381,+ -0.20381,+ -0.8871+ ],+ [+ -0.20368,+ 0.20422,+ 0.88755+ ],+ [+ -0.19898,+ -1.00034,+ 0.16154+ ],+ [+ -0.19898,+ 1.00034,+ -0.16154+ ],+ [+ -0.19535,+ -0.98207,+ 0.32534+ ],+ [+ -0.19535,+ 0.98207,+ -0.32534+ ],+ [+ -0.19509,+ -0.98079,+ 0.0+ ],+ [+ -0.19509,+ 0.98079,+ 0.0+ ],+ [+ -0.18769,+ -0.28095,+ 1.03995+ ],+ [+ -0.18769,+ 0.2809,+ -1.03977+ ],+ [+ -0.1864,+ -0.93708,+ -0.15133+ ],+ [+ -0.1864,+ 0.93708,+ 0.15133+ ],+ [+ -0.18301,+ -0.92006,+ 0.47798+ ],+ [+ -0.18301,+ 0.92006,+ -0.47798+ ],+ [+ -0.18006,+ -0.4347,+ 0.92344+ ],+ [+ -0.18006,+ 0.4347,+ -0.92344+ ],+ [+ -0.17574,+ -0.8835,+ -0.29269+ ],+ [+ -0.17574,+ 0.8835,+ 0.29269+ ],+ [+ -0.16742,+ 0.40417,+ 0.85859+ ],+ [+ -0.16741,+ -0.40417,+ -0.85858+ ],+ [+ -0.16464,+ -0.82771,+ -0.43+ ],+ [+ -0.16464,+ 0.82771,+ 0.43+ ],+ [+ -0.16299,+ -0.81938,+ 0.60698+ ],+ [+ -0.16299,+ 0.81938,+ -0.60698+ ],+ [+ -0.16107,+ 0.03019,+ 1.03898+ ],+ [+ -0.16093,+ -0.03201,+ -1.03596+ ],+ [+ -0.15686,+ -0.00386,+ 0.99024+ ],+ [+ -0.15647,+ 0.23355,+ 0.86419+ ],+ [+ -0.15643,+ 0.0,+ -0.98769+ ],+ [+ -0.15567,+ -0.23297,+ -0.86234+ ],+ [+ -0.15268,+ -0.76756,+ -0.56859+ ],+ [+ -0.15268,+ 0.76756,+ 0.56859+ ],+ [+ -0.15238,+ -0.06312,+ -1.04132+ ],+ [+ -0.15154,+ 0.06425,+ 1.04499+ ],+ [+ -0.14731,+ -0.03273,+ 0.94405+ ],+ [+ -0.14593,+ 0.02903,+ -0.93942+ ],+ [+ -0.14026,+ -0.05529,+ 0.93985+ ],+ [+ -0.13795,+ -0.69352,+ -0.70711+ ],+ [+ -0.13795,+ -0.69352,+ 0.70711+ ],+ [+ -0.13795,+ 0.69352,+ -0.70711+ ],+ [+ -0.13795,+ 0.69352,+ 0.70711+ ],+ [+ -0.13668,+ 0.05661,+ -0.93405+ ],+ [+ -0.13257,+ -0.08154,+ 0.98022+ ],+ [+ -0.13156,+ -0.08791,+ -0.99901+ ],+ [+ -0.129,+ 0.09246,+ 1.00264+ ],+ [+ -0.12858,+ 0.08591,+ -0.97636+ ],+ [+ -0.12256,+ 0.29589,+ -0.98567+ ],+ [+ -0.12124,+ -0.29691,+ 0.98715+ ],+ [+ -0.11842,+ -0.59532,+ -0.83544+ ],+ [+ -0.11842,+ 0.59532,+ 0.83544+ ],+ [+ -0.11828,+ -0.11183,+ 1.03413+ ],+ [+ -0.11687,+ 0.27488,+ 0.91876+ ],+ [+ -0.11521,+ 0.11521,+ -1.02874+ ],+ [+ -0.11395,+ -0.2751,+ -0.91644+ ],+ [+ -0.11093,+ -0.55767,+ 0.7826+ ],+ [+ -0.11093,+ 0.55767,+ -0.7826+ ],+ [+ -0.10602,+ -0.10602,+ -0.94664+ ],+ [+ -0.10314,+ 0.11271,+ 0.95333+ ],+ [+ -0.09335,+ 0.46884,+ 0.93822+ ],+ [+ -0.09325,+ -0.46879,+ -0.93809+ ],+ [+ -0.09192,+ 0.13757,+ -1.04463+ ],+ [+ -0.09014,+ -0.13765,+ 1.05329+ ],+ [+ -0.08714,+ 0.12609,+ 0.94228+ ],+ [+ -0.08389,+ 0.42174,+ -0.84393+ ],+ [+ -0.08344,+ -0.42216,+ 0.84464+ ],+ [+ -0.0819,+ -0.12257,+ -0.93075+ ],+ [+ -0.07133,+ 0.1388,+ 0.97442+ ],+ [+ -0.06713,+ 0.3194,+ 1.00514+ ],+ [+ -0.06347,+ -0.31909,+ -1.00131+ ],+ [+ -0.06121,+ 0.14778,+ -1.0099+ ],+ [+ -0.05852,+ -0.14128,+ -0.96547+ ],+ [+ -0.0571,+ 0.28707,+ -0.9008+ ],+ [+ -0.05169,+ -0.29057,+ 0.90647+ ],+ [+ -0.05122,+ -0.1524,+ 1.01846+ ],+ [+ -0.04457,+ 0.15587,+ 1.03224+ ],+ [+ -0.03152,+ -0.15844,+ -1.01994+ ],+ [+ -0.02952,+ 0.14842,+ -0.95543+ ],+ [+ -0.01462,+ -0.15595,+ 0.96823+ ],+ [+ 0.0,+ -1.04574,+ 0.16563+ ],+ [+ 0.0,+ -1.04151,+ 0.33841+ ],+ [+ 0.0,+ -1.0,+ 0.0+ ],+ [+ 0.0,+ -0.97575,+ 0.49717+ ],+ [+ 0.0,+ -0.92963,+ -0.14724+ ],+ [+ 0.0,+ -0.86061,+ -0.27963+ ],+ [+ 0.0,+ -0.85657,+ 0.62233+ ],+ [+ 0.0,+ -0.80627,+ -0.41081+ ],+ [+ 0.0,+ -0.76146,+ -0.55324+ ],+ [+ 0.0,+ -0.70711,+ -0.70711+ ],+ [+ 0.0,+ -0.70711,+ 0.70711+ ],+ [+ 0.0,+ -0.62233,+ -0.85657+ ],+ [+ -0.0,+ -0.5533,+ 0.7616+ ],+ [+ 0.0,+ -0.49717,+ -0.97575+ ],+ [+ -0.0,+ -0.41303,+ 0.81126+ ],+ [+ 0.0,+ -0.33841,+ -1.04151+ ],+ [+ 0.0,+ -0.28723,+ 0.87564+ ],+ [+ 0.0,+ -0.16563,+ -1.04574+ ],+ [+ 0.0,+ -0.15992,+ 0.9543+ ],+ [+ 0.0,+ 0.0,+ -1.0+ ],+ [+ 0.0,+ -0.0,+ 1.03061+ ],+ [+ 0.0,+ 0.14724,+ -0.92963+ ],+ [+ 0.0,+ 0.16319,+ 1.06794+ ],+ [+ 0.0,+ 0.27963,+ -0.86061+ ],+ [+ 0.0,+ 0.34024,+ 1.05079+ ],+ [+ 0.0,+ 0.41081,+ -0.80627+ ],+ [+ -0.0,+ 0.49791,+ 0.97702+ ],+ [+ 0.0,+ 0.55324,+ -0.76146+ ],+ [+ 0.0,+ 0.62233,+ 0.85657+ ],+ [+ 0.0,+ 0.70711,+ -0.70711+ ],+ [+ 0.0,+ 0.70711,+ 0.70711+ ],+ [+ 0.0,+ 0.76146,+ 0.55324+ ],+ [+ 0.0,+ 0.80627,+ 0.41081+ ],+ [+ 0.0,+ 0.85657,+ -0.62233+ ],+ [+ 0.0,+ 0.86061,+ 0.27963+ ],+ [+ 0.0,+ 0.92963,+ 0.14724+ ],+ [+ 0.0,+ 0.97575,+ -0.49717+ ],+ [+ 0.0,+ 1.0,+ 0.0+ ],+ [+ 0.0,+ 1.04151,+ -0.33841+ ],+ [+ 0.0,+ 1.04574,+ -0.16563+ ],+ [+ 0.0055,+ -0.16055,+ 0.97606+ ],+ [+ 0.02952,+ 0.14842,+ -0.95543+ ],+ [+ 0.03152,+ -0.15844,+ -1.01994+ ],+ [+ 0.03316,+ -0.16077,+ 1.03395+ ],+ [+ 0.04044,+ -0.29784,+ 0.91826+ ],+ [+ 0.05375,+ 0.15406,+ 1.04089+ ],+ [+ 0.0571,+ 0.28707,+ -0.9008+ ],+ [+ 0.05852,+ -0.14128,+ -0.96547+ ],+ [+ 0.06121,+ 0.14778,+ -1.0099+ ],+ [+ 0.06347,+ -0.31909,+ -1.00131+ ],+ [+ 0.07763,+ -0.42769,+ 0.85392+ ],+ [+ 0.07835,+ 0.32037,+ 1.01688+ ],+ [+ 0.0819,+ -0.12257,+ -0.93075+ ],+ [+ 0.08287,+ -0.13799,+ 1.08863+ ],+ [+ 0.08389,+ 0.42174,+ -0.84393+ ],+ [+ 0.08941,+ 0.14457,+ 0.98521+ ],+ [+ 0.09188,+ 0.13482,+ 0.98878+ ],+ [+ 0.09192,+ 0.13757,+ -1.04463+ ],+ [+ 0.09325,+ -0.46879,+ -0.93809+ ],+ [+ 0.09875,+ 0.47172,+ 0.94489+ ],+ [+ 0.10108,+ -0.31239,+ 1.00975+ ],+ [+ 0.10173,+ 0.13587,+ 0.97436+ ],+ [+ 0.10602,+ -0.10602,+ -0.94664+ ],+ [+ 0.10642,+ 0.13252,+ 1.03464+ ],+ [+ 0.11042,+ -0.55895,+ 0.78469+ ],+ [+ 0.11093,+ 0.55767,+ -0.7826+ ],+ [+ 0.11395,+ -0.2751,+ -0.91644+ ],+ [+ 0.11521,+ 0.11521,+ -1.02874+ ],+ [+ 0.11842,+ -0.59532,+ -0.83544+ ],+ [+ 0.11901,+ 0.59617,+ 0.83643+ ],+ [+ 0.12256,+ 0.29589,+ -0.98567+ ],+ [+ 0.12858,+ 0.08591,+ -0.97636+ ],+ [+ 0.13156,+ -0.08791,+ -0.99901+ ],+ [+ 0.13668,+ 0.05661,+ -0.93405+ ],+ [+ 0.13795,+ -0.69352,+ -0.70711+ ],+ [+ 0.13795,+ -0.69352,+ 0.70711+ ],+ [+ 0.13795,+ 0.69352,+ -0.70711+ ],+ [+ 0.13795,+ 0.69352,+ 0.70711+ ],+ [+ 0.13832,+ 0.08197,+ 1.10242+ ],+ [+ 0.1386,+ -0.08944,+ 1.06988+ ],+ [+ 0.14487,+ 0.27278,+ 0.94103+ ],+ [+ 0.14593,+ 0.02903,+ -0.93942+ ],+ [+ 0.15238,+ -0.06312,+ -1.04132+ ],+ [+ 0.15268,+ -0.76756,+ -0.56859+ ],+ [+ 0.15268,+ 0.76756,+ 0.56859+ ],+ [+ 0.15567,+ -0.23297,+ -0.86234+ ],+ [+ 0.15643,+ 0.0,+ -0.98769+ ],+ [+ 0.16093,+ -0.03201,+ -1.03596+ ],+ [+ 0.1622,+ -0.07273,+ 0.99412+ ],+ [+ 0.16299,+ -0.81938,+ 0.60698+ ],+ [+ 0.16299,+ 0.81938,+ -0.60698+ ],+ [+ 0.16318,+ -0.06036,+ 1.02758+ ],+ [+ 0.16361,+ -0.00374,+ 1.09529+ ],+ [+ 0.16425,+ -0.04688,+ 1.01089+ ],+ [+ 0.16464,+ -0.82771,+ -0.43+ ],+ [+ 0.16464,+ 0.82771,+ 0.43+ ],+ [+ 0.16741,+ -0.40417,+ -0.85858+ ],+ [+ 0.17111,+ -0.44875,+ 0.94026+ ],+ [+ 0.17207,+ -0.04352,+ 0.99135+ ],+ [+ 0.17574,+ -0.8835,+ -0.29269+ ],+ [+ 0.17574,+ 0.8835,+ 0.29269+ ],+ [+ 0.17675,+ 0.24814,+ 0.91094+ ],+ [+ 0.18006,+ 0.4347,+ -0.92344+ ],+ [+ 0.18301,+ -0.92006,+ 0.47798+ ],+ [+ 0.18301,+ 0.92006,+ -0.47798+ ],+ [+ 0.18595,+ 0.40665,+ 0.87812+ ],+ [+ 0.1864,+ -0.93708,+ -0.15133+ ],+ [+ 0.1864,+ 0.93708,+ 0.15133+ ],+ [+ 0.18667,+ -0.29277,+ 1.08635+ ],+ [+ 0.18769,+ 0.2809,+ -1.03977+ ],+ [+ 0.18883,+ 0.25094,+ 0.93837+ ],+ [+ 0.19509,+ -0.98079,+ 0.0+ ],+ [+ 0.19509,+ 0.98079,+ 0.0+ ],+ [+ 0.19535,+ -0.98207,+ 0.32534+ ],+ [+ 0.19535,+ 0.98207,+ -0.32534+ ],+ [+ 0.19898,+ -1.00034,+ 0.16154+ ],+ [+ 0.19898,+ 1.00034,+ -0.16154+ ],+ [+ 0.20381,+ -0.20381,+ -0.8871+ ],+ [+ 0.21988,+ -0.53083,+ -0.79082+ ],+ [+ 0.22523,+ 0.53439,+ 0.79961+ ],+ [+ 0.2287,+ -0.34227,+ -0.8079+ ],+ [+ 0.22949,+ -0.56174,+ 0.83377+ ],+ [+ 0.23,+ 0.55526,+ -0.82721+ ],+ [+ 0.2332,+ 0.2332,+ -1.01501+ ],+ [+ 0.23979,+ 0.23841,+ 1.02254+ ],+ [+ 0.24442,+ 0.35453,+ 0.85055+ ],+ [+ 0.25217,+ 0.1685,+ -0.93341+ ],+ [+ 0.26041,+ 0.10787,+ -0.86749+ ],+ [+ 0.26171,+ -0.17487,+ -0.9687+ ],+ [+ 0.27007,+ -0.21482,+ 1.06873+ ],+ [+ 0.2706,+ -0.65328,+ -0.70711+ ],+ [+ 0.2706,+ 0.65328,+ -0.70711+ ],+ [+ 0.27085,+ 0.65391,+ 0.70794+ ],+ [+ 0.27093,+ -0.65405,+ 0.70778+ ],+ [+ 0.27575,+ 0.41269,+ -0.97412+ ],+ [+ 0.27911,+ 0.05552,+ -0.87585+ ],+ [+ 0.28269,+ -0.43175,+ 1.00774+ ],+ [+ 0.29344,+ 0.3406,+ 0.88646+ ],+ [+ 0.29943,+ -0.29943,+ -0.83109+ ],+ [+ 0.30263,+ -0.73062,+ 0.57456+ ],+ [+ 0.30263,+ 0.73062,+ -0.57456+ ],+ [+ 0.30503,+ -0.12403,+ 0.98563+ ],+ [+ 0.30628,+ -0.11243,+ 0.95672+ ],+ [+ 0.30773,+ -0.46055,+ -0.76238+ ],+ [+ 0.30888,+ -0.09352,+ 0.9482+ ],+ [+ 0.30902,+ 0.0,+ -0.95106+ ],+ [+ 0.31058,+ -0.12865,+ -1.03462+ ],+ [+ 0.31588,+ 0.46897,+ 0.78864+ ],+ [+ 0.31633,+ 0.16293,+ 1.12308+ ],+ [+ 0.31656,+ -0.76425,+ -0.60101+ ],+ [+ 0.31656,+ 0.76425,+ 0.60101+ ],+ [+ 0.32705,+ -0.06505,+ -1.02626+ ],+ [+ 0.32856,+ -0.79322,+ 0.43747+ ],+ [+ 0.32856,+ 0.79322,+ -0.43747+ ],+ [+ 0.3314,+ -0.08301,+ 1.01632+ ],+ [+ 0.34261,+ 0.34261,+ -0.95093+ ],+ [+ 0.34538,+ 0.5169,+ -0.85566+ ],+ [+ 0.35071,+ -0.84668,+ 0.29777+ ],+ [+ 0.35071,+ 0.84668,+ -0.29777+ ],+ [+ 0.35338,+ -0.85314,+ -0.47051+ ],+ [+ 0.35338,+ 0.85314,+ 0.47051+ ],+ [+ 0.35369,+ -0.53222,+ 0.87132+ ],+ [+ 0.35595,+ 0.02265,+ 1.11617+ ],+ [+ 0.36947,+ -0.89198,+ 0.15292+ ],+ [+ 0.36947,+ 0.89198,+ -0.15292+ ],+ [+ 0.37048,+ 0.24754,+ -0.87447+ ],+ [+ 0.3772,+ -0.91064,+ -0.32026+ ],+ [+ 0.3772,+ 0.91064,+ 0.32026+ ],+ [+ 0.38252,+ 0.32259,+ 0.97101+ ],+ [+ 0.38258,+ 0.15847,+ -0.81272+ ],+ [+ 0.38268,+ -0.92388,+ 0.0+ ],+ [+ 0.38268,+ 0.92388,+ 0.0+ ],+ [+ 0.38435,+ -0.34282,+ 1.00139+ ],+ [+ 0.38448,+ -0.2569,+ -0.90754+ ],+ [+ 0.38647,+ -0.93303,+ -0.15995+ ],+ [+ 0.38647,+ 0.93303,+ 0.15995+ ],+ [+ 0.39285,+ -0.58794,+ -0.70711+ ],+ [+ 0.39285,+ 0.58794,+ -0.70711+ ],+ [+ 0.39514,+ 0.59138,+ 0.71444+ ],+ [+ 0.39695,+ -0.59406,+ 0.71118+ ],+ [+ 0.39835,+ -0.39835,+ -0.77539+ ],+ [+ 0.4049,+ 0.42382,+ 0.81991+ ],+ [+ 0.41006,+ 0.08157,+ -0.82055+ ],+ [+ 0.42355,+ 0.63389,+ -0.5539+ ],+ [+ 0.42401,+ -0.63449,+ 0.55421+ ],+ [+ 0.42893,+ -0.21814,+ 0.93865+ ],+ [+ 0.43101,+ -0.1486,+ 0.90532+ ],+ [+ 0.4329,+ 0.4329,+ -0.84264+ ],+ [+ 0.44358,+ -0.13303,+ 0.91736+ ],+ [+ 0.44884,+ -0.67174,+ 0.41164+ ],+ [+ 0.44884,+ 0.67174,+ -0.41164+ ],+ [+ 0.45399,+ 0.0,+ -0.89101+ ],+ [+ 0.45629,+ -0.189,+ -0.9693+ ],+ [+ 0.46479,+ -0.44803,+ 0.87565+ ],+ [+ 0.47538,+ -0.71145,+ -0.62167+ ],+ [+ 0.47541,+ 0.71151,+ 0.62174+ ],+ [+ 0.47909,+ -0.71701,+ 0.28019+ ],+ [+ 0.47909,+ 0.71701,+ -0.28019+ ],+ [+ 0.48048,+ -0.09557,+ -0.96147+ ],+ [+ 0.48312,+ 0.32281,+ -0.79974+ ],+ [+ 0.49433,+ -0.3303,+ -0.81829+ ],+ [+ 0.49482,+ 0.23295,+ 1.05846+ ],+ [+ 0.49759,+ -0.0748,+ 0.97378+ ],+ [+ 0.5,+ -0.5,+ -0.70711+ ],+ [+ 0.5,+ 0.5,+ -0.70711+ ],+ [+ 0.50971,+ 0.50962,+ 0.72758+ ],+ [+ 0.51355,+ 0.21272,+ -0.76508+ ],+ [+ 0.51448,+ -0.5146,+ 0.72063+ ],+ [+ 0.5171,+ -0.77389,+ 0.14742+ ],+ [+ 0.5171,+ 0.77389,+ -0.14742+ ],+ [+ 0.51759,+ 0.37711,+ 0.87421+ ],+ [+ 0.53133,+ -0.32309,+ 0.85984+ ],+ [+ 0.54119,+ -0.80995,+ -0.49634+ ],+ [+ 0.54119,+ 0.80995,+ 0.49634+ ],+ [+ 0.54312,+ 0.06583,+ 1.05588+ ],+ [+ 0.54828,+ 0.54828,+ -0.56336+ ],+ [+ 0.54832,+ 0.10907,+ -0.76948+ ],+ [+ 0.55136,+ -0.55314,+ 0.56608+ ],+ [+ 0.55557,+ -0.83147,+ 0.0+ ],+ [+ 0.55557,+ 0.83147,+ 0.0+ ],+ [+ 0.55581,+ -0.21508,+ 0.85339+ ],+ [+ 0.57253,+ -0.23715,+ -0.85295+ ],+ [+ 0.57766,+ -0.86454,+ -0.33784+ ],+ [+ 0.57766,+ 0.86454,+ 0.33784+ ],+ [+ 0.58036,+ -0.86858,+ -0.16545+ ],+ [+ 0.58036,+ 0.86858,+ 0.16545+ ],+ [+ 0.58767,+ 0.58767,+ -0.42346+ ],+ [+ 0.58772,+ -0.58777,+ 0.42351+ ],+ [+ 0.58779,+ 0.0,+ -0.80902+ ],+ [+ 0.58794,+ -0.39285,+ -0.70711+ ],+ [+ 0.58794,+ 0.39285,+ -0.70711+ ],+ [+ 0.58958,+ -0.14055,+ 0.86755+ ],+ [+ 0.59584,+ -0.59584,+ -0.61222+ ],+ [+ 0.59839,+ 0.5973,+ 0.61508+ ],+ [+ 0.60467,+ -0.12028,+ -0.84856+ ],+ [+ 0.61401,+ -0.41054,+ 0.74208+ ],+ [+ 0.61733,+ 0.41221,+ 0.73837+ ],+ [+ 0.62727,+ -0.62727,+ 0.28824+ ],+ [+ 0.62727,+ 0.62727,+ -0.28824+ ],+ [+ 0.63352,+ 0.27655,+ 0.91861+ ],+ [+ 0.65258,+ -0.0405,+ 0.89672+ ],+ [+ 0.65328,+ -0.2706,+ -0.70711+ ],+ [+ 0.65328,+ 0.2706,+ -0.70711+ ],+ [+ 0.66496,+ -0.44431,+ -0.58105+ ],+ [+ 0.66937,+ -0.66937,+ 0.14993+ ],+ [+ 0.66937,+ 0.66937,+ -0.14993+ ],+ [+ 0.67241,+ -0.67241,+ -0.48452+ ],+ [+ 0.67241,+ 0.67241,+ 0.48452+ ],+ [+ 0.67922,+ 0.44826,+ 0.59019+ ],+ [+ 0.68039,+ 0.45462,+ -0.59453+ ],+ [+ 0.68566,+ -0.2841,+ 0.76714+ ],+ [+ 0.68719,+ 0.11461,+ 0.92429+ ],+ [+ 0.68829,+ -0.46509,+ 0.60438+ ],+ [+ 0.69352,+ -0.13795,+ -0.70711+ ],+ [+ 0.69352,+ 0.13795,+ -0.70711+ ],+ [+ 0.70685,+ -0.29278,+ -0.55587+ ],+ [+ 0.70711,+ -0.70711,+ 0.0+ ],+ [+ 0.70711,+ 0.0,+ -0.70711+ ],+ [+ 0.70711,+ 0.70711,+ 0.0+ ],+ [+ 0.70903,+ 0.29356,+ 0.74174+ ],+ [+ 0.71772,+ -0.71772,+ -0.3298+ ],+ [+ 0.71772,+ 0.71772,+ 0.3298+ ],+ [+ 0.7271,+ -0.48583,+ -0.44557+ ],+ [+ 0.72743,+ -0.72743,+ -0.16294+ ],+ [+ 0.72743,+ 0.72743,+ 0.16294+ ],+ [+ 0.7287,+ 0.4861,+ 0.44628+ ],+ [+ 0.73684,+ 0.30124,+ 0.56893+ ],+ [+ 0.73767,+ -0.14657,+ 0.77977+ ],+ [+ 0.75085,+ -0.31101,+ -0.4141+ ],+ [+ 0.75459,+ 0.5042,+ -0.46241+ ],+ [+ 0.75469,+ -0.15012,+ -0.55906+ ],+ [+ 0.75518,+ -0.50515,+ 0.46295+ ],+ [+ 0.75836,+ 0.31274,+ 0.4171+ ],+ [+ 0.76507,+ 0.15241,+ 0.75155+ ],+ [+ 0.77174,+ 0.00045,+ 0.77128+ ],+ [+ 0.7761,+ -0.51858,+ -0.30328+ ],+ [+ 0.7761,+ 0.51858,+ 0.30328+ ],+ [+ 0.78802,+ 0.32641,+ -0.6197+ ],+ [+ 0.79373,+ 0.16518,+ 0.57752+ ],+ [+ 0.80146,+ -0.33197,+ -0.28186+ ],+ [+ 0.80155,+ 0.33199,+ 0.2819+ ],+ [+ 0.80462,+ -0.33645,+ 0.64091+ ],+ [+ 0.80478,+ -0.16008,+ -0.41809+ ],+ [+ 0.80545,+ -0.53818,+ 0.31475+ ],+ [+ 0.80545,+ 0.53818,+ -0.31475+ ],+ [+ 0.80902,+ 0.0,+ -0.58779+ ],+ [+ 0.81182,+ -0.54244,+ -0.15464+ ],+ [+ 0.81182,+ 0.54244,+ 0.15464+ ],+ [+ 0.81631,+ 0.16549,+ 0.42308+ ],+ [+ 0.83065,+ -0.55502,+ 0.15823+ ],+ [+ 0.83065,+ 0.55502,+ -0.15823+ ],+ [+ 0.83147,+ -0.55557,+ 0.0+ ],+ [+ 0.83147,+ 0.55557,+ 0.0+ ],+ [+ 0.83225,+ 0.16555,+ -0.61651+ ],+ [+ 0.84731,+ 0.01323,+ 0.61539+ ],+ [+ 0.85902,+ -0.17087,+ -0.28458+ ],+ [+ 0.85955,+ 0.17111,+ 0.28481+ ],+ [+ 0.861,+ -0.16502,+ 0.64641+ ],+ [+ 0.86295,+ -0.35745,+ -0.14794+ ],+ [+ 0.86295,+ 0.35745,+ 0.14794+ ],+ [+ 0.89101,+ 0.0,+ -0.45399+ ],+ [+ 0.89551,+ 0.37093,+ -0.49388+ ],+ [+ 0.89796,+ -0.37246,+ 0.49564+ ],+ [+ 0.90219,+ 0.00513,+ 0.45963+ ],+ [+ 0.92137,+ -0.18327,+ -0.14879+ ],+ [+ 0.92137,+ 0.18327,+ 0.14879+ ],+ [+ 0.92388,+ -0.38268,+ 0.0+ ],+ [+ 0.92388,+ 0.38268,+ 0.0+ ],+ [+ 0.94299,+ 0.18757,+ -0.48989+ ],+ [+ 0.94978,+ -0.18728,+ 0.49389+ ],+ [+ 0.95106,+ 0.0,+ -0.30902+ ],+ [+ 0.9514,+ 0.00014,+ 0.30913+ ],+ [+ 0.95587,+ -0.39593,+ 0.33617+ ],+ [+ 0.95587,+ 0.39593,+ -0.33617+ ],+ [+ 0.96206,+ -0.3985,+ 0.16493+ ],+ [+ 0.96206,+ 0.3985,+ -0.16493+ ],+ [+ 0.98079,+ -0.19509,+ 0.0+ ],+ [+ 0.98079,+ 0.19509,+ 0.0+ ],+ [+ 0.98769,+ 0.0,+ -0.15643+ ],+ [+ 0.98769,+ 0.0,+ 0.15643+ ],+ [+ 1.0,+ 0.0,+ 0.0+ ],+ [+ 1.00654,+ 0.20021,+ -0.33345+ ],+ [+ 1.00655,+ -0.20021,+ 0.33345+ ],+ [+ 1.01605,+ -0.20211,+ 0.16408+ ],+ [+ 1.01605,+ 0.20211,+ -0.16408+ ]+ ]+ },+ "sculpt-displace-smooth-grid": {+ "vertexCount": 16,+ "edgeCount": 24,+ "faceCount": 9,+ "faceSizes": {+ "4": 9+ },+ "volume": 1.423556,+ "area": 9.30014,+ "positions": [+ [+ 0.0,+ 0.0,+ 0.0+ ],+ [+ 0.0,+ 3.0,+ 0.0+ ],+ [+ 0.0026,+ 1.0,+ 0.04023+ ],+ [+ 0.0026,+ 2.0,+ 0.04023+ ],+ [+ 1.0,+ 0.0026,+ 0.04023+ ],+ [+ 1.0,+ 1.0,+ 0.35668+ ],+ [+ 1.0,+ 2.0,+ 0.35668+ ],+ [+ 1.0,+ 2.9974,+ 0.04023+ ],+ [+ 2.0,+ 0.0026,+ 0.04023+ ],+ [+ 2.0,+ 1.0,+ 0.35668+ ],+ [+ 2.0,+ 2.0,+ 0.35668+ ],+ [+ 2.0,+ 2.9974,+ 0.04023+ ],+ [+ 2.9974,+ 1.0,+ 0.04023+ ],+ [+ 2.9974,+ 2.0,+ 0.04023+ ],+ [+ 3.0,+ 0.0,+ 0.0+ ],+ [+ 3.0,+ 3.0,+ 0.0+ ]+ ]+ },+ "shrinkwrap-nearest-cylinder": {+ "vertexCount": 16,+ "edgeCount": 24,+ "faceCount": 9,+ "faceSizes": {+ "4": 9+ },+ "volume": 0.454146,+ "area": 2.724874,+ "positions": [+ [+ 0.60355,+ 1.25,+ -0.5+ ],+ [+ 0.60355,+ 1.75,+ -0.5+ ],+ [+ 0.79289,+ 0.79289,+ -0.5+ ],+ [+ 0.79289,+ 2.20711,+ -0.5+ ],+ [+ 1.0,+ 1.0,+ -0.5+ ],+ [+ 1.0,+ 2.0,+ -0.5+ ],+ [+ 1.25,+ 0.60355,+ -0.5+ ],+ [+ 1.25,+ 2.39645,+ -0.5+ ],+ [+ 1.75,+ 0.60355,+ -0.5+ ],+ [+ 1.75,+ 2.39645,+ -0.5+ ],+ [+ 2.0,+ 1.0,+ -0.5+ ],+ [+ 2.0,+ 2.0,+ -0.5+ ],+ [+ 2.20711,+ 0.79289,+ -0.5+ ],+ [+ 2.20711,+ 2.20711,+ -0.5+ ],+ [+ 2.39645,+ 1.25,+ -0.5+ ],+ [+ 2.39645,+ 1.75,+ -0.5+ ]+ ]+ },+ "shrinkwrap-project-cap-offset": {+ "vertexCount": 16,+ "edgeCount": 24,+ "faceCount": 9,+ "faceSizes": {+ "4": 9+ },+ "volume": 3.8,+ "area": 11.335959,+ "positions": [+ [+ 0.0,+ 0.0,+ 0.0+ ],+ [+ 0.0,+ 1.0,+ 0.0+ ],+ [+ 0.0,+ 2.0,+ 0.0+ ],+ [+ 0.0,+ 3.0,+ 0.0+ ],+ [+ 1.0,+ 0.0,+ 0.0+ ],+ [+ 1.0,+ 1.0,+ -0.95+ ],+ [+ 1.0,+ 2.0,+ -0.95+ ],+ [+ 1.0,+ 3.0,+ 0.0+ ],+ [+ 2.0,+ 0.0,+ 0.0+ ],+ [+ 2.0,+ 1.0,+ -0.95+ ],+ [+ 2.0,+ 2.0,+ -0.95+ ],+ [+ 2.0,+ 3.0,+ 0.0+ ],+ [+ 3.0,+ 0.0,+ 0.0+ ],+ [+ 3.0,+ 1.0,+ 0.0+ ],+ [+ 3.0,+ 2.0,+ 0.0+ ],+ [+ 3.0,+ 3.0,+ 0.0+ ]+ ]}},"curves": {diff --git a/tests/mesh-sculpt-shrinkwrap.test.js b/tests/mesh-sculpt-shrinkwrap.test.jsnew file mode 100644index 00000000..3fc85053--- /dev/null+++ b/tests/mesh-sculpt-shrinkwrap.test.js@@ -0,0 +1,216 @@+import assert from 'node:assert/strict';+import test from 'node:test';+import { createMeshData, applyMeshEdits, normalizeMeshEdits, validateTopology, editMesh, MESH_EDIT_OPERATIONS } from '../src/mesh.js';+import { withFaceAttributes } from '../src/mesh-convert.js';+import { signedVolume } from '../src/mesh-surface-distance.js';+import { sculptGeometry } from '../src/sculpt.js';++function buildMesh(positions, faces, attributes) {+ const faceOffsets = new Uint32Array(faces.length + 1);+ faces.forEach((face, index) => {+ faceOffsets[index + 1] = faceOffsets[index] + face.length;+ });+ const mesh = createMeshData({ positions: new Float32Array(positions), faceOffsets, cornerVertices: new Uint32Array(faces.flat()) });+ return attributes ? withFaceAttributes(mesh, attributes) : mesh;+}++// A closed sphere of radius 1 as quads with triangle caps.+function sphere(columns = 32, rows = 16) {+ const positions = [0, 0, 1];+ for (let row = 1; row < rows; row++) {+ for (let column = 0; column < columns; column++) {+ const polar = Math.PI * row / rows;+ const azimuth = 2 * Math.PI * column / columns;+ positions.push(Math.sin(polar) * Math.cos(azimuth), Math.sin(polar) * Math.sin(azimuth), Math.cos(polar));+ }+ }+ positions.push(0, 0, -1);+ const ring = (row, column) => 1 + (row - 1) * columns + (column % columns);+ const bottom = positions.length / 3 - 1;+ const faces = [];+ for (let column = 0; column < columns; column++) faces.push([0, ring(1, column), ring(1, column + 1)]);+ for (let row = 1; row < rows - 1; row++) {+ for (let column = 0; column < columns; column++) faces.push([ring(row, column), ring(row + 1, column), ring(row + 1, column + 1), ring(row, column + 1)]);+ }+ for (let column = 0; column < columns; column++) faces.push([bottom, ring(rows - 1, column + 1), ring(rows - 1, column)]);+ return buildMesh(positions, faces);+}++// A flat square sheet, x and y from -half to half at height z, split into cells x cells quads.+function sheet(cells, half, height) {+ const positions = [];+ for (let row = 0; row <= cells; row++) {+ for (let column = 0; column <= cells; column++) positions.push(-half + 2 * half * column / cells, -half + 2 * half * row / cells, height);+ }+ const faces = [];+ for (let row = 0; row < cells; row++) {+ for (let column = 0; column < cells; column++) {+ const corner = row * (cells + 1) + column;+ faces.push([corner, corner + 1, corner + cells + 2, corner + cells + 1]);+ }+ }+ return buildMesh(positions, faces);+}++function tagFacesByHeight(mesh) {+ const data = new Uint8Array(mesh.faceCount);+ for (let face = 0; face < mesh.faceCount; face++) {+ let height = 0;+ for (let corner = mesh.faceOffsets[face]; corner < mesh.faceOffsets[face + 1]; corner++) height += mesh.positions[mesh.cornerVertices[corner] * 3 + 2];+ data[face] = height > 0 ? 1 : 0;+ }+ return withFaceAttributes(mesh, { 'tag:top': { data, size: 1 } });+}++const SPHERE_TARGET = { type: 'sphere' };+const resolveCutter = () => sphere();++function run(mesh, edits) {+ return applyMeshEdits(mesh, edits, { resolveCutter });+}++function radiusOf(mesh, vertex) {+ return Math.hypot(mesh.positions[vertex * 3], mesh.positions[vertex * 3 + 1], mesh.positions[vertex * 3 + 2]);+}++test('sculpt inflate moves only the vertices of the selected faces and keeps the topology valid', () => {+ const mesh = tagFacesByHeight(sphere());+ const { mesh: result, results } = run(mesh, [{ op: 'sculpt', select: { tag: 'top' }, strokes: [{ type: 'inflate', center: [0, 0, 1], radius: 0.6, strength: 0.2 }] }]);+ validateTopology(editMesh(result));+ assert.ok(results[0].movedVertices > 0);+ assert.ok(signedVolume(result) > signedVolume(mesh));+ assert.ok(radiusOf(result, 0) > 1.19, 'the pole moves out by the stroke strength');+ const bottom = result.vertexCount - 1;+ assert.equal(radiusOf(result, bottom), radiusOf(mesh, bottom));+ assert.equal(result.faceCount, mesh.faceCount);+});++test('sculpt displace and smooth strokes change the surface, and smooth lowers the bump', () => {+ const mesh = sphere();+ const bumped = run(mesh, [{ op: 'sculpt', strokes: [{ type: 'displace', center: [0, 0, 1], radius: 0.7, strength: 0.3, direction: [0, 0, 1] }] }]).mesh;+ const smoothed = run(bumped, [{ op: 'sculpt', strokes: [{ type: 'smooth', center: [0, 0, 1.3], radius: 0.9, strength: 1 }] }]).mesh;+ assert.ok(Math.abs(radiusOf(bumped, 0) - 1.3) < 1e-5);+ assert.ok(radiusOf(smoothed, 0) < radiusOf(bumped, 0));+ validateTopology(editMesh(smoothed));+});++test('sculpt gives the same bytes every time', () => {+ const edits = [{ op: 'sculpt', strokes: [{ type: 'inflate', center: [1, 0, 0], radius: 0.8, strength: 0.15 }, { type: 'smooth', center: [1, 0, 0], radius: 0.5, strength: 0.5 }] }];+ const first = run(sphere(), edits).mesh;+ const second = run(sphere(), edits).mesh;+ assert.deepEqual(Array.from(first.positions), Array.from(second.positions));+});++test('the shared stroke maths still serves sculptGeometry', () => {+ const triangle = { positions: Float32Array.of(0, 0, 0, 1, 0, 0, 0, 1, 0), normals: Float32Array.of(0, 0, 1, 0, 0, 1, 0, 0, 1), indices: Uint32Array.of(0, 1, 2) };+ const moved = sculptGeometry(triangle, [{ type: 'inflate', center: [0, 0, 0], radius: 2, strength: 0.1 }]);+ assert.ok(moved.positions[2] > 0);+ assert.throws(() => sculptGeometry(triangle, [{ type: 'smooth', center: [0, 0, 0], radius: 1, strength: 2 }]), RangeError);+});++test('sculpt refuses hostile strokes before running them', () => {+ const stroke = { type: 'inflate', center: [0, 0, 1], radius: 0.5, strength: 0.1 };+ const bad = [+ { strokes: [] },+ { strokes: Array.from({ length: 33 }, () => stroke) },+ { strokes: 'inflate' },+ { strokes: [{ ...stroke, type: 'pinch' }] },+ { strokes: [{ ...stroke, radius: 0 }] },+ { strokes: [{ ...stroke, radius: -1 }] },+ { strokes: [{ ...stroke, strength: Number.NaN }] },+ { strokes: [{ ...stroke, strength: Infinity }] },+ { strokes: [{ ...stroke, center: [0, 0] }] },+ { strokes: [{ ...stroke, center: [0, 0, 1e9] }] },+ { strokes: [{ ...stroke, direction: [0, 0, 1] }] },+ { strokes: [{ type: 'displace', center: [0, 0, 1], radius: 1, strength: 1 }] },+ { strokes: [{ type: 'displace', center: [0, 0, 1], radius: 1, strength: 1, direction: [0, 0, 0] }] },+ { strokes: [{ type: 'smooth', center: [0, 0, 1], radius: 1, strength: 1.5 }] },+ { strokes: [{ ...stroke, extra: 1 }] },+ { strokes: [null] },+ { strokes: [stroke], alsoThis: true },+ ];+ for (const edit of bad) assert.throws(() => normalizeMeshEdits([{ op: 'sculpt', ...edit }]), /Mesh edit 0|does not take/, JSON.stringify(edit).slice(0, 80));+});++test('sculpt stops when the vertex visits would be too many', () => {+ const dense = sphere(1000, 1000);+ const stroke = { type: 'inflate', center: [0, 0, 1], radius: 0.5, strength: 0.1 };+ assert.throws(() => run(dense, [{ op: 'sculpt', strokes: Array.from({ length: 8 }, () => stroke) }]), /too many vertices/);+});++test('shrinkwrap nearest puts a flat sheet on the target with an offset', () => {+ const { mesh: result, results } = run(sheet(8, 0.5, 1.5), [{ op: 'shrinkwrap', target: SPHERE_TARGET, offset: 0.01 }]);+ validateTopology(editMesh(result));+ assert.equal(results[0].movedVertices, 81);+ for (let vertex = 0; vertex < result.vertexCount; vertex++) {+ const distance = radiusOf(result, vertex);+ assert.ok(distance > 0.98 && distance < 1.02, `vertex ${vertex} sits ${distance} from the centre`);+ assert.ok(result.positions[vertex * 3 + 2] > 0.8, 'the sheet stays on the side it started');+ }+});++test('shrinkwrap project follows a direction and honours placement and select', () => {+ const sheetMesh = sheet(6, 0.4, 3);+ const projected = run(sheetMesh, [{ op: 'shrinkwrap', target: SPHERE_TARGET, mode: 'project', direction: [0, 0, -1] }]).mesh;+ for (let vertex = 0; vertex < projected.vertexCount; vertex++) {+ assert.equal(projected.positions[vertex * 3], sheetMesh.positions[vertex * 3]);+ assert.equal(projected.positions[vertex * 3 + 1], sheetMesh.positions[vertex * 3 + 1]);+ assert.ok(Math.abs(radiusOf(projected, vertex) - 1) < 0.02);+ }+ const scaled = run(sheetMesh, [{ op: 'shrinkwrap', target: SPHERE_TARGET, scale: [2, 2, 2], mode: 'project', direction: [0, 0, -1] }]).mesh;+ assert.ok(scaled.positions[2] > projected.positions[2] + 0.5, 'a larger target catches the sheet higher up');+ const partial = tagFacesByHeight(sheetMesh);+ const none = run(partial, [{ op: 'shrinkwrap', select: { tag: 'top' }, target: SPHERE_TARGET }]);+ assert.equal(none.results[0].movedVertices, partial.vertexCount);+});++test('shrinkwrap misses are an error or kept in place, and maxDistance bounds the search', () => {+ const far = sheet(4, 0.4, 5);+ assert.throws(() => run(far, [{ op: 'shrinkwrap', target: SPHERE_TARGET, maxDistance: 1 }]), /Mesh edit 0 \(shrinkwrap\).*no surface/);+ const kept = run(far, [{ op: 'shrinkwrap', target: SPHERE_TARGET, maxDistance: 1, onMiss: 'keep' }]);+ assert.equal(kept.results[0].missedVertices, 25);+ assert.equal(kept.results[0].movedVertices, 0);+ assert.deepEqual(Array.from(kept.mesh.positions), Array.from(far.positions));+ assert.throws(() => run(far, [{ op: 'shrinkwrap', target: SPHERE_TARGET, mode: 'project', direction: [1, 0, 0] }]), /no surface/);+});++test('shrinkwrap gives the same bytes every time', () => {+ const edits = [{ op: 'shrinkwrap', target: SPHERE_TARGET, offset: 0.02 }];+ const first = run(sheet(10, 0.6, 1.4), edits).mesh;+ const second = run(sheet(10, 0.6, 1.4), edits).mesh;+ assert.deepEqual(Array.from(first.positions), Array.from(second.positions));+});++test('shrinkwrap refuses hostile fields before running them', () => {+ const base = { op: 'shrinkwrap', target: SPHERE_TARGET };+ const bad = [+ { target: undefined },+ { target: 'sphere' },+ { target: [] },+ { target: {} },+ { mode: 'slide' },+ { mode: 'project' },+ { mode: 'project', direction: [0, 0, 0] },+ { mode: 'project', direction: [0, 1] },+ { mode: 'project', direction: [0, Number.NaN, 1] },+ { direction: [0, 0, 1] },+ { offset: -1 },+ { offset: Infinity },+ { offset: '1' },+ { maxDistance: -1 },+ { maxDistance: Number.NaN },+ { onMiss: 'ignore' },+ { scale: [0, 1, 1] },+ { scale: [1, 1] },+ { rotation: [0, 0, 0, 0] },+ { translation: [1e9, 0, 0] },+ { colour: 'red' },+ ];+ for (const change of bad) assert.throws(() => normalizeMeshEdits([{ ...base, ...change }]), /Mesh edit 0|does not take/, JSON.stringify(change));+ assert.throws(() => applyMeshEdits(sheet(2, 0.5, 1.5), [base]), /target resolver/);+});++test('both edits are in the vocabulary agents read', () => {+ assert.ok(MESH_EDIT_OPERATIONS.sculpt.fields.includes('strokes'));+ assert.ok(MESH_EDIT_OPERATIONS.shrinkwrap.fields.includes('target'));+});