@fleox/agent3d 0.3.0 → 0.3.1
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 +10 -10
- package/changelog.json +11 -0
- package/dist/agent/agent3d.mjs +11 -11
- package/dist/agent/chunks/{depth-Dih8jLqx.mjs → depth-BZT4gseQ.mjs} +1 -1
- package/dist/agent/chunks/{depth-0bZsQn6N.mjs → depth-CD_ql3QJ.mjs} +1 -1
- package/dist/agent/chunks/{export-Cdqt3mt_.mjs → export-bJwh2SqG.mjs} +4 -2
- package/dist/agent/chunks/{package-d5e08XSG.mjs → package-fMbw9UGh.mjs} +1 -1
- package/dist/agent/chunks/{tools-Cv6N_YBI.mjs → tools-Cm4BqDkO.mjs} +4 -4
- package/dist/runtime/agent3d-runtime.js +2 -2
- package/dist/runtime/agent3d-runtime.single.js +75 -75
- package/dist/runtime/chunks/{photo-BlDYgYFM.js → photo-DNf14X7B.js} +9 -9
- package/dist/studio/assets/{assets-BFJsr9Oo.js → assets-BW5lQkYR.js} +1 -1
- package/dist/studio/assets/{camera-DT0xHipx.js → camera-BgzPVnn-.js} +1 -1
- package/dist/studio/assets/{editor-BjgHj9g8.js → editor-NkBUKsDB.js} +1 -1
- package/dist/studio/assets/{game-BXZEc9HN.js → game-DARpu0ah.js} +3 -3
- package/dist/studio/assets/{generators-DqkPMEzm.js → generators-BjIs-kHx.js} +1 -1
- package/dist/studio/assets/{index-DVTzVcBD.js → index-L-N-e2KM.js} +8 -8
- package/dist/studio/assets/{model-BqQW4Dg-.js → model-CqI8j03Z.js} +1 -1
- package/dist/studio/assets/{params-gVpEEiSK.js → params-DhsDKSDs.js} +1 -1
- package/dist/studio/assets/{photo-DRoVO5iZ.js → photo-DAHd1yNF.js} +9 -9
- package/dist/studio/assets/{physicsHost-DNdZ7AsT.js → physicsHost-tEUto2-_.js} +1 -1
- package/dist/studio/assets/{postfx-JFUGdY0d.js → postfx-BGu30OJK.js} +1 -1
- package/dist/studio/assets/{runtime-CMAP4azF.js → runtime-C_qkIpAK.js} +4 -4
- package/dist/studio/assets/{shaders-C7u6rN_6.js → shaders-Dt6FGXH_.js} +1 -1
- package/dist/studio/assets/{svg-DkIOJjzS.js → svg-ZZt5MdNf.js} +1 -1
- package/dist/studio/assets/{text-LISSAism.js → text-B-HM422i.js} +1 -1
- package/dist/studio/index.html +1 -1
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/skills/agent3d-assets/SKILL.md +27 -27
- package/plugin/skills/agent3d-create/SKILL.md +28 -27
- 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 +2 -2
- package/plugin/skills/agent3d-game/SKILL.md +7 -7
- package/plugin/skills/agent3d-publish/SKILL.md +21 -21
- package/plugin/skills/agent3d-publish/references/integrations.md +1 -1
- package/templates/hero-photo-3d/assets/depth/street-depth.png +0 -0
- package/templates/hero-photo-3d/assets/manifest.json +3 -3
- package/templates/hero-photo-3d/assets/textures/street.webp +0 -0
- package/templates/hero-photo-3d/scene.json +1 -1
- package/templates/hero-photo-3d/assets/textures/street.jpg +0 -0
|
@@ -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.3.
|
|
7
|
+
version: "0.3.1"
|
|
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.3.
|
|
16
|
+
Every command is `npx -y @fleox/agent3d@0.3.1 <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.3.0 <command> --json` with `--project
|
|
|
25
25
|
## The built-in library
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
npx -y @fleox/agent3d@0.3.
|
|
29
|
-
npx -y @fleox/agent3d@0.3.
|
|
30
|
-
npx -y @fleox/agent3d@0.3.
|
|
28
|
+
npx -y @fleox/agent3d@0.3.1 assets library --query tree --json
|
|
29
|
+
npx -y @fleox/agent3d@0.3.1 assets library --kind hdri --json
|
|
30
|
+
npx -y @fleox/agent3d@0.3.1 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.3.
|
|
37
|
-
npx -y @fleox/agent3d@0.3.
|
|
36
|
+
npx -y @fleox/agent3d@0.3.1 assets library --kind model --offset 50 --json
|
|
37
|
+
npx -y @fleox/agent3d@0.3.1 assets library --kind model --all --json
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
```json
|
|
@@ -51,9 +51,9 @@ npx -y @fleox/agent3d@0.3.0 assets library --kind model --all --json
|
|
|
51
51
|
## Searching free sources (network)
|
|
52
52
|
|
|
53
53
|
```bash
|
|
54
|
-
npx -y @fleox/agent3d@0.3.
|
|
55
|
-
npx -y @fleox/agent3d@0.3.
|
|
56
|
-
npx -y @fleox/agent3d@0.3.
|
|
54
|
+
npx -y @fleox/agent3d@0.3.1 assets search "wood planks" --kind texture --project my-scene --json
|
|
55
|
+
npx -y @fleox/agent3d@0.3.1 assets search sunset --kind hdri --source polyhaven --project my-scene --json
|
|
56
|
+
npx -y @fleox/agent3d@0.3.1 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.3.
|
|
64
|
+
npx -y @fleox/agent3d@0.3.1 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.3.
|
|
70
|
+
npx -y @fleox/agent3d@0.3.1 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.3.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.3.
|
|
78
|
+
npx -y @fleox/agent3d@0.3.1 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.3.
|
|
87
|
-
npx -y @fleox/agent3d@0.3.
|
|
88
|
-
npx -y @fleox/agent3d@0.3.
|
|
86
|
+
npx -y @fleox/agent3d@0.3.1 assets add ./logo.svg --license proprietary --project my-banner --json
|
|
87
|
+
npx -y @fleox/agent3d@0.3.1 assets add ./bottle.glb --license proprietary --author "Acme" --project my-banner --json
|
|
88
|
+
npx -y @fleox/agent3d@0.3.1 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,11 +103,11 @@ 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.3.
|
|
107
|
-
npx -y @fleox/agent3d@0.3.
|
|
106
|
+
npx -y @fleox/agent3d@0.3.1 assets add ./street.jpg --license CC0-1.0 --author "Jane Doe" --project my-hero --json
|
|
107
|
+
npx -y @fleox/agent3d@0.3.1 assets depth assets/textures/street.jpg --project my-hero --json
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
-
- **Output.** `data.path` = `assets/depth/<photo name>-depth.png` (`--out` to change), at the photo size capped at
|
|
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.
|
|
@@ -116,9 +116,9 @@ npx -y @fleox/agent3d@0.3.0 assets depth assets/textures/street.jpg --project my
|
|
|
116
116
|
## Listing and removing
|
|
117
117
|
|
|
118
118
|
```bash
|
|
119
|
-
npx -y @fleox/agent3d@0.3.
|
|
120
|
-
npx -y @fleox/agent3d@0.3.
|
|
121
|
-
npx -y @fleox/agent3d@0.3.
|
|
119
|
+
npx -y @fleox/agent3d@0.3.1 assets list --project my-scene --json
|
|
120
|
+
npx -y @fleox/agent3d@0.3.1 assets remove assets/textures/old.jpg --project my-scene --json
|
|
121
|
+
npx -y @fleox/agent3d@0.3.1 assets remove assets/textures/old.jpg --yes --project my-scene --json
|
|
122
122
|
```
|
|
123
123
|
|
|
124
124
|
`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 +128,11 @@ npx -y @fleox/agent3d@0.3.0 assets remove assets/textures/old.jpg --yes --projec
|
|
|
128
128
|
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
129
|
|
|
130
130
|
```bash
|
|
131
|
-
npx -y @fleox/agent3d@0.3.
|
|
132
|
-
npx -y @fleox/agent3d@0.3.
|
|
133
|
-
npx -y @fleox/agent3d@0.3.
|
|
134
|
-
npx -y @fleox/agent3d@0.3.
|
|
135
|
-
npx -y @fleox/agent3d@0.3.
|
|
131
|
+
npx -y @fleox/agent3d@0.3.1 assets optimize --all --project my-hero --json
|
|
132
|
+
npx -y @fleox/agent3d@0.3.1 assets optimize --all --dry-run --project my-hero --json
|
|
133
|
+
npx -y @fleox/agent3d@0.3.1 assets optimize --all --yes --project my-hero --json
|
|
134
|
+
npx -y @fleox/agent3d@0.3.1 assets optimize assets/models/robot.glb --simplify 0.5 --yes --project my-game --json
|
|
135
|
+
npx -y @fleox/agent3d@0.3.1 assets optimize assets/textures/wood_planks --max-size 512 --format jpeg --yes --project my-banner --json
|
|
136
136
|
```
|
|
137
137
|
|
|
138
138
|
- **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.3.
|
|
7
|
+
version: "0.3.1"
|
|
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.3.
|
|
18
|
+
Every command is `npx -y @fleox/agent3d@0.3.1 <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.3.1 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.3.
|
|
20
|
+
First run on a machine: `npx -y @fleox/agent3d@0.3.1 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.3.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.3.
|
|
32
|
-
npx -y @fleox/agent3d@0.3.
|
|
33
|
-
npx -y @fleox/agent3d@0.3.
|
|
31
|
+
npx -y @fleox/agent3d@0.3.1 templates list --json
|
|
32
|
+
npx -y @fleox/agent3d@0.3.1 new bakery-banner --target banner --title "Golden Crust Bakery" --json
|
|
33
|
+
npx -y @fleox/agent3d@0.3.1 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.3.
|
|
39
|
-
npx -y @fleox/agent3d@0.3.
|
|
40
|
-
npx -y @fleox/agent3d@0.3.
|
|
41
|
-
npx -y @fleox/agent3d@0.3.
|
|
42
|
-
npx -y @fleox/agent3d@0.3.
|
|
38
|
+
npx -y @fleox/agent3d@0.3.1 catalog --json
|
|
39
|
+
npx -y @fleox/agent3d@0.3.1 catalog generators terrain --json
|
|
40
|
+
npx -y @fleox/agent3d@0.3.1 catalog behaviours --json
|
|
41
|
+
npx -y @fleox/agent3d@0.3.1 catalog postfx look --json
|
|
42
|
+
npx -y @fleox/agent3d@0.3.1 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.3.
|
|
47
|
+
npx -y @fleox/agent3d@0.3.1 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.3.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.3.
|
|
64
|
+
npx -y @fleox/agent3d@0.3.1 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.3.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.3.
|
|
79
|
+
npx -y @fleox/agent3d@0.3.1 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.3.
|
|
85
|
+
npx -y @fleox/agent3d@0.3.1 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.3.
|
|
92
|
+
npx -y @fleox/agent3d@0.3.1 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.3.
|
|
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.3.1 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,24 +99,24 @@ 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.3.
|
|
103
|
-
npx -y @fleox/agent3d@0.3.
|
|
102
|
+
npx -y @fleox/agent3d@0.3.1 new my-hero --template hero-photo-3d --title "Old Town Tours" --json
|
|
103
|
+
npx -y @fleox/agent3d@0.3.1 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.3.
|
|
107
|
+
npx -y @fleox/agent3d@0.3.1 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`):
|
|
111
111
|
```json
|
|
112
|
-
[{ "op": "updateObject", "id": "photo", "set": { "src": "assets/textures/photo.jpg", "depth": "assets/depth/photo-depth.png", "strength": 0.
|
|
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
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`: plays in renders, videos and on touch screens), `speed`, `scroll`.
|
|
116
116
|
5. **Render and look**, then move the pointer to see the depth:
|
|
117
117
|
```bash
|
|
118
|
-
npx -y @fleox/agent3d@0.3.
|
|
119
|
-
npx -y @fleox/agent3d@0.3.
|
|
118
|
+
npx -y @fleox/agent3d@0.3.1 render --project my-hero --count 4 --sheet --json
|
|
119
|
+
npx -y @fleox/agent3d@0.3.1 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
122
|
|
|
@@ -125,19 +125,20 @@ Tips:
|
|
|
125
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). Lower it first when silhouettes smear, and check with `render --input` pointer moves to the corners.
|
|
126
126
|
- `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
127
|
- 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
|
-
- `check` reports `photo-depth-aspect` (regenerate the depth map after cropping the photo), `photo-heavy` (over 1.5 MB: `assets optimize`)
|
|
128
|
+
- `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.3.1 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.
|
|
129
130
|
- Exports copy the photo and its depth map like any asset; the model never ships.
|
|
130
131
|
|
|
131
132
|
## Other front doors: MCP and the Studio
|
|
132
133
|
|
|
133
134
|
Everything above also works without the shell:
|
|
134
135
|
|
|
135
|
-
- **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.3.
|
|
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.3.1 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`:
|
|
136
137
|
```json
|
|
137
|
-
{ "mcpServers": { "agent3d": { "command": "npx", "args": ["-y", "@fleox/agent3d@0.3.
|
|
138
|
+
{ "mcpServers": { "agent3d": { "command": "npx", "args": ["-y", "@fleox/agent3d@0.3.1", "mcp", "--project", "/Users/me/agent3d/my-banner"] } } }
|
|
138
139
|
```
|
|
139
140
|
`--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.
|
|
140
|
-
- **Studio** — `npx -y @fleox/agent3d@0.3.
|
|
141
|
+
- **Studio** — `npx -y @fleox/agent3d@0.3.1 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.
|
|
141
142
|
|
|
142
143
|
## Art direction that looks professional
|
|
143
144
|
|
|
@@ -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.3.
|
|
7
|
-
npx -y @fleox/agent3d@0.3.
|
|
8
|
-
npx -y @fleox/agent3d@0.3.
|
|
6
|
+
npx -y @fleox/agent3d@0.3.1 catalog lightRigs --json
|
|
7
|
+
npx -y @fleox/agent3d@0.3.1 catalog postfx look --json
|
|
8
|
+
npx -y @fleox/agent3d@0.3.1 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.3.
|
|
7
|
-
npx -y @fleox/agent3d@0.3.
|
|
8
|
-
npx -y @fleox/agent3d@0.3.
|
|
9
|
-
npx -y @fleox/agent3d@0.3.
|
|
10
|
-
npx -y @fleox/agent3d@0.3.
|
|
6
|
+
npx -y @fleox/agent3d@0.3.1 new my-scene --target hero --json
|
|
7
|
+
npx -y @fleox/agent3d@0.3.1 scene validate --project my-scene --file recipe.json --json
|
|
8
|
+
npx -y @fleox/agent3d@0.3.1 scene apply --project my-scene --file recipe.json --yes --json
|
|
9
|
+
npx -y @fleox/agent3d@0.3.1 check --render --project my-scene --json
|
|
10
|
+
npx -y @fleox/agent3d@0.3.1 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.3.
|
|
13
|
+
Exact parameters of every rig, look, material, shader, generator and behaviour: `npx -y @fleox/agent3d@0.3.1 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.3.
|
|
7
|
+
version: "0.3.1"
|
|
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.3.
|
|
18
|
+
Every command is `npx -y @fleox/agent3d@0.3.1 <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.3.
|
|
24
|
-
npx -y @fleox/agent3d@0.3.
|
|
25
|
-
npx -y @fleox/agent3d@0.3.
|
|
23
|
+
npx -y @fleox/agent3d@0.3.1 info --project my-banner --json
|
|
24
|
+
npx -y @fleox/agent3d@0.3.1 scene summary --project my-banner --json
|
|
25
|
+
npx -y @fleox/agent3d@0.3.1 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.3.
|
|
32
|
-
npx -y @fleox/agent3d@0.3.
|
|
33
|
-
npx -y @fleox/agent3d@0.3.
|
|
34
|
-
npx -y @fleox/agent3d@0.3.
|
|
31
|
+
npx -y @fleox/agent3d@0.3.1 object get title --project my-banner --json
|
|
32
|
+
npx -y @fleox/agent3d@0.3.1 scene get --path objects#title.material --project my-banner --json
|
|
33
|
+
npx -y @fleox/agent3d@0.3.1 timeline get --project my-banner --json
|
|
34
|
+
npx -y @fleox/agent3d@0.3.1 catalog behaviours float --json
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
## 2. Patch
|
|
@@ -39,8 +39,8 @@ npx -y @fleox/agent3d@0.3.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.3.
|
|
43
|
-
npx -y @fleox/agent3d@0.3.
|
|
42
|
+
npx -y @fleox/agent3d@0.3.1 scene patch --project my-banner --file ops.json --dry-run --json
|
|
43
|
+
npx -y @fleox/agent3d@0.3.1 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.3.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.3.
|
|
67
|
-
npx -y @fleox/agent3d@0.3.
|
|
68
|
-
npx -y @fleox/agent3d@0.3.
|
|
69
|
-
npx -y @fleox/agent3d@0.3.
|
|
70
|
-
npx -y @fleox/agent3d@0.3.
|
|
66
|
+
npx -y @fleox/agent3d@0.3.1 object update title --set material.color="#ffd166" --set size=0.9 --project my-banner --json
|
|
67
|
+
npx -y @fleox/agent3d@0.3.1 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.3.1 object move gem --parent props --project my-banner --json
|
|
69
|
+
npx -y @fleox/agent3d@0.3.1 object remove pill --project my-banner --json
|
|
70
|
+
npx -y @fleox/agent3d@0.3.1 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.3.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.3.
|
|
84
|
-
npx -y @fleox/agent3d@0.3.
|
|
85
|
-
npx -y @fleox/agent3d@0.3.
|
|
86
|
-
npx -y @fleox/agent3d@0.3.
|
|
83
|
+
npx -y @fleox/agent3d@0.3.1 timeline set --duration 10 --loop true --trigger visible --project my-banner --json
|
|
84
|
+
npx -y @fleox/agent3d@0.3.1 timeline add-track --target logo.rotation.y --keys "[[0,0],[10,360]]" --project my-banner --json
|
|
85
|
+
npx -y @fleox/agent3d@0.3.1 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.3.1 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.3.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.3.
|
|
107
|
+
npx -y @fleox/agent3d@0.3.1 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.3.
|
|
114
|
+
`npx -y @fleox/agent3d@0.3.1 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.
|
|
3
|
+
Apply with `npx -y @fleox/agent3d@0.3.1 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
|
|
|
@@ -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.3.
|
|
247
|
+
npx -y @fleox/agent3d@0.3.1 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
|
|
|
@@ -4,7 +4,7 @@ description: Build a mini game or an interactive 3D experience for a web page wi
|
|
|
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.3.
|
|
7
|
+
version: "0.3.1"
|
|
8
8
|
repository: "https://github.com/fleox/agent3d"
|
|
9
9
|
allowed-tools: Bash Read Write
|
|
10
10
|
---
|
|
@@ -15,13 +15,13 @@ A game is an ordinary scene (`target.kind: "game"`) plus **scripts**: ES modules
|
|
|
15
15
|
|
|
16
16
|
**Language:** talk to the user in their language; keep commands, ids, code and files in English.
|
|
17
17
|
|
|
18
|
-
Every command is `npx -y @fleox/agent3d@0.3.
|
|
18
|
+
Every command is `npx -y @fleox/agent3d@0.3.1 <command> --json` with `--project <dir>`. Read `error.hint` when `ok` is false.
|
|
19
19
|
|
|
20
20
|
## Start
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
npx -y @fleox/agent3d@0.3.
|
|
24
|
-
npx -y @fleox/agent3d@0.3.
|
|
23
|
+
npx -y @fleox/agent3d@0.3.1 new dodge --target game --title "Dodge" --json
|
|
24
|
+
npx -y @fleox/agent3d@0.3.1 scene summary --project dodge --json
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
The game starter has a `kinematic` player moved by position, coins with a `coin` tag, a follow camera, a score HUD, a coin sound and `scripts/game.js` (move with arrows / WASD, collect coins). Game templates to start from (`templates list --json`): `game-coin-collector`, `game-runner`, `game-maze`, `game-tap-targets`, `game-physics-playground` (rigid bodies, impulses, impact sounds) — `new my-game --template game-physics-playground --json`. A complete validated example (lane runner: lanes, spawning by cloning, difficulty ramp, best score, attract mode) is in skill `agent3d-create` → `references/recipes.md` ("Lane runner game"; "Physics toss game" for rigid bodies); patterns in [references/game-patterns.md](references/game-patterns.md); the full API in [references/script-api.md](references/script-api.md).
|
|
@@ -55,15 +55,15 @@ Scripts only get `api`. `check` fails (`forbidden-script`) on `fetch`, `XMLHttpR
|
|
|
55
55
|
1. Design the loop with the user in one paragraph: goal, controls (keyboard + touch), how you lose, what the score counts, how long a round lasts (30–90 s for a web page).
|
|
56
56
|
2. Declare the scene: player and obstacle templates (hidden, with `tags` and a `body`), camera, HUD elements per phase, sounds (`catalog sounds`), `data` for tuning.
|
|
57
57
|
3. Write the script (patterns below). Keep it under ~200 lines; one file is fine.
|
|
58
|
-
4. Validate and lint: `npx -y @fleox/agent3d@0.3.
|
|
58
|
+
4. Validate and lint: `npx -y @fleox/agent3d@0.3.1 check --project dodge --json` (sandbox errors carry the line: `scripts/game.js:12`).
|
|
59
59
|
5. Render several moments and LOOK:
|
|
60
60
|
```bash
|
|
61
|
-
npx -y @fleox/agent3d@0.3.
|
|
61
|
+
npx -y @fleox/agent3d@0.3.1 render --project dodge --sheet --frames 0,2,4,6 --json
|
|
62
62
|
```
|
|
63
63
|
Plain renders have no player input, so the game must show something on its own: an **attract mode** (an autopilot plays during the `ready` phase, behind the title and Play button). The HUD is captured because the scene has a `ui` (`--capture page` forces it); posters (`export --format poster`, the embed's `poster.webp`) and videos show the canvas only, without the HUD. Check `data.issues` and `data.consoleErrors` for `script-error`. `data.state` is the script's `api.state` after the last frame (e.g. `{ "score": 0, "phase": "ready" }`); frame and sheet paths are relative to the project folder `data.dir`.
|
|
64
64
|
6. **Play it headlessly** with `--input`: a JSON script of simulated keys / clicks applied while seeking (frames are rendered in time order), then check `data.state` and the frames:
|
|
65
65
|
```bash
|
|
66
|
-
npx -y @fleox/agent3d@0.3.
|
|
66
|
+
npx -y @fleox/agent3d@0.3.1 render --project dodge --sheet --frames 0,1,2,3 --input '[{"t": 0.2, "click": [0, -0.3]}, {"t": 0.5, "key": "ArrowLeft", "hold": 0.6}, {"t": 1.5, "key": "Space", "down": true}, {"t": 1.6, "key": "Space", "down": false}]' --json
|
|
67
67
|
```
|
|
68
68
|
Events: `{ "t", "key", "down" }` (`key` is a `KeyboardEvent.code`: `ArrowLeft`, `KeyA`, `Space`…; `down: false` releases), `{ "t", "key", "hold": seconds }` (press and release), `{ "t", "click": [x, y] }`, `{ "t", "pointer": [x, y] }` (add `"down": true` / `false` to press / release there), `{ "t", "pointerDown": [x, y] }` and `{ "t", "pointerUp": [x, y] }` (hold the pointer: `api.input.pointer.down`), `{ "t", "drag": { "from": [x, y], "to": [x, y], "duration": 0.4 } }` (press, move, release), `{ "t", "swipe": "left" | "right" | "up" | "down" }` (what `api.input.swipe()` returns next step), `{ "t", "scroll": 0.5 }` (page scroll progress, scroll-driven scenes), `{ "t", "ui": "retryBtn" }` (click that HUD button by id — a warning in `inputWarnings` when it is hidden at that time), `{ "t", "emit": "retry" }` (emit the event / button action directly), `{ "t", "segment": "intro" }` (play a timeline segment) — canvas coordinates −1..1, y up (a canvas `click` never presses a HUD button: use `ui`). Unknown fields are rejected (exit 2, the hint lists the valid shapes). Test the touch controls too, e.g. `--input '[{"t": 0.5, "swipe": "left"}, {"t": 1.2, "drag": {"from": [0, -0.5], "to": [0, 0.3], "duration": 0.3}}]'`. Use `@inputs.json` for longer scripts. MCP: `render_preview` takes the same events as `input`.
|
|
69
69
|
7. To test a state that is hard to reach with input (game over screen, high score), temporarily set the starting phase in `api.data` (e.g. `"startPhase": "over"`), render, then restore it.
|