@fleox/agent3d 0.4.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -14
- package/changelog.json +24 -0
- package/dist/agent/agent3d.mjs +779 -85
- package/dist/agent/chunks/{assets-YBkgdfgy.mjs → assets-DdzHgVcn.mjs} +2 -2
- package/dist/agent/chunks/{browser-Dil7VM5m.mjs → browser-nFaRUETt.mjs} +1 -1
- package/dist/agent/chunks/{cdp-DLEis_Z3.mjs → cdp-6vF_gP-H.mjs} +1 -1
- package/dist/agent/chunks/{check-DP9fRYbK.mjs → check-E7GdPxTt.mjs} +14 -2
- package/dist/agent/chunks/{depth-CD_ql3QJ.mjs → depth-Bf7cHwod.mjs} +4 -4
- package/dist/agent/chunks/{depth-BZT4gseQ.mjs → depth-DEaogEAi.mjs} +4 -114
- package/dist/agent/chunks/{export-CEX5DFLo.mjs → export-BSOqVfPT.mjs} +8 -4
- package/dist/agent/chunks/{imageCodec-DeGfmBp3.mjs → imageCodec-DXxqkEQA.mjs} +53 -4
- package/dist/agent/chunks/{objects-DuytRxiC.mjs → objects-DvzrcVmK.mjs} +2 -2
- package/dist/agent/chunks/{optimizeSizing-B-BBiUkD.mjs → optimizeSizing-Dd8vaSnE.mjs} +24 -1
- package/dist/agent/chunks/{package-DjRnLzcU.mjs → package-Bn7PKfXn.mjs} +1 -1
- package/dist/agent/chunks/photoPlacement-D-k3mD0T.mjs +138 -0
- package/dist/agent/chunks/plate-Cwl35I2T.mjs +604 -0
- package/dist/agent/chunks/pngEncode-BMc3U9QC.mjs +119 -0
- package/dist/agent/chunks/{render-B05DU4Q5.mjs → render-CCKciCgu.mjs} +76 -11
- package/dist/agent/chunks/{scene-DWgXH6As.mjs → scene-DSjsun-3.mjs} +22 -5
- package/dist/agent/chunks/{server-Dt_YFvN7.mjs → server-CLvLORgA.mjs} +1 -1
- package/dist/agent/chunks/{tools-CZyIc4zw.mjs → tools-Vs74Xopx.mjs} +142 -13
- package/dist/runtime/agent3d-photo.js +51 -10
- package/dist/runtime/agent3d-runtime.js +23 -23
- package/dist/runtime/agent3d-runtime.single.js +405 -134
- package/dist/runtime/chunks/photo-Dq-AKlfw.js +526 -0
- package/dist/studio/assets/BufferGeometryUtils-BbzK4rCj.js +1 -0
- package/dist/studio/assets/{EXRLoader-BKkzlNd8.js → EXRLoader-CuDOo1xG.js} +1 -1
- package/dist/studio/assets/{FontLoader-Bzjx8mXt.js → FontLoader-DlBfss5q.js} +1 -1
- package/dist/studio/assets/{GLTFLoader-1Zd9N406.js → GLTFLoader-bl1eymL4.js} +1 -1
- package/dist/studio/assets/{GroundedSkybox-BEMqNCBD.js → GroundedSkybox-cLn9JVlt.js} +1 -1
- package/dist/studio/assets/{HDRLoader-DxB0kxPH.js → HDRLoader-8EiZoQQP.js} +1 -1
- package/dist/studio/assets/{OrbitControls-MlE9XiCg.js → OrbitControls-1xEm394I.js} +1 -1
- package/dist/studio/assets/{RectAreaLightUniformsLib-ClHrtYY6.js → RectAreaLightUniformsLib-S0AelTmO.js} +1 -1
- package/dist/studio/assets/{RoomEnvironment-MJ-jIEC8.js → RoomEnvironment-v4QurKxu.js} +1 -1
- package/dist/studio/assets/{SVGLoader-CIYl0nEy.js → SVGLoader-KDBVv02P.js} +1 -1
- package/dist/studio/assets/{Sky-DNMfpp92.js → Sky-D8Lp9Zh3.js} +1 -1
- package/dist/studio/assets/assets-DICv7P37.js +2 -0
- package/dist/studio/assets/camera-HsMeC1mn.js +2 -0
- package/dist/studio/assets/catalog-DDg904x2.js +1 -0
- package/dist/studio/assets/{editor-DzyukvQl.js → editor-BZLIZJC8.js} +1 -1
- package/dist/studio/assets/{extrude-9bG8hr2C.js → extrude-BpJda0hq.js} +1 -1
- package/dist/studio/assets/game-DnnuBk26.js +19 -0
- package/dist/studio/assets/{generators-BuVeRXnC.js → generators-C4n9MsXd.js} +1 -1
- package/dist/studio/assets/index-D-TPNQMQ.css +1 -0
- package/dist/studio/assets/index-cDbmaVDl.js +479 -0
- package/dist/studio/assets/model-CkPfLOl0.js +2 -0
- package/dist/studio/assets/params-BZqUA__U.js +1 -0
- package/dist/studio/assets/photo-CPGGCRa-.js +526 -0
- package/dist/studio/assets/{physicsHost-z9qn_mpg.js → physicsHost-EkPuIy04.js} +1 -1
- package/dist/studio/assets/{postfx-B3jDEaEK.js → postfx-Dp7mgfGJ.js} +2 -2
- package/dist/studio/assets/rolldown-runtime-4tVxZq34.js +1 -0
- package/dist/studio/assets/runtime-ByR4qfyV.js +572 -0
- package/dist/studio/assets/{shaders-bFhELLmD.js → shaders-DoRMwJE_.js} +1 -1
- package/dist/studio/assets/svg-n3rkKAm5.js +2 -0
- package/dist/studio/assets/text-BkPPDghK.js +3 -0
- package/dist/studio/assets/three.module-B9FlcKtd.js +4225 -0
- package/dist/studio/index.html +5 -3
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/skills/agent3d-assets/SKILL.md +42 -27
- package/plugin/skills/agent3d-create/SKILL.md +77 -29
- package/plugin/skills/agent3d-create/references/art-direction.md +3 -3
- package/plugin/skills/agent3d-create/references/recipes.md +6 -6
- package/plugin/skills/agent3d-edit/SKILL.md +22 -22
- package/plugin/skills/agent3d-edit/references/patch-ops.md +3 -3
- package/plugin/skills/agent3d-game/SKILL.md +7 -7
- package/plugin/skills/agent3d-publish/SKILL.md +30 -23
- package/plugin/skills/agent3d-publish/references/integrations.md +1 -1
- package/templates/hero-scroll-story/README.md +1 -1
- package/templates/photo-scroll-story/README.md +29 -0
- package/templates/photo-scroll-story/agent3d.json +8 -0
- package/templates/photo-scroll-story/assets/depth/lake-depth.png +0 -0
- package/templates/photo-scroll-story/assets/depth/street-depth.png +0 -0
- package/templates/photo-scroll-story/assets/manifest.json +46 -0
- package/templates/photo-scroll-story/assets/textures/lake.webp +0 -0
- package/templates/photo-scroll-story/assets/textures/street.webp +0 -0
- package/templates/photo-scroll-story/preview.png +0 -0
- package/templates/photo-scroll-story/scene.json +112 -0
- package/templates/photo-scroll-story/template.json +8 -0
- package/templates/photo-title-inside/README.md +31 -0
- package/templates/photo-title-inside/agent3d.json +8 -0
- package/templates/photo-title-inside/assets/depth/street-depth.png +0 -0
- package/templates/photo-title-inside/assets/manifest.json +25 -0
- package/templates/photo-title-inside/assets/textures/street.webp +0 -0
- package/templates/photo-title-inside/preview.png +0 -0
- package/templates/photo-title-inside/scene.json +80 -0
- package/templates/photo-title-inside/template.json +8 -0
- package/dist/runtime/chunks/photo-w6dwHX7j.js +0 -255
- package/dist/studio/assets/BufferGeometryUtils-CAlXAboW.js +0 -1
- package/dist/studio/assets/assets--ehPZf8R.js +0 -1
- package/dist/studio/assets/camera-C0sxfRxy.js +0 -2
- package/dist/studio/assets/game-DNpTN_Ga.js +0 -19
- package/dist/studio/assets/index-BQT0otii.css +0 -1
- package/dist/studio/assets/index-C2nMYSoW.js +0 -479
- package/dist/studio/assets/model-DQgOrTs4.js +0 -2
- package/dist/studio/assets/params-D-Ul6GSt.js +0 -1
- package/dist/studio/assets/photo-Dx2IBJ11.js +0 -255
- package/dist/studio/assets/runtime-rd9RW3WH.js +0 -572
- package/dist/studio/assets/svg-BkV9LeqP.js +0 -2
- package/dist/studio/assets/text-Dp8gdjSA.js +0 -3
- package/dist/studio/assets/three.module-CnI50X0U.js +0 -4225
package/dist/studio/index.html
CHANGED
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
<meta name="color-scheme" content="dark" />
|
|
7
7
|
<title>Agent3D Studio</title>
|
|
8
8
|
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%232a2a30'/%3E%3Cstop offset='1' stop-color='%230c0c0f'/%3E%3C/linearGradient%3E%3ClinearGradient id='d' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%237aa5ff'/%3E%3Cstop offset='1' stop-color='%233d6bff'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='32' height='32' rx='7.5' fill='url(%23g)'/%3E%3Cpath d='M16.00 8.00L23.45 12.30L23.45 20.90L16.00 25.20L8.55 20.90L8.55 12.30ZM12.62 14.65L8.55 12.30M19.38 14.65L23.45 12.30M16.00 20.50L16.00 25.20' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3Ccircle cx='16' cy='16.6' r='2.2' fill='url(%23d)'/%3E%3C/svg%3E" />
|
|
9
|
-
<script type="module" crossorigin src="./assets/index-
|
|
10
|
-
<link rel="modulepreload" crossorigin href="./assets/
|
|
11
|
-
<link rel="
|
|
9
|
+
<script type="module" crossorigin src="./assets/index-cDbmaVDl.js"></script>
|
|
10
|
+
<link rel="modulepreload" crossorigin href="./assets/rolldown-runtime-4tVxZq34.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="./assets/catalog-DDg904x2.js">
|
|
12
|
+
<link rel="modulepreload" crossorigin href="./assets/three.module-B9FlcKtd.js">
|
|
13
|
+
<link rel="stylesheet" crossorigin href="./assets/index-D-TPNQMQ.css">
|
|
12
14
|
</head>
|
|
13
15
|
<body>
|
|
14
16
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fleox/agent3d",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The 3D studio your AI agent can run: describe a scene as JSON (banners, characters, landscapes, mini games), preview and screenshot it headless, and export a self-contained embed for any website. No server, no account.",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent3d",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Skills to run Agent3D (the 3D studio your AI agent can run): create, edit, preview with headless screenshots the agent looks at, check and publish 3D elements for web pages — animated banners, heroes, product shots, characters, landscapes and mini games — exported as a self-contained Web Component for any site, with no server and no account.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "fleox"
|
|
@@ -4,7 +4,7 @@ description: Find and add 3D assets to an Agent3D project - the built-in CC0 lib
|
|
|
4
4
|
license: PolyForm-Noncommercial-1.0.0
|
|
5
5
|
compatibility: Requires Node.js 22+ and Google Chrome (or Chromium/Edge) for renders.
|
|
6
6
|
metadata:
|
|
7
|
-
version: "0.
|
|
7
|
+
version: "0.5.2"
|
|
8
8
|
repository: "https://github.com/fleox/agent3d"
|
|
9
9
|
allowed-tools: Bash Read Write
|
|
10
10
|
---
|
|
@@ -13,7 +13,7 @@ allowed-tools: Bash Read Write
|
|
|
13
13
|
|
|
14
14
|
**Language:** talk to the user in their language; keep commands, ids and files in English.
|
|
15
15
|
|
|
16
|
-
Every command is `npx -y @fleox/agent3d@0.
|
|
16
|
+
Every command is `npx -y @fleox/agent3d@0.5.2 <command> --json` with `--project <dir>`. Read `error.hint` when `ok` is false.
|
|
17
17
|
|
|
18
18
|
## Pick the cheapest thing that looks right
|
|
19
19
|
|
|
@@ -25,16 +25,16 @@ Every command is `npx -y @fleox/agent3d@0.4.0 <command> --json` with `--project
|
|
|
25
25
|
## The built-in library
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
npx -y @fleox/agent3d@0.
|
|
29
|
-
npx -y @fleox/agent3d@0.
|
|
30
|
-
npx -y @fleox/agent3d@0.
|
|
28
|
+
npx -y @fleox/agent3d@0.5.2 assets library --query tree --json
|
|
29
|
+
npx -y @fleox/agent3d@0.5.2 assets library --kind hdri --json
|
|
30
|
+
npx -y @fleox/agent3d@0.5.2 assets library --query character --kind model --json
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
The answer lists the matches in `data.assets[]` (with `data.total` and `data.more`; `assets search` below names its list `data.hits[]` instead). Each entry has `ref` (use it as is in the scene), `description` (with the bounding box), `tags`, `license`, `kb`, and for models `triangles`, `size` (bounding box w × h × d in model units, Y-up) and `animations` (the clip names of animated models). Listings show 50 results per page: narrow with `--query` and `--kind`; when `more` is true, page with `--offset 50` (or `--limit 100`, `--all`).
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
|
-
npx -y @fleox/agent3d@0.
|
|
37
|
-
npx -y @fleox/agent3d@0.
|
|
36
|
+
npx -y @fleox/agent3d@0.5.2 assets library --kind model --offset 50 --json
|
|
37
|
+
npx -y @fleox/agent3d@0.5.2 assets library --kind model --all --json
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
```json
|
|
@@ -51,9 +51,9 @@ npx -y @fleox/agent3d@0.4.0 assets library --kind model --all --json
|
|
|
51
51
|
## Searching free sources (network)
|
|
52
52
|
|
|
53
53
|
```bash
|
|
54
|
-
npx -y @fleox/agent3d@0.
|
|
55
|
-
npx -y @fleox/agent3d@0.
|
|
56
|
-
npx -y @fleox/agent3d@0.
|
|
54
|
+
npx -y @fleox/agent3d@0.5.2 assets search "wood planks" --kind texture --project my-scene --json
|
|
55
|
+
npx -y @fleox/agent3d@0.5.2 assets search sunset --kind hdri --source polyhaven --project my-scene --json
|
|
56
|
+
npx -y @fleox/agent3d@0.5.2 assets search fox --source khronos --project my-scene --json
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
The answer lists the matches in `data.hits[]`; each hit has `source`, `id`, `title`, `kind`, `license`, `author`, `attribution` (when the licence needs one), `previewUrl` (show it to the user or open it), `pageUrl`, `downloads` (resolutions / formats). Per-source failures come in `data.errors` without failing the search. Search terms match titles and tags: try synonyms ("planks", "wood floor") when a search is poor.
|
|
@@ -61,13 +61,13 @@ The answer lists the matches in `data.hits[]`; each hit has `source`, `id`, `tit
|
|
|
61
61
|
Download one hit into the project (licence recorded in `assets/manifest.json`):
|
|
62
62
|
|
|
63
63
|
```bash
|
|
64
|
-
npx -y @fleox/agent3d@0.
|
|
64
|
+
npx -y @fleox/agent3d@0.5.2 assets add --hit @hit.json --resolution 1k --project my-scene --json
|
|
65
65
|
```
|
|
66
66
|
|
|
67
67
|
`@hit.json` is a file holding one hit object from the search (or pass the JSON inline). Models come back with `data.asset.bounds`: `size` (w × h × d in model units, node transforms applied), `center`, `min` / `max` and `upAxis` (`"y"`, or `"z?"` when the model is much deeper than tall — it may lie on its back; check it with `render --isolate <objectId>`, which renders that object alone from the front (+Z) on a neutral background). Local `.glb` / `.gltf` files added with `assets add <file>` return the same `bounds`. Textures from ambientCG / Poly Haven download the whole set (colour, normal, roughness, AO) and return `data.asset.suggestion.material`, a ready material to `set` on an object. Poly Haven models download as `.gltf` + `.bin` + textures in a folder: use the returned `path` as the model `src`. Keep `--resolution 1k` for the web (2k only for a hero close-up). Sources start at 1k: `--resolution 512` (or `256`) downloads 1k and downscales every texture to that size with headless Chrome (`data.asset.optimized`); `--max-size <px>` does the same for any resolution.
|
|
68
68
|
|
|
69
69
|
```bash
|
|
70
|
-
npx -y @fleox/agent3d@0.
|
|
70
|
+
npx -y @fleox/agent3d@0.5.2 assets add --hit @hit.json --resolution 512 --project my-banner --json
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
## Kenney and Quaternius packs (manual zip)
|
|
@@ -75,7 +75,7 @@ npx -y @fleox/agent3d@0.4.0 assets add --hit @hit.json --resolution 512 --projec
|
|
|
75
75
|
Their hits are `manual: true`: there is no direct download (the hit's `note` says so). Ask the user to download the pack zip from `pageUrl` (free, no account), then import it with `assets add <file.zip>` (the zip importer extracts only `.glb` / `.gltf` + textures; `--filter` keeps the models whose path contains the word, repeat it for several words; `--name` sets the folder under `assets/models/`):
|
|
76
76
|
|
|
77
77
|
```bash
|
|
78
|
-
npx -y @fleox/agent3d@0.
|
|
78
|
+
npx -y @fleox/agent3d@0.5.2 assets add ~/Downloads/kenney_platformer-kit.zip --source kenney --license CC0-1.0 --filter coin --filter flag --name platformer --project my-game --json
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
The answer lists the imported model paths (`models`) to use as `src`, plus `totalKb`. Importing a whole pack can add megabytes: always filter to what the scene uses. (MCP clients: the `assets_add` tool takes `{ "file", "source", "license", "filter": [...] }`.)
|
|
@@ -83,9 +83,9 @@ The answer lists the imported model paths (`models`) to use as `src`, plus `tota
|
|
|
83
83
|
## The user's own files
|
|
84
84
|
|
|
85
85
|
```bash
|
|
86
|
-
npx -y @fleox/agent3d@0.
|
|
87
|
-
npx -y @fleox/agent3d@0.
|
|
88
|
-
npx -y @fleox/agent3d@0.
|
|
86
|
+
npx -y @fleox/agent3d@0.5.2 assets add ./logo.svg --license proprietary --project my-banner --json
|
|
87
|
+
npx -y @fleox/agent3d@0.5.2 assets add ./bottle.glb --license proprietary --author "Acme" --project my-banner --json
|
|
88
|
+
npx -y @fleox/agent3d@0.5.2 assets add ./jingle.mp3 --kind audio --license CC-BY-4.0 --author "Jane Doe" --source-url https://example.com/jingle --project my-game --json
|
|
89
89
|
```
|
|
90
90
|
|
|
91
91
|
`--license` is required (an SPDX id such as `CC0-1.0`, `CC-BY-4.0`, or `proprietary` for the user's own work). Files go to `assets/models/`, `assets/textures/`, `assets/hdri/`, `assets/audio/`, `assets/fonts/`, `assets/svg/` or `assets/other/` by kind, unless `--path` says otherwise. SVG logos become 3D with an `svg` object; product models with a `model` object and `fit`; audio with `audio.sounds` / `audio.music` (`{ "src": "assets/audio/jingle.mp3" }`).
|
|
@@ -103,22 +103,37 @@ Each path keeps its SVG colour (`keepColors`: default `true` without a `material
|
|
|
103
103
|
When the user gives a photo and wants it to move in 3D (a "3D photo", parallax photo, "bring this picture to life"), the photo needs a **depth map**: a grey PNG, white = near, black = far, the same aspect as the photo. Estimate it locally:
|
|
104
104
|
|
|
105
105
|
```bash
|
|
106
|
-
npx -y @fleox/agent3d@0.
|
|
107
|
-
npx -y @fleox/agent3d@0.
|
|
106
|
+
npx -y @fleox/agent3d@0.5.2 assets add ./street.jpg --license CC0-1.0 --author "Jane Doe" --project my-hero --json
|
|
107
|
+
npx -y @fleox/agent3d@0.5.2 assets depth assets/textures/street.jpg --project my-hero --json
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
- **Output.** `data.path` = `assets/depth/<photo name>-depth.png` (`--out` to change), at the photo size capped at 1024 px (`--max-size`; the model works at 518 px, so a bigger map only adds bytes), transparent on depth jumps (the runtime hides stretched edges there). `data.suggestion` is a ready `{ "kind": "photo", "src", "depth" }` object; `data.ms` the time taken (about 1-1.5 s per photo plus ~2 s to start Chrome). `--size` is the model input long side (default 518; up to 1036 for finer edges, about 4× slower).
|
|
111
111
|
- **Model.** Depth Anything V2 Small (27 MB, Apache-2.0), run in headless Chrome like `render` (WebAssembly, no GPU, no account). The **first run downloads it once** into `~/.agent3d/models/` (the `AGENT3D_MODELS` environment variable moves that folder); every later run works **offline**. Offline before the first download: the error hint gives the model URL and the folder to put it in, or paint a depth map by hand (grey PNG, white = near) and set it as `depth`. The model never goes into exports: only the PNG does.
|
|
112
112
|
- **Licence.** The depth map is registered in `assets/manifest.json` with the **photo's** licence and author (add the photo with `assets add --license … --author …` first; a photo missing from the manifest gives `derived`) and an attribution line naming the model. Ask the user who took the photo and under which licence before using it.
|
|
113
113
|
- Use it on a `photo` object (`src` = the photo, `depth` = `data.path`); skill `agent3d-create` covers the modes, motion and framing. Keep depth maps as PNG: `check` warns on a JPEG depth map (`photo-depth-lossy`), and `assets optimize` only resizes PNG depth maps losslessly.
|
|
114
|
-
- MCP: `image_depth { "image", "out", "size", "maxSize" }` returns the same fields; hosts without headless Chrome refuse it with a hint.
|
|
114
|
+
- MCP: `image_depth { "image", "out", "size", "maxSize", "plate" }` returns the same fields; hosts without headless Chrome refuse it with a hint.
|
|
115
|
+
|
|
116
|
+
### Background plate (bigger moves)
|
|
117
|
+
|
|
118
|
+
When the photo will move a lot (`strength` 0.7-1, `mode: "mesh"`, people, poles or signs in front of the background), also build its **background plate**: the photo with the foreground removed next to its depth edges and filled with the background from the far side, plus the plate depth. The runtime shows it where moving foreground uncovers the background, so silhouettes stop smearing, doubling or dragging halos.
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
npx -y @fleox/agent3d@0.5.2 assets plate assets/textures/street.jpg --project my-hero --json
|
|
122
|
+
npx -y @fleox/agent3d@0.5.2 assets depth assets/textures/street.jpg --plate --project my-hero --json
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
- The first command reuses the existing depth map (`--depth`, else the photo object's `depth`, else `assets/depth/<name>-depth.png`); the second estimates the depth map and builds the plate in one go.
|
|
126
|
+
- **Output.** `data.path` = `assets/depth/<name>-plate.webp`, `data.depthPath` = `assets/depth/<name>-plate-depth.png`, `data.suggestion` = `{ "plate", "plateDepth" }` to set on the photo object (both are needed). `data.holePercent` is the share of the photo rebuilt; `--strength` (default 1) or `--width` (pixels for a full depth jump) sizes the removed band. About 0.3 s plus Chrome start-up (Chrome only decodes the photo); same licence as the photo.
|
|
127
|
+
- Open the plate with the Read tool: near-edge foreground should be replaced by plausible background (sky continued behind rooftops, ground behind people). Small subjects can vanish entirely from the plate: that is expected, it is only shown where they uncover it.
|
|
128
|
+
- Cost: about 100-160 KB more for a 1024 px photo. Skip it for gentle moves (strength ≤ 0.5) or photos whose edges are mostly against a plain sky.
|
|
129
|
+
- MCP: `image_plate { "image", "depth", "strength", "width", "maxSize", "format" }`, or `image_depth { "image", "plate": true }`.
|
|
115
130
|
|
|
116
131
|
## Listing and removing
|
|
117
132
|
|
|
118
133
|
```bash
|
|
119
|
-
npx -y @fleox/agent3d@0.
|
|
120
|
-
npx -y @fleox/agent3d@0.
|
|
121
|
-
npx -y @fleox/agent3d@0.
|
|
134
|
+
npx -y @fleox/agent3d@0.5.2 assets list --project my-scene --json
|
|
135
|
+
npx -y @fleox/agent3d@0.5.2 assets remove assets/textures/old.jpg --project my-scene --json
|
|
136
|
+
npx -y @fleox/agent3d@0.5.2 assets remove assets/textures/old.jpg --yes --project my-scene --json
|
|
122
137
|
```
|
|
123
138
|
|
|
124
139
|
`assets list` shows each file's size on disk, licence, whether it exists and which objects use it (`usedBy`); it is read-only: entries whose recorded size differs from the file on disk are listed in `stale` (`assets optimize` / `assets add` rewrite the manifest). `remove` prints a plan (with `usedBy`) unless `--yes`: fix the references first.
|
|
@@ -128,11 +143,11 @@ npx -y @fleox/agent3d@0.4.0 assets remove assets/textures/old.jpg --yes --projec
|
|
|
128
143
|
When `check` reports `budget` or `optimizable`, or before exporting a scene with project textures / `.glb` models, run `assets optimize`. Without `--yes` it prints the plan (no Chrome needed): for every file the size it will get and **why** (target kind, the object's size on screen, the camera distance, the texture role). Show the plan to the user, then apply:
|
|
129
144
|
|
|
130
145
|
```bash
|
|
131
|
-
npx -y @fleox/agent3d@0.
|
|
132
|
-
npx -y @fleox/agent3d@0.
|
|
133
|
-
npx -y @fleox/agent3d@0.
|
|
134
|
-
npx -y @fleox/agent3d@0.
|
|
135
|
-
npx -y @fleox/agent3d@0.
|
|
146
|
+
npx -y @fleox/agent3d@0.5.2 assets optimize --all --project my-hero --json
|
|
147
|
+
npx -y @fleox/agent3d@0.5.2 assets optimize --all --dry-run --project my-hero --json
|
|
148
|
+
npx -y @fleox/agent3d@0.5.2 assets optimize --all --yes --project my-hero --json
|
|
149
|
+
npx -y @fleox/agent3d@0.5.2 assets optimize assets/models/robot.glb --simplify 0.5 --yes --project my-game --json
|
|
150
|
+
npx -y @fleox/agent3d@0.5.2 assets optimize assets/textures/wood_planks --max-size 512 --format jpeg --yes --project my-banner --json
|
|
136
151
|
```
|
|
137
152
|
|
|
138
153
|
- **Smart size (default).** Each texture gets the smallest tier (256 / 512 / 1024 / 2048; up to 4096 for an equirect background) that still gives about one texel per screen pixel where the scene shows it: canvas size from the target (a hero ≈ 2880×1620 device px), object size (`fit`, geometry, scale) and closest camera distance (orbit zoom, scroll paths and timeline camera keys count), divided by `repeat`. Normal maps get ~0.75× and roughness ~0.5× of the colour size; a model's atlas ~1.5× its on-screen size. Heroes never go below 512 for colour maps; games and cards are capped at 1024. Textures not placed in `scene.json` (scripts, unused) get 1024. `--max-size <px>` forces one size for everything. Never upscales.
|
|
@@ -4,7 +4,7 @@ description: Build a 3D element for a web page from a brief with Agent3D - an an
|
|
|
4
4
|
license: PolyForm-Noncommercial-1.0.0
|
|
5
5
|
compatibility: Requires Node.js 22+ and Google Chrome (or Chromium/Edge) for renders.
|
|
6
6
|
metadata:
|
|
7
|
-
version: "0.
|
|
7
|
+
version: "0.5.2"
|
|
8
8
|
repository: "https://github.com/fleox/agent3d"
|
|
9
9
|
allowed-tools: Bash Read Write
|
|
10
10
|
---
|
|
@@ -15,9 +15,9 @@ Agent3D turns a JSON **scene** (`scene.json` in a project folder) into a 3D elem
|
|
|
15
15
|
|
|
16
16
|
**Language:** talk to the user in their language; keep commands, ids and files in English.
|
|
17
17
|
|
|
18
|
-
Every command is `npx -y @fleox/agent3d@0.
|
|
18
|
+
Every command is `npx -y @fleox/agent3d@0.5.2 <command> --json` and prints one object: `{"ok": true, "data": …}` or `{"ok": false, "error": {"code", "message", "hint"}}`. Read `error.hint` when `ok` is false: it says what to do. `npx -y @fleox/agent3d@0.5.2 help scene --json` lists any command's actions and options. Pass `--project <dir>` to every project command (default: the current directory).
|
|
19
19
|
|
|
20
|
-
First run on a machine: `npx -y @fleox/agent3d@0.
|
|
20
|
+
First run on a machine: `npx -y @fleox/agent3d@0.5.2 doctor --json` checks Node, Chrome and does a test render: `{ ok: true, data: { checks } }` when everything required passes, else `{ ok: false, error: { code: "doctor-failed", hint } }` (exit 1) with one hint per failed check and every check in `error.details.checks`. Without Chrome, renders and posters fail with a hint (install Chrome, or set `AGENT3D_CHROME`); `export --no-poster` still works.
|
|
21
21
|
|
|
22
22
|
## The loop
|
|
23
23
|
|
|
@@ -28,23 +28,23 @@ First run on a machine: `npx -y @fleox/agent3d@0.4.0 doctor --json` checks Node,
|
|
|
28
28
|
- **Motion**: calm ambient loop (default for banners), interactive (follow the pointer, hover, orbit), scroll-driven, or a game.
|
|
29
29
|
2. **Start** from a template or from the starter for the target:
|
|
30
30
|
```bash
|
|
31
|
-
npx -y @fleox/agent3d@0.
|
|
32
|
-
npx -y @fleox/agent3d@0.
|
|
33
|
-
npx -y @fleox/agent3d@0.
|
|
31
|
+
npx -y @fleox/agent3d@0.5.2 templates list --json
|
|
32
|
+
npx -y @fleox/agent3d@0.5.2 new bakery-banner --target banner --title "Golden Crust Bakery" --json
|
|
33
|
+
npx -y @fleox/agent3d@0.5.2 new bakery-banner --template banner-neon-title --title "Golden Crust Bakery" --json
|
|
34
34
|
```
|
|
35
35
|
Without `--template`, `new` writes an attractive valid starter for the target (banner: gradient background, studio lights, a floating 3D title, a few props, dust particles, a slow loop; game: + `scripts/game.js`). `--aspect 21:9` overrides the aspect.
|
|
36
36
|
3. **Learn what exists** before writing anything. Never guess ids or parameter names:
|
|
37
37
|
```bash
|
|
38
|
-
npx -y @fleox/agent3d@0.
|
|
39
|
-
npx -y @fleox/agent3d@0.
|
|
40
|
-
npx -y @fleox/agent3d@0.
|
|
41
|
-
npx -y @fleox/agent3d@0.
|
|
42
|
-
npx -y @fleox/agent3d@0.
|
|
38
|
+
npx -y @fleox/agent3d@0.5.2 catalog --json
|
|
39
|
+
npx -y @fleox/agent3d@0.5.2 catalog generators terrain --json
|
|
40
|
+
npx -y @fleox/agent3d@0.5.2 catalog behaviours --json
|
|
41
|
+
npx -y @fleox/agent3d@0.5.2 catalog postfx look --json
|
|
42
|
+
npx -y @fleox/agent3d@0.5.2 scene summary --project bakery-banner --json
|
|
43
43
|
```
|
|
44
44
|
Sections: geometries, materialPresets, shaders, textures (procedural, zero bytes), lightRigs, behaviours, generators, particlePresets, postfx (with the `look` presets and each effect's GPU cost), fonts, sounds. Built-in models, textures and HDRIs: `assets library --query <word>` (skill `agent3d-assets`). The field-by-field scene format is in the `agent3d-edit` skill (`references/patch-ops.md`).
|
|
45
45
|
4. **Build with patches** (small, reviewable, ids stay stable). Write the ops to a file and apply them:
|
|
46
46
|
```bash
|
|
47
|
-
npx -y @fleox/agent3d@0.
|
|
47
|
+
npx -y @fleox/agent3d@0.5.2 scene patch --project bakery-banner --file ops.json --json
|
|
48
48
|
```
|
|
49
49
|
```json
|
|
50
50
|
[
|
|
@@ -61,7 +61,7 @@ First run on a machine: `npx -y @fleox/agent3d@0.4.0 doctor --json` checks Node,
|
|
|
61
61
|
- **Gotcha:** `updateObject` and `merge` deep-merge. Switching `material.preset` with `updateObject` keeps the old `color` / `roughness` overrides (gold stays white). To change a look, **replace** the material: `{ "op": "set", "path": "objects#title.material", "value": { "preset": "gold" } }`.
|
|
62
62
|
5. **Render and LOOK** (this is the step that makes it good):
|
|
63
63
|
```bash
|
|
64
|
-
npx -y @fleox/agent3d@0.
|
|
64
|
+
npx -y @fleox/agent3d@0.5.2 render --project bakery-banner --sheet --count 4 --json
|
|
65
65
|
```
|
|
66
66
|
Then open `data.sheet` (a PNG contact sheet with time labels; paths are relative to the project folder `data.dir`) with the Read tool and judge it like an art director:
|
|
67
67
|
- **Framing at the aspect ratio**: nothing important cut at the edges; the subject reads at a glance; wide banners keep content in the central ~80% of the width.
|
|
@@ -76,22 +76,22 @@ First run on a machine: `npx -y @fleox/agent3d@0.4.0 doctor --json` checks Node,
|
|
|
76
76
|
- To show the user the motion: `--gif renders/preview.gif --duration 4` (or `--video <file>.mp4`, `--webp <file>.webp`); the path is relative to the project folder.
|
|
77
77
|
- `--isolate <objectId>` renders one object alone (no behaviours, scripts or UI), at the origin, auto-framed from the front three-quarter view (+Z front) on a neutral grey background, and returns `data.isolated.size`: the fastest way to check that a downloaded model faces +Z, stands upright and has a sensible size.
|
|
78
78
|
```bash
|
|
79
|
-
npx -y @fleox/agent3d@0.
|
|
79
|
+
npx -y @fleox/agent3d@0.5.2 render --project bakery-banner --isolate croissant-left --json
|
|
80
80
|
```
|
|
81
81
|
- Transparent scenes (`target.transparent`): frames keep their alpha and the contact sheet gets a checkerboard behind them; `--bg "#ffffff"` (any CSS colour) previews the scene over the host page's colour, frames included; `--bg none` turns it off.
|
|
82
82
|
6. **Fix and repeat** until it looks finished. Two or three iterations are normal; say what you changed and why.
|
|
83
83
|
7. **Check** until there are no errors and no warnings:
|
|
84
84
|
```bash
|
|
85
|
-
npx -y @fleox/agent3d@0.
|
|
85
|
+
npx -y @fleox/agent3d@0.5.2 check --project bakery-banner --render --json
|
|
86
86
|
```
|
|
87
87
|
It validates the scene, missing assets and scripts, the script sandbox, the triangle and KB budgets for the target, framing (with `--render`) and web settings (aria label, reduced motion, lazy start, pixel ratio cap), and lists licences that need attribution (`infos` with code `attribution`: keep those credits; the export writes `CREDITS.txt`).
|
|
88
88
|
- `data.budget.gpu` is the post-processing cost: `effects` (each with its `gpu` tier and passes), `passes`, `level` (`none`, `light`, `moderate`, `heavy`) and `dropped.low` (effects the `low` quality tier switches off on weak devices). A `postfx-cost` issue means too many fullscreen passes (a warning on games and fullscreen targets, an info elsewhere) or `ao` / `dof` on a game: keep the effects that change the image the most. Grading, vignette, film, chromatic and sharpen merge into one nearly free pass.
|
|
89
89
|
- Over the KB budget: `assets optimize` (skill `agent3d-assets`) shrinks project textures and models. Library assets are never shrunk there: the photographic `.hdr` files weigh 0.35 to 1.9 MB, so on banners and cards prefer a procedural `lighting` preset (`studio`, `soft`, `sunset`, `night`: zero bytes) plus a light rig.
|
|
90
90
|
8. **Export** and hand over:
|
|
91
91
|
```bash
|
|
92
|
-
npx -y @fleox/agent3d@0.
|
|
92
|
+
npx -y @fleox/agent3d@0.5.2 export --project bakery-banner --json
|
|
93
93
|
```
|
|
94
|
-
`data.snippet` is what goes in the page; `data.out` holds `agent3d-runtime/` (shared by every scene of the site), `<name>/` (scene, assets, poster, `CREDITS.txt`), `index.html` (a demo page), `snippet.html`, `head.html`, `EMBED.md` and `frameworks/` (React / Vue / Svelte wrappers). A second export into the same folder needs `--yes`. Give the user: the snippet, the folder to upload, the total size, the credits, and offer `serve` for a live look (`npx -y @fleox/agent3d@0.
|
|
94
|
+
`data.snippet` is what goes in the page; `data.out` holds `agent3d-runtime/` (shared by every scene of the site), `<name>/` (scene, assets, poster, `CREDITS.txt`), `index.html` (a demo page), `snippet.html`, `head.html`, `EMBED.md` and `frameworks/` (React / Vue / Svelte wrappers). A second export into the same folder needs `--yes`. Give the user: the snippet, the folder to upload, the total size, the credits, and offer `serve` for a live look (`npx -y @fleox/agent3d@0.5.2 serve --project bakery-banner --open`). Other formats (zip, single HTML file, poster image, MP4 / WebM video, GIF) and site integration: skill `agent3d-publish`.
|
|
95
95
|
|
|
96
96
|
## Bring a photo to life (3D photo)
|
|
97
97
|
|
|
@@ -99,12 +99,12 @@ When the user gives a photo or an image and wants it in 3D, with parallax, "movi
|
|
|
99
99
|
|
|
100
100
|
1. **Copy the image into the project** with its licence (ask who took it and under which licence; skill `agent3d-assets`):
|
|
101
101
|
```bash
|
|
102
|
-
npx -y @fleox/agent3d@0.
|
|
103
|
-
npx -y @fleox/agent3d@0.
|
|
102
|
+
npx -y @fleox/agent3d@0.5.2 new my-hero --template hero-photo-3d --title "Old Town Tours" --json
|
|
103
|
+
npx -y @fleox/agent3d@0.5.2 assets add ./photo.jpg --license CC0-1.0 --author "Jane Doe" --project my-hero --json
|
|
104
104
|
```
|
|
105
105
|
2. **Estimate its depth map** (local, ~1-3 s; the first run downloads the 27 MB model once, then it works offline):
|
|
106
106
|
```bash
|
|
107
|
-
npx -y @fleox/agent3d@0.
|
|
107
|
+
npx -y @fleox/agent3d@0.5.2 assets depth assets/textures/photo.jpg --project my-hero --json
|
|
108
108
|
```
|
|
109
109
|
It writes `assets/depth/photo-depth.png` (white = near) and returns `data.suggestion` (`{ "kind": "photo", "src", "depth" }`). Open the PNG with the Read tool: the subject should be lighter than the background.
|
|
110
110
|
3. **Point the photo object at it** (or add one with `object add --json-def`):
|
|
@@ -112,33 +112,81 @@ When the user gives a photo or an image and wants it in 3D, with parallax, "movi
|
|
|
112
112
|
[{ "op": "updateObject", "id": "photo", "set": { "src": "assets/textures/photo.jpg", "depth": "assets/depth/photo-depth.png", "strength": 0.5, "focus": 0.5 } }]
|
|
113
113
|
```
|
|
114
114
|
Cover the frame: with the camera at fov 35 and distance 10, a 16:9 frame is about 11.2 × 6.3 units, so a 3:2 photo needs `width` ≈ 11.9 (a 4:3 photo ≈ 11.2; a portrait photo needs `height` ≈ 6.6 and leaves side bars, so prefer a portrait `target.aspect` or a card). Keep the camera still: the photo's shader moves the view.
|
|
115
|
-
4. **Choose the mode**: `parallax` (default, 2 triangles) for hero banners and small motions; `mesh` (a displaced grid) when the view moves more, e.g. `motion.auto: "orbit"`; `layers` (depth slices) for a pop-up-book look. `motion`: `pointer` (0..1), `gyro` (phones), `auto` (`sway` default, `orbit`, `zoom`, `none
|
|
115
|
+
4. **Choose the mode**: `parallax` (default, 2 triangles) for hero banners and small motions; `mesh` (a displaced grid) when the view moves more, e.g. `motion.auto: "orbit"`; `layers` (depth slices) for a pop-up-book look. `motion`: `pointer` (0..1), `gyro` (phones), `auto` (`sway` default, `orbit`, `zoom`, `none`, or a cinematic move below: plays in renders, videos and on touch screens), `speed` (cycles per 10 s), `scroll`.
|
|
116
116
|
5. **Render and look**, then move the pointer to see the depth:
|
|
117
117
|
```bash
|
|
118
|
-
npx -y @fleox/agent3d@0.
|
|
119
|
-
npx -y @fleox/agent3d@0.
|
|
118
|
+
npx -y @fleox/agent3d@0.5.2 render --project my-hero --count 4 --sheet --json
|
|
119
|
+
npx -y @fleox/agent3d@0.5.2 render --project my-hero --frames 0.5,1,1.5,2 --sheet --input '[{"t": 0.1, "pointer": [-1, 0]}, {"t": 0.9, "pointer": [1, 0]}, {"t": 1.4, "pointer": [0, 1]}, {"t": 1.9, "pointer": [0, -1]}]' --json
|
|
120
120
|
```
|
|
121
121
|
Near things should slide against far things between frames, without smeared or doubled edges around the subject.
|
|
122
|
+
6. **Bigger moves: add a plate.** For `strength` ≥ 0.7, `mode: "mesh"`, or people / signs / poles in front of the background, build the background plate and set it on the photo (it shows what the foreground uncovers, instead of smears and stretched halos):
|
|
123
|
+
```bash
|
|
124
|
+
npx -y @fleox/agent3d@0.5.2 assets plate assets/textures/photo.jpg --project my-hero --json
|
|
125
|
+
```
|
|
126
|
+
```json
|
|
127
|
+
[{ "op": "updateObject", "id": "photo", "set": { "plate": "assets/depth/photo-plate.webp", "plateDepth": "assets/depth/photo-plate-depth.png" } }]
|
|
128
|
+
```
|
|
129
|
+
(`assets depth … --plate` does depth map + plate in one go.) Render again with pointer moves to the corners and compare the silhouettes.
|
|
130
|
+
|
|
131
|
+
**Cinematic moves** (a camera move from a single photo — set `motion.auto`, look at a sheet over one loop `--frames 0,2.5,5,7.5`):
|
|
132
|
+
|
|
133
|
+
| `auto` | Move | Good for |
|
|
134
|
+
|---|---|---|
|
|
135
|
+
| `dolly` | slow push in toward the `focus` plane (a Ken Burns with depth) | streets, interiors, products, portraits |
|
|
136
|
+
| `pan` | lateral truck left → right | landscapes, skylines, wide shots |
|
|
137
|
+
| `rise` | crane up, pushing in a little | buildings, mountains, reveals |
|
|
138
|
+
| `vertigo` | dolly zoom: the `focus` plane keeps its size while the background swells | dramatic subjects with a deep background (set `focus` to the subject's depth) |
|
|
139
|
+
|
|
140
|
+
They loop seamlessly every 10 / `speed` s (ping-pong, safe for video loops); `"loop": false` plays one move over `motion.duration` seconds and holds; `"progress": 0..1` freezes the move, and a timeline track `"<id>.motion.progress"` drives it (scroll story: `timeline.trigger: "scroll"`, see the `photo-scroll-story` template; crossfade photos with `"<id>.material.opacity"` tracks). Defaults are artefact-free at any `strength`; reduced motion keeps the photo still.
|
|
141
|
+
|
|
142
|
+
**Social video** in one line (1080×1920, 30 fps, one seamless loop of the move, MP4 H.264 ~10 Mbit/s, the photo covers the vertical frame — no edges; `notes` say what was cropped):
|
|
143
|
+
```bash
|
|
144
|
+
npx -y @fleox/agent3d@0.5.2 render --project my-hero --video renders/reel.mp4 --preset vertical --json # or square / landscape / story
|
|
145
|
+
```
|
|
146
|
+
Check the framing first with PNGs: `render --preset vertical --count 4 --sheet`. Text placed for 16:9 gets cropped in 9:16: make the headline narrower or drop it for the video.
|
|
122
147
|
|
|
123
148
|
Tips:
|
|
124
149
|
|
|
125
|
-
- `strength`: 0.5 by default; parallax holds a bold 0.7-0.9 (hero banners), mesh ~0.7 with the photo slightly wider than the frame (its border shows otherwise), layers ~0.6 (halos around subjects above that).
|
|
150
|
+
- `strength`: 0.5 by default; parallax holds a bold 0.7-0.9 (hero banners), mesh ~0.7 with the photo slightly wider than the frame (its border shows otherwise), layers ~0.6 (halos around subjects above that). When silhouettes smear, add a plate (step 6) or lower it, and check with `render --input` pointer moves to the corners.
|
|
126
151
|
- `focus` = the subject's depth (0 far … 1 near, read it from the depth map: a mid-grey subject ≈ 0.5): the subject stays put and the rest moves around it, which reads as depth instead of wobble.
|
|
127
152
|
- Headlines: put them over a calm area of the photo (sky, wall, blurred background), use `"material": { "type": "basic", "color": "#ffffff" }` and `target.toneMapping: "none"` so white stays white (photos themselves are never tone mapped), and check the contrast in the render. A kerned 3D title (`depth` > 0, lit material) also works over a darker photo.
|
|
128
153
|
- `check` reports `photo-depth-aspect` (regenerate the depth map after cropping the photo), `photo-heavy` (over 1.5 MB: `assets optimize`) and `photo-depth-lossy` (keep the depth map a PNG). A covering photo is never reported as `clipped`.
|
|
129
|
-
- **Web weight**: before exporting, run `npx -y @fleox/agent3d@0.
|
|
130
|
-
- Exports copy the photo
|
|
154
|
+
- **Web weight**: before exporting, run `npx -y @fleox/agent3d@0.5.2 assets optimize --all --yes --project my-hero --json`: the photo becomes WebP at the size the hero needs (about 40 % lighter; the scene path is rewritten) and the depth map stays a lossless PNG (already ≤ 1024 px from `assets depth`: the model works at 518 px). A photo-only hero then weighs about 0.4 MB of images plus the runtime.
|
|
155
|
+
- Exports copy the photo, its depth map and its plate like any asset; the model never ships.
|
|
156
|
+
|
|
157
|
+
**Depth effects** (`"effects"` on the photo object, every mode, kept by the 19 KB photo player; `{}` = defaults; full table in docs/scene-format.md "Photo effects"):
|
|
158
|
+
|
|
159
|
+
- Fog (distance haze, drifting wisps): `"fog": { "color": "#c9d6ea", "amount": 0.55 }`. Match the colour to the sky; `start` (default 0.7) = the depth where the haze begins, lower it to keep more of the scene clear.
|
|
160
|
+
- Light (a flashlight / sunbeam raking the relief, follows the pointer, a slow auto path in renders): `"light": { "color": "#ffe2b0", "ambient": 0.55, "height": 0.45 }`. Lower `ambient` = darker surroundings and a stronger pool; lower `height` = more raking. Check it with `render --input` pointer moves.
|
|
161
|
+
- Reveal (the photo appears slice by slice, far first): `"reveal": { "duration": 2.5, "delay": 0.3 }` (an intro), `"from": "near"` for the subject first; set `target.posterTime` after the reveal ends so the poster is not empty.
|
|
162
|
+
- Blur (rack focus / depth of field, a lens-like soft blur away from the focus depth): `"blur": { "focus": 0.7, "to": 0.05, "duration": 3, "delay": 0.5 }` racks from the foreground (0.7) to the far distance and back, in a loop (`duration` s per leg); without `to` the focus stays put. Look at the depth map first to pick depths (white = 1 near). `amount` = max blur radius in % of the photo width (default 0.6; 0.6–1 reads as a lens).
|
|
163
|
+
- Frame ("out of frame": the photo in a smaller frame, the near subject stepping out over the page): `"frame": { "inset": [0.2, 0.22], "threshold": 0.6, "color": "#2a2520", "border": 0.012 }`. Pick a photo with a clear near subject crossing where the frame edge will be (a head above the top edge, an object beside it) and put `threshold` between the subject's depth and the background's. Outside the frame the page (scene background) shows: give it a colour matching the photo's ground if the ground is near (it pops out too). `"focus"` below the subject's depth (e.g. 0.3) makes the subject slide over the border when the view moves. Reads best in `parallax` mode.
|
|
164
|
+
- Animate them from the timeline: `{ "target": "photo.effects.light.position", "keys": [[0, [-0.9, 0.5]], [4, [0.9, 0.5]]], "ease": "inOutSine" }` (with `"follow": "none"`), `photo.effects.fog.amount`, `photo.effects.reveal.progress`, `photo.effects.blur.focus` (a rack on your own timing), `photo.effects.frame.inset` (the frame closing in).
|
|
165
|
+
|
|
166
|
+
### Title behind the subject (3D inside the photo)
|
|
167
|
+
|
|
168
|
+
When the user wants the 3D content *inside* the picture (a title passing behind the nearest building, snow falling in front of and behind a person, a 3D logo standing on a table in the photo), set `"occlude": true` on the photo. It then writes the true depth of its pixels, so objects placed between its depth planes are hidden by its nearer parts, and its pointer / gyro / auto motion moves the real camera so they slide exactly with the photo. Start from the `photo-title-inside` template (`new my-hero --template photo-title-inside`).
|
|
169
|
+
|
|
170
|
+
1. Turn it on: `[{ "op": "set", "path": "objects#photo.occlude", "value": true }]`.
|
|
171
|
+
2. Read where the photo's depths are: `npx -y @fleox/agent3d@0.5.2 scene summary --project my-hero --json` → the photo's `depthRange: [zFar, zNear]` (world z of its depth-0 and depth-1 pixels; the `focus` depth is at the photo's own z). A depth-map value d sits at about `z = (d - focus) × strength × width × 0.25` (exact formula in `docs/scene-format.md`, "3D inside the photo").
|
|
172
|
+
3. Place the title: z a little smaller (farther) than the depth of the subject that should cover it, larger than what should stay behind it; x / y so the subject overlaps part of the letters. E.g. a street at `strength` 0.8, `focus` 0.45, `width` 11.9: the sky is at z ≈ -1.2, the nearest facade at z ≈ 1.15, a title at z ≈ -0.15 (depth ≈ 0.4) is covered at both ends by the nearest buildings; a subtitle at z ≈ 0.35 stays in front.
|
|
173
|
+
4. Particles: give them an `area` whose z spans the whole range (e.g. `"area": [12, 8, 4]` centred at z ≈ 0.4) so they fall in front of and behind the subject.
|
|
174
|
+
5. Render with the pointer at the corners and look: the subject must cover the letters at the same place in every frame (no sliding of the title over the facade):
|
|
175
|
+
```bash
|
|
176
|
+
npx -y @fleox/agent3d@0.5.2 render --project my-hero --frames 0.5,1.5,2.5,3.5 --sheet --input '[{"t":0.5,"pointer":[-1,0.7]},{"t":1.5,"pointer":[1,-0.7]},{"t":2.5,"pointer":[1,1]},{"t":3.5,"pointer":[-1,-1]}]' --json
|
|
177
|
+
```
|
|
178
|
+
Too much hidden → move the title nearer (larger z) or away from the subject; nothing hidden → farther (smaller z) or overlapping the subject. Keep the camera looking straight at the photo (the default set-up). Without `occlude`, `check` reports objects inside a photo's depth range (`photo-occlude`): leave it off for a headline meant to float over the picture.
|
|
131
179
|
|
|
132
180
|
## Other front doors: MCP and the Studio
|
|
133
181
|
|
|
134
182
|
Everything above also works without the shell:
|
|
135
183
|
|
|
136
|
-
- **MCP server** — `agent3d mcp` serves one project folder over stdio: the same tools as `tools list` (scene_patch, check, export…) plus `render_preview`, whose contact sheet comes back as an image the client can look at. Claude Code: `claude mcp add agent3d -- npx -y @fleox/agent3d@0.
|
|
184
|
+
- **MCP server** — `agent3d mcp` serves one project folder over stdio: the same tools as `tools list` (scene_patch, check, export…) plus `render_preview`, whose contact sheet comes back as an image the client can look at. Claude Code: `claude mcp add agent3d -- npx -y @fleox/agent3d@0.5.2 mcp --project /path/to/my-banner` (add `--scope project` to write `.mcp.json` for the repository). Claude Desktop / Cursor: in `claude_desktop_config.json` / `.cursor/mcp.json`:
|
|
137
185
|
```json
|
|
138
|
-
{ "mcpServers": { "agent3d": { "command": "npx", "args": ["-y", "@fleox/agent3d@0.
|
|
186
|
+
{ "mcpServers": { "agent3d": { "command": "npx", "args": ["-y", "@fleox/agent3d@0.5.2", "mcp", "--project", "/Users/me/agent3d/my-banner"] } } }
|
|
139
187
|
```
|
|
140
188
|
`--read-only` exposes only the tools that don't write. Desktop apps may not see the shell's `PATH`: use the absolute path of `npx` as `command` if the server doesn't start.
|
|
141
|
-
- **Studio** — `npx -y @fleox/agent3d@0.
|
|
189
|
+
- **Studio** — `npx -y @fleox/agent3d@0.5.2 studio --project bakery-banner` opens a visual editor on the same folder (viewport with move / rotate / scale gizmos, outliner, inspector, timeline, catalog and library, templates, check, render and export dialogs; English or French). It prints its local URL and runs until stopped. Edits go through the same validated tools, and changes you make from the CLI appear live in it, so the user can watch and tweak your work. The viewport starts in edit mode (scripts don't run, the timeline is paused and scrubbed); interact mode (`I`) runs the scene as the website does: scripts, hover / click / scroll triggers.
|
|
142
190
|
|
|
143
191
|
## Art direction that looks professional
|
|
144
192
|
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Numbers that work with the Agent3D runtime (ACES tone mapping by default, physically based lights, units ≈ metres). Start from them, render, look, adjust. Exact parameters live in the catalog — never guess them:
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npx -y @fleox/agent3d@0.
|
|
7
|
-
npx -y @fleox/agent3d@0.
|
|
8
|
-
npx -y @fleox/agent3d@0.
|
|
6
|
+
npx -y @fleox/agent3d@0.5.2 catalog lightRigs --json
|
|
7
|
+
npx -y @fleox/agent3d@0.5.2 catalog postfx look --json
|
|
8
|
+
npx -y @fleox/agent3d@0.5.2 catalog materialPresets --json
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
Complete, rendered scenes for each idea below: [recipes.md](recipes.md).
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
Each scene below passed `scene validate` (no errors, no warnings) and `check --render`, and was rendered and looked at (the README images in `docs/images/recipe-*.jpg` come from them). Start from the closest one, then change the brand parts (text, colours, model, URLs) with `scene patch` and render again:
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npx -y @fleox/agent3d@0.
|
|
7
|
-
npx -y @fleox/agent3d@0.
|
|
8
|
-
npx -y @fleox/agent3d@0.
|
|
9
|
-
npx -y @fleox/agent3d@0.
|
|
10
|
-
npx -y @fleox/agent3d@0.
|
|
6
|
+
npx -y @fleox/agent3d@0.5.2 new my-scene --target hero --json
|
|
7
|
+
npx -y @fleox/agent3d@0.5.2 scene validate --project my-scene --file recipe.json --json
|
|
8
|
+
npx -y @fleox/agent3d@0.5.2 scene apply --project my-scene --file recipe.json --yes --json
|
|
9
|
+
npx -y @fleox/agent3d@0.5.2 check --render --project my-scene --json
|
|
10
|
+
npx -y @fleox/agent3d@0.5.2 render --project my-scene --sheet --count 4 --json
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
Exact parameters of every rig, look, material, shader, generator and behaviour: `npx -y @fleox/agent3d@0.
|
|
13
|
+
Exact parameters of every rig, look, material, shader, generator and behaviour: `npx -y @fleox/agent3d@0.5.2 catalog <section> [id] --json`. Premium starting points per target kind: [art-direction.md](art-direction.md#premium-defaults).
|
|
14
14
|
|
|
15
15
|
## Product shot (1:1): softbox packshot
|
|
16
16
|
|
|
@@ -4,7 +4,7 @@ description: Change an existing Agent3D project - summarise the scene, then patc
|
|
|
4
4
|
license: PolyForm-Noncommercial-1.0.0
|
|
5
5
|
compatibility: Requires Node.js 22+ and Google Chrome (or Chromium/Edge) for renders.
|
|
6
6
|
metadata:
|
|
7
|
-
version: "0.
|
|
7
|
+
version: "0.5.2"
|
|
8
8
|
repository: "https://github.com/fleox/agent3d"
|
|
9
9
|
allowed-tools: Bash Read Write
|
|
10
10
|
---
|
|
@@ -15,23 +15,23 @@ A project is a folder with `agent3d.json`, `scene.json` (the scene), `assets/` (
|
|
|
15
15
|
|
|
16
16
|
**Language:** talk to the user in their language; keep commands, ids and files in English.
|
|
17
17
|
|
|
18
|
-
Every command is `npx -y @fleox/agent3d@0.
|
|
18
|
+
Every command is `npx -y @fleox/agent3d@0.5.2 <command> --json` with `--project <dir>`. Read `error.hint` when `ok` is false.
|
|
19
19
|
|
|
20
20
|
## 1. Understand before changing
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
npx -y @fleox/agent3d@0.
|
|
24
|
-
npx -y @fleox/agent3d@0.
|
|
25
|
-
npx -y @fleox/agent3d@0.
|
|
23
|
+
npx -y @fleox/agent3d@0.5.2 info --project my-banner --json
|
|
24
|
+
npx -y @fleox/agent3d@0.5.2 scene summary --project my-banner --json
|
|
25
|
+
npx -y @fleox/agent3d@0.5.2 render --project my-banner --sheet --json
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
Look at the sheet (Read the `data.sheet` PNG, relative to the project folder `data.dir`), then tell the user in two or three sentences what the scene contains (target and aspect, the main objects, the motion) before proposing changes. Read details on demand:
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
|
-
npx -y @fleox/agent3d@0.
|
|
32
|
-
npx -y @fleox/agent3d@0.
|
|
33
|
-
npx -y @fleox/agent3d@0.
|
|
34
|
-
npx -y @fleox/agent3d@0.
|
|
31
|
+
npx -y @fleox/agent3d@0.5.2 object get title --project my-banner --json
|
|
32
|
+
npx -y @fleox/agent3d@0.5.2 scene get --path objects#title.material --project my-banner --json
|
|
33
|
+
npx -y @fleox/agent3d@0.5.2 timeline get --project my-banner --json
|
|
34
|
+
npx -y @fleox/agent3d@0.5.2 catalog behaviours float --json
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
## 2. Patch
|
|
@@ -39,8 +39,8 @@ npx -y @fleox/agent3d@0.4.0 catalog behaviours float --json
|
|
|
39
39
|
Put the ops in a file (or pass them inline as one JSON argument) and apply:
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
|
-
npx -y @fleox/agent3d@0.
|
|
43
|
-
npx -y @fleox/agent3d@0.
|
|
42
|
+
npx -y @fleox/agent3d@0.5.2 scene patch --project my-banner --file ops.json --dry-run --json
|
|
43
|
+
npx -y @fleox/agent3d@0.5.2 scene patch --project my-banner --file ops.json --json
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
| Op | Shape | Use |
|
|
@@ -63,11 +63,11 @@ npx -y @fleox/agent3d@0.4.0 scene patch --project my-banner --file ops.json --js
|
|
|
63
63
|
Shortcuts for one object (same validation, same plans):
|
|
64
64
|
|
|
65
65
|
```bash
|
|
66
|
-
npx -y @fleox/agent3d@0.
|
|
67
|
-
npx -y @fleox/agent3d@0.
|
|
68
|
-
npx -y @fleox/agent3d@0.
|
|
69
|
-
npx -y @fleox/agent3d@0.
|
|
70
|
-
npx -y @fleox/agent3d@0.
|
|
66
|
+
npx -y @fleox/agent3d@0.5.2 object update title --set material.color="#ffd166" --set size=0.9 --project my-banner --json
|
|
67
|
+
npx -y @fleox/agent3d@0.5.2 object add --id ball --geometry sphere --set geometry.radius=0.4 --set 'position=[3,0,0]' --project my-banner --json
|
|
68
|
+
npx -y @fleox/agent3d@0.5.2 object move gem --parent props --project my-banner --json
|
|
69
|
+
npx -y @fleox/agent3d@0.5.2 object remove pill --project my-banner --json
|
|
70
|
+
npx -y @fleox/agent3d@0.5.2 object remove pill --yes --project my-banner --json
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
`--set` takes dotted keys and JSON values (`--set 'position=[0,1,0]'`, `--set visible=false`). More recipes per task (materials, lights, camera, timeline, behaviours, post effects): [references/patch-ops.md](references/patch-ops.md).
|
|
@@ -80,10 +80,10 @@ npx -y @fleox/agent3d@0.4.0 object remove pill --yes --project my-banner --json
|
|
|
80
80
|
- property: `position`, `position.x`, `rotation.y` (degrees), `scale`, `visible`, `material.opacity` / `color` / `emissiveIntensity` / `roughness`…, `material.uniforms.<name>`; lights `intensity`, `color`; camera `position`, `target`, `fov`, `focus`; `environment.fog.density`, `environment.exposure`; `postfx.<type>.<param>` (an effect written in `postfx` or brought by a `look` preset, e.g. `postfx.bloom.strength` with `{ "type": "look", "preset": "product" }`); models `morph.<name>`, `animation.<clip>.weight`.
|
|
81
81
|
- **Keys** are `[time, value]` or `[time, value, ease]` (the ease shapes the segment ending at that key) sorted by time. Values: numbers, `[x, y, z]`, colours, booleans, or relative strings `"+=0.5"`, `"-=1"`, `"*=1.2"` (from the rest value). The track `ease` (default `linear`) is `step`, `in` / `out` / `inOut` + `Quad`, `Cubic`, `Quart`, `Quint`, `Sine`, `Expo`, `Circ`, `Back`, `Elastic`, `Bounce`, or `"cubicBezier(0.16, 1, 0.3, 1)"`, `"spring(170, 12)"`, `"steps(4)"`. Multi-target selectors take `stagger` (seconds between targets) and `staggerFrom` (`start`, `end`, `center`, `edges`, `random`). Colour keys blend in OKLCh (saturated midpoints); `"colorSpace": "rgb"|"oklab"|"hsl"` on the track changes it.
|
|
82
82
|
```bash
|
|
83
|
-
npx -y @fleox/agent3d@0.
|
|
84
|
-
npx -y @fleox/agent3d@0.
|
|
85
|
-
npx -y @fleox/agent3d@0.
|
|
86
|
-
npx -y @fleox/agent3d@0.
|
|
83
|
+
npx -y @fleox/agent3d@0.5.2 timeline set --duration 10 --loop true --trigger visible --project my-banner --json
|
|
84
|
+
npx -y @fleox/agent3d@0.5.2 timeline add-track --target logo.rotation.y --keys "[[0,0],[10,360]]" --project my-banner --json
|
|
85
|
+
npx -y @fleox/agent3d@0.5.2 timeline add-track --target gem.position.y --keys '[[0,"+=0"],[1,"+=0.6","outBack"],[2,"+=0","inOutSine"]]' --project my-banner --json
|
|
86
|
+
npx -y @fleox/agent3d@0.5.2 timeline remove-track --target logo.rotation.y --yes --project my-banner --json
|
|
87
87
|
```
|
|
88
88
|
- Loops: the last key equals the first. Triggers: `load`, `visible` (default), `hover`, `click`, `scroll` (time = scroll progress; tune with `timeline.scroll`), `manual` (only interactions move it).
|
|
89
89
|
- **Markers and segments** name moments and ranges (`markers: { "lifted": 2.6 }`, `segments: { "hover-in": [2, "lifted"] }`); `autoplay: "intro"` plays only that segment on the trigger. **Interactions** (`scene.interactions`) wire hover / click / scroll / key / marker events to actions: play or toggle a segment, tween a property (`set`), `openUrl` (click / key only), emit an event, play a model clip. Agents on MCP or `tools call` can use the `interactions_set` tool (`{ "add": [...] }` or `{ "interactions": [...] }`, `dryRun`).
|
|
@@ -104,14 +104,14 @@ npx -y @fleox/agent3d@0.4.0 object remove pill --yes --project my-banner --json
|
|
|
104
104
|
The embed keeps the scene's aspect ratio at every width. A 4:1 banner is only ~98 px tall on a 390 px phone:
|
|
105
105
|
|
|
106
106
|
```bash
|
|
107
|
-
npx -y @fleox/agent3d@0.
|
|
107
|
+
npx -y @fleox/agent3d@0.5.2 render --project my-banner --size 390x98 --scale 2 --frames 2 --json
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
If the title becomes unreadable: shorter text, bigger `size`, fewer props, or a separate mobile version (a copy of the project with `target.aspect` "4:3" or `target.height`, exported under another `--name`, switched with CSS media queries on the page).
|
|
111
111
|
|
|
112
112
|
## 6. Finish
|
|
113
113
|
|
|
114
|
-
`npx -y @fleox/agent3d@0.
|
|
114
|
+
`npx -y @fleox/agent3d@0.5.2 check --project my-banner --render --json` until no errors and no warnings, then re-export (`export --yes` overwrites the previous export folder; tell the user to re-upload `<name>/` and, after an Agent3D update, `agent3d-runtime/`). Skill `agent3d-publish` covers the site side.
|
|
115
115
|
|
|
116
116
|
## Rules
|
|
117
117
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Patch ops cookbook
|
|
2
2
|
|
|
3
|
-
Apply with `npx -y @fleox/agent3d@0.
|
|
3
|
+
Apply with `npx -y @fleox/agent3d@0.5.2 scene patch --project <dir> --file ops.json --json` (add `--dry-run` to preview, `--yes` when the plan removes something or replaces a whole collection such as `lights`, `postfx`, `objects`, `timeline.tracks` or `ui.elements`: `plan.replaces` lists them). Ops run in order on a copy; the result is validated; on any error nothing is written and the error names the failing op (`details.opIndex`).
|
|
4
4
|
|
|
5
5
|
## Paths
|
|
6
6
|
|
|
@@ -46,7 +46,7 @@ A 3D photo (the depth map comes from `assets depth <image>`, skill `agent3d-asse
|
|
|
46
46
|
{ "op": "addObject", "object": { "id": "photo", "kind": "photo", "src": "assets/textures/photo.jpg", "depth": "assets/depth/photo-depth.png", "mode": "parallax", "width": 11.9, "strength": 0.3, "focus": 0.5, "motion": { "pointer": 1, "gyro": true, "auto": "sway", "speed": 1 } } }
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
Fields: `mode` (`parallax` default, `mesh`, `layers`), `width` / `height` (world units; the height follows the image aspect), `strength` (0..1, default 0.5), `focus` (the depth that stays still, 0 far … 1 near), `segments` (mesh), `layers` (layers), `edgeCut` (mesh / layers: hide stretched edges, default 0.08), `motion` (`pointer`, `scroll`, `gyro`, `auto`: `sway` / `orbit` / `zoom` / `none`, `speed`, `smoothing`), `material` (only `opacity`, `color` tint, `emissiveIntensity`). Photos are unlit and not tone mapped. Without `depth` the photo is flat (`validate` warns).
|
|
49
|
+
Fields: `mode` (`parallax` default, `mesh`, `layers`), `width` / `height` (world units; the height follows the image aspect), `strength` (0..1, default 0.5), `focus` (the depth that stays still, 0 far … 1 near), `segments` (mesh), `layers` (layers), `edgeCut` (mesh / layers: hide stretched edges, default 0.08), `motion` (`pointer`, `scroll`, `gyro`, `auto`: `sway` / `orbit` / `zoom` / `none`, `speed`, `smoothing`), `material` (only `opacity`, `color` tint, `emissiveIntensity`), `plate` + `plateDepth` (the background plate from `assets plate <image>`: shown where moving foreground uncovers the background; both or none). Photos are unlit and not tone mapped. Without `depth` the photo is flat (`validate` warns).
|
|
50
50
|
|
|
51
51
|
## Text and letters
|
|
52
52
|
|
|
@@ -244,7 +244,7 @@ These play the segments of the markers block above (a segment must exist before
|
|
|
244
244
|
- Segments named in `play` / `toggle` must exist in `timeline.segments` (validation says so). Targets get a pointer cursor.
|
|
245
245
|
- Without patches (MCP or the CLI tool runner): `interactions_set` appends with `add` or replaces with `interactions`:
|
|
246
246
|
```bash
|
|
247
|
-
npx -y @fleox/agent3d@0.
|
|
247
|
+
npx -y @fleox/agent3d@0.5.2 tools call interactions_set --input '{"add": [{"on": "click", "target": "blob", "do": [{"toggle": "hover-in"}]}], "dryRun": true}' --project my-hero --json
|
|
248
248
|
```
|
|
249
249
|
- Check hover states headless: `render --input '[{"t": 1.9, "pointer": [0, -0.3]}]' --frames 2,3`.
|
|
250
250
|
|