@fleox/agent3d 0.2.2 → 0.3.0

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.
Files changed (70) hide show
  1. package/README.md +21 -13
  2. package/changelog.json +24 -0
  3. package/dist/agent/agent3d.mjs +228 -53
  4. package/dist/agent/chunks/{assets-BUUM9TUB.mjs → assets-YBkgdfgy.mjs} +27 -8
  5. package/dist/agent/chunks/{browser-Br1tURgt.mjs → browser-Dil7VM5m.mjs} +1 -1
  6. package/dist/agent/chunks/{cdp-Bdtm4fBN.mjs → cdp-DLEis_Z3.mjs} +1 -1
  7. package/dist/agent/chunks/{check-CfZcfaPs.mjs → check-DP9fRYbK.mjs} +64 -4
  8. package/dist/agent/chunks/depth-0bZsQn6N.mjs +190 -0
  9. package/dist/agent/chunks/depth-Dih8jLqx.mjs +483 -0
  10. package/dist/agent/chunks/{export-BHugc2H7.mjs → export-Cdqt3mt_.mjs} +8 -4
  11. package/dist/agent/chunks/{imageCodec-QM0EXQDJ.mjs → imageCodec-DeGfmBp3.mjs} +3 -3
  12. package/dist/agent/chunks/{objects-DBAws7uf.mjs → objects-DuytRxiC.mjs} +3 -3
  13. package/dist/agent/chunks/{optimizeSizing-CkZ3fZRp.mjs → optimizeSizing-B-BBiUkD.mjs} +51 -3
  14. package/dist/agent/chunks/{package-Dkr2v4or.mjs → package-d5e08XSG.mjs} +2 -1
  15. package/dist/agent/chunks/{render-EHb40avl.mjs → render-B05DU4Q5.mjs} +4 -4
  16. package/dist/agent/chunks/{scene-BgajNvBf.mjs → scene-DWgXH6As.mjs} +2 -2
  17. package/dist/agent/chunks/{server-CACCerkZ.mjs → server-Dt_YFvN7.mjs} +6 -2
  18. package/dist/agent/chunks/{tools-DKxgjQSJ.mjs → tools-Cv6N_YBI.mjs} +60 -6
  19. package/dist/agent/chunks/{tree-BrNYGui2.mjs → tree-CqSj-o8T.mjs} +1 -0
  20. package/dist/agent/ort/LICENSE.txt +9 -0
  21. package/dist/agent/ort/ort-wasm-simd-threaded.wasm +0 -0
  22. package/dist/agent/ort/ort.wasm.bundle.min.mjs +9 -0
  23. package/dist/runtime/agent3d-runtime.js +6 -6
  24. package/dist/runtime/agent3d-runtime.single.js +311 -62
  25. package/dist/runtime/chunks/assets-qnxDnVkj.js +1 -0
  26. package/dist/runtime/chunks/materials-dC4vDNHh.js +107 -0
  27. package/dist/runtime/chunks/{model-DbfZaLni.js → model-BCAl_NRl.js} +1 -1
  28. package/dist/runtime/chunks/photo-BlDYgYFM.js +250 -0
  29. package/dist/runtime/chunks/svg-CLUxY6Zy.js +1 -0
  30. package/dist/runtime/chunks/{text-BaON-ISS.js → text-rSo_2Luk.js} +2 -2
  31. package/dist/studio/assets/assets-BFJsr9Oo.js +1 -0
  32. package/dist/studio/assets/{camera-braC-Y4j.js → camera-DT0xHipx.js} +1 -1
  33. package/dist/studio/assets/{editor-DwKj0yf_.js → editor-BjgHj9g8.js} +1 -1
  34. package/dist/studio/assets/{game-Bd0sO8CA.js → game-BXZEc9HN.js} +3 -3
  35. package/dist/studio/assets/{generators-CFiebqmG.js → generators-DqkPMEzm.js} +1 -1
  36. package/dist/studio/assets/index-DVTzVcBD.js +479 -0
  37. package/dist/studio/assets/{model-Bg7e4Z-9.js → model-BqQW4Dg-.js} +1 -1
  38. package/dist/studio/assets/params-gVpEEiSK.js +1 -0
  39. package/dist/studio/assets/photo-DRoVO5iZ.js +250 -0
  40. package/dist/studio/assets/{physicsHost-CwJdYJ2g.js → physicsHost-DNdZ7AsT.js} +1 -1
  41. package/dist/studio/assets/{postfx-CGkvYb03.js → postfx-JFUGdY0d.js} +1 -1
  42. package/dist/studio/assets/runtime-CMAP4azF.js +572 -0
  43. package/dist/studio/assets/{shaders-Brwuj1zc.js → shaders-C7u6rN_6.js} +12 -12
  44. package/dist/studio/assets/svg-DkIOJjzS.js +2 -0
  45. package/dist/studio/assets/{text-DqnNIq0M.js → text-LISSAism.js} +2 -2
  46. package/dist/studio/index.html +1 -1
  47. package/package.json +2 -1
  48. package/plugin/.claude-plugin/plugin.json +1 -1
  49. package/plugin/skills/agent3d-assets/SKILL.md +40 -25
  50. package/plugin/skills/agent3d-create/SKILL.md +56 -21
  51. package/plugin/skills/agent3d-create/references/art-direction.md +3 -3
  52. package/plugin/skills/agent3d-create/references/recipes.md +71 -6
  53. package/plugin/skills/agent3d-edit/SKILL.md +22 -22
  54. package/plugin/skills/agent3d-edit/references/patch-ops.md +11 -3
  55. package/plugin/skills/agent3d-game/SKILL.md +7 -7
  56. package/plugin/skills/agent3d-publish/SKILL.md +23 -21
  57. package/plugin/skills/agent3d-publish/references/integrations.md +1 -1
  58. package/templates/hero-photo-3d/README.md +28 -0
  59. package/templates/hero-photo-3d/agent3d.json +8 -0
  60. package/templates/hero-photo-3d/assets/depth/street-depth.png +0 -0
  61. package/templates/hero-photo-3d/assets/manifest.json +25 -0
  62. package/templates/hero-photo-3d/assets/textures/street.jpg +0 -0
  63. package/templates/hero-photo-3d/preview.png +0 -0
  64. package/templates/hero-photo-3d/scene.json +120 -0
  65. package/templates/hero-photo-3d/template.json +8 -0
  66. package/dist/runtime/chunks/materials-w3EW0g-7.js +0 -107
  67. package/dist/runtime/chunks/svg-CfPIQnDG.js +0 -1
  68. package/dist/studio/assets/index-C87jPees.js +0 -479
  69. package/dist/studio/assets/runtime-DNb5FyOS.js +0 -572
  70. package/dist/studio/assets/svg-Db96jdHi.js +0 -2
@@ -1,4 +1,4 @@
1
- import{In as e,Ln as t,on as n,x as r}from"./three.module-CnI50X0U.js";import{n as i,r as a,u as o}from"./runtime-DNb5FyOS.js";var s=`
1
+ import{In as e,Ln as t,on as n,x as r}from"./three.module-CnI50X0U.js";import{r as i}from"./params-gVpEEiSK.js";import{n as a,r as o}from"./runtime-CMAP4azF.js";var s=`
2
2
  varying vec2 vUv;
3
3
  varying vec3 vPos;
4
4
  varying vec3 vNormalV;
@@ -43,7 +43,7 @@ vec3 paletteCycle(float t) {
43
43
  `,l=`
44
44
  #include <tonemapping_fragment>
45
45
  #include <colorspace_fragment>
46
- `;function u(e){return{uColors:{value:Array.from({length:6},(t,n)=>(e[Math.min(n,e.length-1)]??new r(`#ffffff`)).clone())},uCount:{value:Math.max(1,Math.min(6,e.length))}}}function d(e,t,i,a,c={}){return{create(l,d){let f={uTime:{value:0},...i(o(e,l,d))},p=new n({uniforms:f,vertexShader:s,fragmentShader:t,...c});return p.name=`shader:${e}`,p.userData.shader=e,p.userData.setParam=(t,n)=>{let i=a[t];if(!i||!f[i])return;if(t===`colors`){let t=u(o(e,{colors:n},d).colors(`colors`));f.uColors.value=t.uColors.value,f.uCount.value=t.uCount.value;return}let s=f[i].value;s instanceof r?typeof n==`string`&&s.copy(d.color(n)):typeof n==`number`&&(f[i].value=n)},{material:p,update(e){f.uTime.value=e}}}}}var f=`
46
+ `;function u(e){return{uColors:{value:Array.from({length:6},(t,n)=>(e[Math.min(n,e.length-1)]??new r(`#ffffff`)).clone())},uCount:{value:Math.max(1,Math.min(6,e.length))}}}function d(e,t,a,o,c={}){return{create(l,d){let f={uTime:{value:0},...a(i(e,l,d))},p=new n({uniforms:f,vertexShader:s,fragmentShader:t,...c});return p.name=`shader:${e}`,p.userData.shader=e,p.userData.setParam=(t,n)=>{let a=o[t];if(!a||!f[a])return;if(t===`colors`){let t=u(i(e,{colors:n},d).colors(`colors`));f.uColors.value=t.uColors.value,f.uCount.value=t.uCount.value;return}let s=f[a].value;s instanceof r?typeof n==`string`&&s.copy(d.color(n)):typeof n==`number`&&(f[a].value=n)},{material:p,update(e){f.uTime.value=e}}}}}var f=`
47
47
  float h21(vec2 p) { vec3 q = fract(vec3(p.xyx) * 0.1031); q += dot(q, q.yzx + 33.33); return fract((q.x + q.y) * q.z); }
48
48
  vec2 h22(vec2 p) { vec3 q = fract(vec3(p.xyx) * vec3(0.1031, 0.1030, 0.0973)); q += dot(q, q.yzx + 33.33); return fract((q.xx + q.yz) * q.zy); }
49
49
  `,p={gradientMesh:d(`gradientMesh`,`
@@ -51,8 +51,8 @@ uniform float uTime;
51
51
  uniform float uSpeed;
52
52
  uniform float uGrain;
53
53
  varying vec2 vUv;
54
+ ${o}
54
55
  ${a}
55
- ${i}
56
56
  void main() {
57
57
  float t = uTime * uSpeed;
58
58
  vec3 col = meshGradient((vUv - 0.5) * 1.6, t);
@@ -65,7 +65,7 @@ uniform float uSpeed;
65
65
  uniform float uIntensity;
66
66
  uniform vec3 uBg;
67
67
  varying vec2 vUv;
68
- ${a}
68
+ ${o}
69
69
  ${c}
70
70
  ${f}
71
71
  void main() {
@@ -95,7 +95,7 @@ uniform float uScale;
95
95
  varying vec2 vUv;
96
96
  varying vec3 vNormalV;
97
97
  varying vec3 vViewDir;
98
- ${a}
98
+ ${o}
99
99
  ${c}
100
100
  float field(vec2 p, float t) {
101
101
  vec2 q = vec2(snoise(vec3(p * 0.8, t)), snoise(vec3(p * 0.8 + 5.2, t * 1.1)));
@@ -128,7 +128,7 @@ uniform float uSpeed;
128
128
  uniform float uStars;
129
129
  uniform float uScale;
130
130
  varying vec2 vUv;
131
- ${a}
131
+ ${o}
132
132
  ${c}
133
133
  ${f}
134
134
  float stars(vec2 uv, float density, float seed) {
@@ -161,7 +161,7 @@ uniform float uIntensity;
161
161
  uniform vec3 uColor;
162
162
  uniform vec3 uBg;
163
163
  varying vec2 vUv;
164
- ${a}
164
+ ${o}
165
165
  ${f}
166
166
  // Animated Voronoi: thin bright lines where two cells meet.
167
167
  float cells(vec2 p, float t) {
@@ -214,7 +214,7 @@ uniform vec3 uTint;
214
214
  varying vec2 vUv;
215
215
  varying vec3 vNormalV;
216
216
  varying vec3 vViewDir;
217
- ${a}
217
+ ${o}
218
218
  ${f}
219
219
  vec3 hsv(float h, float s, float v) { vec3 k = clamp(abs(fract(h + vec3(0.0, 2.0 / 3.0, 1.0 / 3.0)) * 6.0 - 3.0) - 1.0, 0.0, 1.0); return v * mix(vec3(1.0), k, s); }
220
220
  void main() {
@@ -267,7 +267,7 @@ uniform float uAngle;
267
267
  uniform float uGrain;
268
268
  uniform float uSpeed;
269
269
  varying vec2 vUv;
270
- ${a}
270
+ ${o}
271
271
  ${c}
272
272
  ${f}
273
273
  void main() {
@@ -352,7 +352,7 @@ uniform float uSpeed;
352
352
  uniform float uScale;
353
353
  varying vec3 vPos;
354
354
  varying vec2 vUv;
355
- ${a}
355
+ ${o}
356
356
  ${c}
357
357
  void main() {
358
358
  float t = uTime * uSpeed;
@@ -386,7 +386,7 @@ uniform float uSpeed;
386
386
  varying vec2 vUv;
387
387
  varying vec3 vNormalV;
388
388
  varying vec3 vViewDir;
389
- ${a}
389
+ ${o}
390
390
  ${c}
391
391
  void main() {
392
392
  float t = uTime * uSpeed;
@@ -426,7 +426,7 @@ uniform float uProgress;
426
426
  varying vec3 vPos;
427
427
  varying vec3 vNormalV;
428
428
  varying vec3 vViewDir;
429
- ${a}
429
+ ${o}
430
430
  void main() {
431
431
  float n = fbm(vPos * 2.2) * 0.5 + 0.5;
432
432
  float p = uProgress * 1.15 - 0.075;
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SVGLoader-CIYl0nEy.js","./three.module-CnI50X0U.js","./BufferGeometryUtils-CAlXAboW.js"])))=>i.map(i=>d[i]);
2
+ import{I as e,In as t,P as n,U as r,h as i,ln as a,m as o,rn as s,u as c,x as l,xt as u}from"./three.module-CnI50X0U.js";import{r as d}from"./assets-BFJsr9Oo.js";import{v as f}from"./camera-DT0xHipx.js";import{i as p,n as m,r as h,t as g}from"./extrude-9bG8hr2C.js";import{a as _,s as v}from"./runtime-CMAP4azF.js";import{h as y}from"./index-DVTzVcBD.js";var b=e=>!!e&&e!==`none`&&e!==`transparent`;function x(e,t,n){if(e===`currentColor`)return n;let r=/^url\(\s*['"]?#([^'")]+)['"]?\s*\)/.exec(e);if(r){let e=t.userData?.gradients?.[r[1]]?.stops??[];if(!e.length)return n;let i=new l(e[0].color),a=new l(e[e.length-1].color);return`#${i.lerp(a,.5).getHexString()}`}try{let t=new l;return t.setStyle(e,s),`#${t.getHexString(s)}`}catch{return n}}function S(e,t){let n=new c;for(let t of e.paths)for(let e of t.subPaths)for(let t of e.getPoints(4))n.expandByPoint(t);return(n.isEmpty()?100:Math.max(n.max.x-n.min.x,n.max.y-n.min.y,1e-6))/(t*10)}function C(e,t,n={}){let r=[],i=Math.max(1,Math.round(f(n.curveSegments,12))),a=S(e,i),o=n.currentColor??`#1f2330`;for(let s of e.paths){let e=s.userData?.style??{};if(e.visibility===`hidden`||e.visibility===`collapse`)continue;let c=f(e.opacity,1);if(b(e.fill)){let t=s.toShapes().map(e=>h(e,a));t.length&&r.push({kind:`fill`,color:x(e.fill,s,o),opacity:f(e.fillOpacity,1)*c,shapes:t})}if(n.strokes!==!1&&b(e.stroke)&&f(e.strokeWidth,1)>0){let n=t.getStrokeStyle(f(e.strokeWidth,1),`#000`,e.strokeLineJoin??`miter`,e.strokeLineCap??`butt`,f(e.strokeMiterLimit,4)),l=[];for(let e of s.subPaths){let r=m(e,a);if(r.length<2)continue;let o=t.pointsToStroke(r,n,i);o&&l.push(o)}if(l.length){let t=l.length===1?l[0]:w(l);r.push({kind:`stroke`,color:x(e.stroke,s,o),opacity:f(e.strokeOpacity,1)*c,stroke:t})}}}return r}function w(e){let t=0;for(let n of e)t+=n.getAttribute(`position`).count;let n=new Float32Array(t*3),r=0;for(let t of e){let e=t.getAttribute(`position`).array;n.set(e,r),r+=e.length,t.dispose()}let a=new i;return a.setAttribute(`position`,new o(n,3)),a}function T(e,n=12){let r=new c;for(let i of e){if(i.shapes)for(let e of i.shapes)for(let t of e.getPoints(n))r.expandByPoint(t);if(i.stroke){let e=i.stroke.getAttribute(`position`);for(let n=0;n<e.count;n++)r.expandByPoint(new t(e.getX(n),e.getY(n)))}}return r}function E(e,t,r,i,o){if(e.kind===`stroke`)return e.stroke?g(e.stroke,t):null;if(!e.shapes?.length)return null;if(t<=0)return new a(e.shapes,i);let s=Math.min(r,t*.45),c=new n(e.shapes,{depth:Math.max(t-s*2,t*.05),curveSegments:i,bevelEnabled:s>0,bevelThickness:s,bevelSize:s*.6,bevelOffset:0,bevelSegments:3});return c.translate(0,0,s),c.clearGroups(),p(c,50*Math.PI/180,o)}async function D(t,n){let[{SVGLoader:i},a]=await Promise.all([y(()=>import(`./SVGLoader-CIYl0nEy.js`),__vite__mapDeps([0,1]),import.meta.url),y(()=>import(`./BufferGeometryUtils-CAlXAboW.js`).then(e=>e.t),__vite__mapDeps([2,1]),import.meta.url)]),o=t.src.trim().startsWith(`<`)?t.src:await d(n.resolveAsset(t.src)),s=new i().parse(o),c=t.material?v(t.material):void 0,l=typeof c?.color==`string`?c.color:void 0,p=Math.max(1,Math.round(f(t.curveSegments,12))),m=C(s,i,{strokes:t.strokes,curveSegments:p,currentColor:l}),h=new r,g=T(m,p);if(!m.length||g.isEmpty())return h;let b=f(t.size,2),x=Math.max(g.max.x-g.min.x,1e-6),S=Math.max(g.max.y-g.min.y,1e-6),w=t.fit??`width`,D=b/(w===`height`?S:w===`max`?Math.max(x,S):x),O=Math.max(0,f(t.depth,.2)),k=O/D,A=f(t.bevel,0)/D,j=f(t.layerGap,O>0?O*.02:b*.002),M=t.keepColors??!t.material,N=new Map,P=async(e,r)=>{let i=M?`${e}|${r}`:`|${r}`,a=N.get(i);if(!a){let o=M?{roughness:.4,metalness:.1,...t.material??{},color:e,...r<1?{opacity:r}:{}}:t.material?{...t.material,...r<1?{opacity:r}:{}}:{color:`#dddddd`,roughness:.4,metalness:.1};a=await _(o,n,{defaultColor:e}),r<1&&(a.transparent=!0),O<=0&&(a.side=2),N.set(i,a)}return a},F=[];for(let e of m){let t=E(e,k,A,p,a);if(!t)continue;t.getAttribute(`normal`)||t.computeVertexNormals();let n=M?`${e.color}|${e.opacity}`:`|${e.opacity}`,r=F[F.length-1];r&&r.key===n?r.geos.push(t):F.push({key:n,color:e.color,opacity:e.opacity,geos:[t]})}let I=new r;for(let[t,n]of F.entries()){for(let t of n.geos){for(let e of Object.keys(t.attributes))[`position`,`normal`,`uv`].includes(e)||t.deleteAttribute(e);t.getAttribute(`uv`)||t.setAttribute(`uv`,new e(new Float32Array(t.getAttribute(`position`).count*2),2))}let r=n.geos.length===1?n.geos[0]:a.mergeGeometries(n.geos.map(e=>e.index?e.toNonIndexed():e),!1)??n.geos[0],i=new u(r,await P(n.color,n.opacity));i.position.z=t*j/D,I.add(i)}let L=(g.min.x+g.max.x)/2,R=(g.min.y+g.max.y)/2;return I.scale.set(D,-D,D),I.position.set(-L*D,R*D,-(O+Math.max(0,F.length-1)*j)/2),h.add(I),h}export{D as buildSvg};
@@ -1,3 +1,3 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./FontLoader-Bzjx8mXt.js","./three.module-CnI50X0U.js","./BufferGeometryUtils-CAlXAboW.js"])))=>i.map(i=>d[i]);
2
- import{In as e,Lt as t,P as n,St as r,U as i,cn as a,h as o,ln as s,xt as c}from"./three.module-CnI50X0U.js";import{a as l,d as u}from"./runtime-DNb5FyOS.js";import{h as d,t as f}from"./index-C87jPees.js";import{v as p}from"./camera-braC-Y4j.js";import{i as m,r as h}from"./extrude-9bG8hr2C.js";var g=new Map;function _(e){let t=g.get(e);return t||(t=Promise.all([d(()=>import(`./FontLoader-Bzjx8mXt.js`),__vite__mapDeps([0,1]),import.meta.url),u(e)]).then(([e,t])=>new e.FontLoader().parse(t)),t.catch(()=>g.delete(e)),g.set(e,t)),t}var v=e=>{let t=e.normalize(`NFD`);return t.length>1?t[0]:e};function y(e,t,n){let r=e.kerning;if(!r)return 0;let i=r[t]?.[n];if(i!==void 0)return i;let a=v(t),o=v(n);return a===t&&o===n?0:r[a]?.[o]??0}function b(e,t){let n=t.em/e.resolution,r=p(t.letterSpacing,0),i=p(t.lineHeight,1.25)*t.em,a=t.kerning!==!1,o=t=>(e.glyphs[t]??e.glyphs[`?`])?.ha??e.resolution*.5,s=t=>{let i=[],s=0;return t.forEach((c,l)=>{l>0&&(s+=r+(a?y(e,t[l-1],c)*n:0)),i.push(s),s+=o(c)*n}),{xs:i,width:s}},c=[],l=typeof t.maxWidth==`number`&&t.maxWidth>0?t.maxWidth:1/0;for(let e of String(t.text??``).split(`
3
- `)){if(l===1/0){c.push(Array.from(e));continue}let t=e.split(/ +/),n=[];for(let e of t){let t=n.length?[...n,` `,...Array.from(e)]:Array.from(e);n.length&&s(t).width>l?(c.push(n),n=Array.from(e)):n=t}c.push(n)}let u=[],d=[],f=0;return c.forEach((e,n)=>{for(;e.length&&e[e.length-1]===` `;)e.pop();let{xs:r,width:a}=s(e);f=Math.max(f,a);let o=t.align===`left`?0:t.align===`right`?-a:-a/2;e.forEach((e,t)=>{e.trim()&&u.push({ch:e,x:r[t]+o,line:n})}),d.push({width:a,y:-n*i})}),{glyphs:u,lines:d,lineHeight:i,width:f}}function x(e){let t=e.data;if(t.capHeight&&t.resolution)return t.capHeight/t.resolution;let n=e.generateShapes(`H`,1);if(!n.length)return .72;let r=new s(n);r.computeBoundingBox();let i=r.boundingBox.max.y-r.boundingBox.min.y;return r.dispose(),i>0?i:.72}function S(e,t){let n=e.data,r=p(t.size,1),i=r/x(e),a=Math.max(0,p(t.depth,.2)),o=a>0?Math.max(0,Math.min(p(t.bevel,Math.min(a*.3,r*.035)),a*.45,r*.08)):0,s=Math.round(Math.max(2,Math.min(32,p(t.curveSegments,a>0?5+r*3:8+r*4)))),c=b(n,{text:t.text,em:i,letterSpacing:t.letterSpacing,lineHeight:t.lineHeight,align:t.align??`center`,maxWidth:t.maxWidth,kerning:t.kerning});return{size:r,em:i,depth:a,bevel:o,curveSegments:s,layout:c,offsetY:-(r+(c.lines.length?c.lines[c.lines.length-1].y:0))/2,frontZ:a/2,backZ:-a/2}}function C(e){let t=e.bevel;return{depth:Math.max(e.depth-t*2,1e-4),curveSegments:e.curveSegments,bevelEnabled:t>0,bevelThickness:t,bevelSize:t*.6,bevelOffset:0,bevelSegments:3}}function w(e,t,n){let r=n.em/(n.curveSegments*5);return e.generateShapes(t,n.em).map(e=>h(e,r,1,n.curveSegments))}function T(e,t,r,i){let a=w(e,t,r);if(!a.length)return null;if(r.depth<=0)return new s(a,r.curveSegments);let o=new n(a,C(r));return o.translate(0,0,r.backZ+r.bevel),o.clearGroups(),m(o,50*Math.PI/180,i)}function E(e,t){let n=e.outline;if(!n)return null;let r=n===!0?{}:n,i=Math.max(1e-4,p(r.width,t.size*.06)),a=t.depth>0?t.depth*.5:t.size*.01,o=t.frontZ-a;return{width:i,frontZ:o,backZ:o-Math.max(p(r.depth,t.depth>0?t.depth*.6:t.size*.01),1e-4),material:r.material,color:r.color??`#111111`}}function D(e){let t=0;for(let n=0,r=e.length-1;n<e.length;r=n++)t+=(e[r].x-e[n].x)*(e[r].y+e[n].y);return t/2}function O(t,n,r=2){let i=t.filter((e,n)=>{let r=t[(n+1)%t.length];return Math.hypot(r.x-e.x,r.y-e.y)>1e-9}),a=i.length,o=[];if(a<3)return i.map(t=>new e(t.x,t.y));let s=(e,t)=>{let n=t.x-e.x,r=t.y-e.y,i=Math.hypot(n,r)||1;return{x:r/i,y:-n/i}};for(let t=0;t<a;t++){let c=i[(t-1+a)%a],l=i[t],u=i[(t+1)%a],d=s(c,l),f=s(l,u),p=(l.x-c.x)*(u.y-l.y)-(l.y-c.y)*(u.x-l.x),m=d.x*f.x+d.y*f.y;if(p>0&&m<.995){let t=Math.atan2(d.y,d.x),r=Math.atan2(f.y,f.x);for(;r<t;)r+=Math.PI*2;for(;r>t+Math.PI*2;)r-=Math.PI*2;let i=Math.max(1,Math.ceil(Math.abs(r-t)/(Math.PI/8)));for(let a=0;a<=i;a++){let s=t+(r-t)*a/i;o.push(new e(l.x+Math.cos(s)*n,l.y+Math.sin(s)*n))}}else{let t=d.x+f.x,i=d.y+f.y,a=Math.hypot(t,i)||1;t/=a,i/=a;let s=Math.max(t*d.x+i*d.y,1/r);o.push(new e(l.x+t*n/s,l.y+i*n/s))}}return o}function k(e,n){let r=[];for(let i of e){let{shape:e,holes:o}=i.extractPoints(1),s=e.slice();D(s)<0&&(s=s.reverse());let c=new a(O(s,n));for(let e of o){let r=e.slice(),i=Math.abs(D(r));D(r)>0&&(r=r.reverse());let a=r.map(e=>e.x),o=r.map(e=>e.y);if(Math.max(...a)-Math.min(...a)<=2*n||Math.max(...o)-Math.min(...o)<=2*n)continue;let s=O(r,n),l=D(s);l<0&&-l>i*.02&&c.holes.push(new t(s))}r.push(c)}return r}function A(e,t,r,i,a){let o=w(e,t,r);if(!o.length)return null;let s=new n(k(o,i.width),{depth:i.frontZ-i.backZ,curveSegments:1,bevelEnabled:!1});return s.translate(0,0,i.backZ),s.clearGroups(),m(s,40*Math.PI/180,a)}function j(e,t,n){let r=new Map,i=[];for(let n of e.layout.glyphs){r.has(n.ch)||r.set(n.ch,t(n.ch));let a=r.get(n.ch);if(!a)continue;let o=a.clone();o.translate(n.x,e.layout.lines[n.line].y+e.offsetY,0),i.push(o)}for(let e of r.values())e?.dispose();let a;if(!i.length)a=new o;else{a=(i.length===1?i[0].clone():n.mergeGeometries(i,!1))??new o;for(let e of i)e.dispose()}return a.computeBoundingBox(),a.computeBoundingSphere(),a}function M(e,t,n){let r=p(e.stagger,.04),i=t;if(e.order===`reverse`)i=n-1-t;else if(e.order===`center`)i=Math.abs(t-(n-1)/2);else if(e.order===`random`){let e=(t+1)*2654435761;e=(e^e>>>13)>>>0,i=e%1e3/1e3*(n-1)}return p(e.delay,0)+i*r}function N(e,t){return(n,r)=>{let i=e.effect??`rise`,a=Math.max(p(e.duration,.6),.001),o=e.ease??(i===`scale`||i===`spin`?`outBack`:`outCubic`),s=i!==`scale`,c=[],l=[];if(s){let e=[];r.object.traverse(t=>{let n=t.material;if(n&&!t.userData.depthTwin){e.push(t);for(let e of Array.isArray(n)?n:[n])e.userData.baseOpacity===void 0&&(e.userData.baseOpacity=e.opacity),e.userData.baseTransparent===void 0&&(e.userData.baseTransparent=e.transparent),c.push(e)}});for(let t of e)l.push(F(t))}return{update(e){let n=Math.min(Math.max(e/a,0),1),u=f(o,n),d=r.object;if(s){let e=f(`outCubic`,Math.min(1,n*1.6));for(let t of c)t.opacity=t.userData.baseOpacity*e,t.transparent=e<1||t.userData.baseTransparent;for(let t of l)t.visible=e>0&&e<1}switch(n<=0&&(d.visible=!1),i){case`rise`:d.position.y-=(1-u)*t*.6;break;case`drop`:d.position.y+=(1-u)*t*1.2;break;case`scale`:d.scale.multiplyScalar(Math.max(1e-4,u));break;case`spin`:d.rotation.y+=(1-u)*Math.PI,d.scale.multiplyScalar(Math.max(1e-4,Math.min(1,n*2)))}}}}}var P=null;function F(e){P??=new r({colorWrite:!1,depthWrite:!0});let t=new c(e.geometry,P);return t.name=`${e.name}#depth`,t.visible=!1,t.castShadow=!1,t.receiveShadow=!1,t.renderOrder=-1,t.userData.helper=!0,t.userData.depthTwin=!0,e.add(t),t}function I(e,t){let n=e.font??`sans-bold`;return t.resolveAsset(n.includes(`/`)||n.includes(`:`)?n:`library:fonts/${n}`)}function L(e,t,n){let r=e.userData.gradient;r&&(r.uGradMin.value=t,r.uGradMax.value=n)}async function R(e,t){let[n,r]=await Promise.all([_(I(e,t)),d(()=>import(`./BufferGeometryUtils-CAlXAboW.js`).then(e=>e.t),__vite__mapDeps([2,1]),import.meta.url)]),a=S(n,e),o=E(e,a),s=!!e.splitLetters||!!e.reveal,u=a.depth<=0,f=()=>l(e.material,t,{defaultColor:`#ffffff`}),p=()=>o?l(o.material??{color:o.color,roughness:.55},t):null,m=(a.layout.lines.length?a.layout.lines[a.layout.lines.length-1].y:0)+a.offsetY,h=a.size+a.offsetY,g=e=>(u&&(e.side=2),e);if(!s){let t=j(a,e=>T(n,e,a,r),r),i=g(await f());L(i,m,h);let s=new c(t,i);if(o){let t=j(a,e=>A(n,e,a,o,r),r),i=await p();if(i){L(i,m,h);let n=new c(t,i);n.name=`${e.id}/outline`,s.add(n)}}return{object:s,letters:[]}}let v=new i,y=new Map,b=new Map,x=a.size/2,C=[],w=a.layout.glyphs.length,D=0;for(let t of a.layout.glyphs){if(!y.has(t.ch)){let e=T(n,t.ch,a,r),i=0;if(e&&(e.computeBoundingBox(),i=(e.boundingBox.min.x+e.boundingBox.max.x)/2,e.translate(-i,-x,0),e.computeBoundingSphere()),y.set(t.ch,e),o){let e=A(n,t.ch,a,o,r);e?.translate(-i,-x,0),b.set(t.ch,e)}e&&(e.userData.cx=i)}let i=y.get(t.ch);if(!i)continue;let s=i.userData.cx,l=a.layout.lines[t.line].y+a.offsetY,u=g(await f());L(u,m-l-x,h-l-x);let d=new c(i,u);d.position.set(t.x+s,l+x,0);let _=`${e.id}/${D}`;d.name=_,d.userData.a3dId=_;let S=b.get(t.ch);if(S){let e=await p();if(e){L(e,m-l-x,h-l-x);let t=new c(S,e);t.name=`${_}/outline`,d.add(t)}}v.add(d);let E={id:_,object:d,def:{id:_,kind:`text`,text:t.ch}};e.reveal&&(E.reveal={def:{type:`appear`,when:`visible`,delay:M(e.reveal,D,w)},impl:N(e.reveal,a.size)}),C.push(E),D++}return{object:v,letters:C}}export{R as buildText};
2
+ import{In as e,Lt as t,P as n,St as r,U as i,cn as a,h as o,ln as s,xt as c}from"./three.module-CnI50X0U.js";import{n as l}from"./assets-BFJsr9Oo.js";import{h as u,t as d}from"./index-DVTzVcBD.js";import{v as f}from"./camera-DT0xHipx.js";import{i as p,r as m}from"./extrude-9bG8hr2C.js";import{a as h}from"./runtime-CMAP4azF.js";var g=new Map;function _(e){let t=g.get(e);return t||(t=Promise.all([u(()=>import(`./FontLoader-Bzjx8mXt.js`),__vite__mapDeps([0,1]),import.meta.url),l(e)]).then(([e,t])=>new e.FontLoader().parse(t)),t.catch(()=>g.delete(e)),g.set(e,t)),t}var v=e=>{let t=e.normalize(`NFD`);return t.length>1?t[0]:e};function y(e,t,n){let r=e.kerning;if(!r)return 0;let i=r[t]?.[n];if(i!==void 0)return i;let a=v(t),o=v(n);return a===t&&o===n?0:r[a]?.[o]??0}function b(e,t){let n=t.em/e.resolution,r=f(t.letterSpacing,0),i=f(t.lineHeight,1.25)*t.em,a=t.kerning!==!1,o=t=>(e.glyphs[t]??e.glyphs[`?`])?.ha??e.resolution*.5,s=t=>{let i=[],s=0;return t.forEach((c,l)=>{l>0&&(s+=r+(a?y(e,t[l-1],c)*n:0)),i.push(s),s+=o(c)*n}),{xs:i,width:s}},c=[],l=typeof t.maxWidth==`number`&&t.maxWidth>0?t.maxWidth:1/0;for(let e of String(t.text??``).split(`
3
+ `)){if(l===1/0){c.push(Array.from(e));continue}let t=e.split(/ +/),n=[];for(let e of t){let t=n.length?[...n,` `,...Array.from(e)]:Array.from(e);n.length&&s(t).width>l?(c.push(n),n=Array.from(e)):n=t}c.push(n)}let u=[],d=[],p=0;return c.forEach((e,n)=>{for(;e.length&&e[e.length-1]===` `;)e.pop();let{xs:r,width:a}=s(e);p=Math.max(p,a);let o=t.align===`left`?0:t.align===`right`?-a:-a/2;e.forEach((e,t)=>{e.trim()&&u.push({ch:e,x:r[t]+o,line:n})}),d.push({width:a,y:-n*i})}),{glyphs:u,lines:d,lineHeight:i,width:p}}function x(e){let t=e.data;if(t.capHeight&&t.resolution)return t.capHeight/t.resolution;let n=e.generateShapes(`H`,1);if(!n.length)return .72;let r=new s(n);r.computeBoundingBox();let i=r.boundingBox.max.y-r.boundingBox.min.y;return r.dispose(),i>0?i:.72}function S(e,t){let n=e.data,r=f(t.size,1),i=r/x(e),a=Math.max(0,f(t.depth,.2)),o=a>0?Math.max(0,Math.min(f(t.bevel,Math.min(a*.3,r*.035)),a*.45,r*.08)):0,s=Math.round(Math.max(2,Math.min(32,f(t.curveSegments,a>0?5+r*3:8+r*4)))),c=b(n,{text:t.text,em:i,letterSpacing:t.letterSpacing,lineHeight:t.lineHeight,align:t.align??`center`,maxWidth:t.maxWidth,kerning:t.kerning});return{size:r,em:i,depth:a,bevel:o,curveSegments:s,layout:c,offsetY:-(r+(c.lines.length?c.lines[c.lines.length-1].y:0))/2,frontZ:a/2,backZ:-a/2}}function C(e){let t=e.bevel;return{depth:Math.max(e.depth-t*2,1e-4),curveSegments:e.curveSegments,bevelEnabled:t>0,bevelThickness:t,bevelSize:t*.6,bevelOffset:0,bevelSegments:3}}function w(e,t,n){let r=n.em/(n.curveSegments*5);return e.generateShapes(t,n.em).map(e=>m(e,r,1,n.curveSegments))}function T(e,t,r,i){let a=w(e,t,r);if(!a.length)return null;if(r.depth<=0)return new s(a,r.curveSegments);let o=new n(a,C(r));return o.translate(0,0,r.backZ+r.bevel),o.clearGroups(),p(o,50*Math.PI/180,i)}function E(e,t){let n=e.outline;if(!n)return null;let r=n===!0?{}:n,i=Math.max(1e-4,f(r.width,t.size*.06)),a=t.depth>0?t.depth*.5:t.size*.01,o=t.frontZ-a;return{width:i,frontZ:o,backZ:o-Math.max(f(r.depth,t.depth>0?t.depth*.6:t.size*.01),1e-4),material:r.material,color:r.color??`#111111`}}function D(e){let t=0;for(let n=0,r=e.length-1;n<e.length;r=n++)t+=(e[r].x-e[n].x)*(e[r].y+e[n].y);return t/2}function O(t,n,r=2){let i=t.filter((e,n)=>{let r=t[(n+1)%t.length];return Math.hypot(r.x-e.x,r.y-e.y)>1e-9}),a=i.length,o=[];if(a<3)return i.map(t=>new e(t.x,t.y));let s=(e,t)=>{let n=t.x-e.x,r=t.y-e.y,i=Math.hypot(n,r)||1;return{x:r/i,y:-n/i}};for(let t=0;t<a;t++){let c=i[(t-1+a)%a],l=i[t],u=i[(t+1)%a],d=s(c,l),f=s(l,u),p=(l.x-c.x)*(u.y-l.y)-(l.y-c.y)*(u.x-l.x),m=d.x*f.x+d.y*f.y;if(p>0&&m<.995){let t=Math.atan2(d.y,d.x),r=Math.atan2(f.y,f.x);for(;r<t;)r+=Math.PI*2;for(;r>t+Math.PI*2;)r-=Math.PI*2;let i=Math.max(1,Math.ceil(Math.abs(r-t)/(Math.PI/8)));for(let a=0;a<=i;a++){let s=t+(r-t)*a/i;o.push(new e(l.x+Math.cos(s)*n,l.y+Math.sin(s)*n))}}else{let t=d.x+f.x,i=d.y+f.y,a=Math.hypot(t,i)||1;t/=a,i/=a;let s=Math.max(t*d.x+i*d.y,1/r);o.push(new e(l.x+t*n/s,l.y+i*n/s))}}return o}function k(e,n){let r=[];for(let i of e){let{shape:e,holes:o}=i.extractPoints(1),s=e.slice();D(s)<0&&(s=s.reverse());let c=new a(O(s,n));for(let e of o){let r=e.slice(),i=Math.abs(D(r));D(r)>0&&(r=r.reverse());let a=r.map(e=>e.x),o=r.map(e=>e.y);if(Math.max(...a)-Math.min(...a)<=2*n||Math.max(...o)-Math.min(...o)<=2*n)continue;let s=O(r,n),l=D(s);l<0&&-l>i*.02&&c.holes.push(new t(s))}r.push(c)}return r}function A(e,t,r,i,a){let o=w(e,t,r);if(!o.length)return null;let s=new n(k(o,i.width),{depth:i.frontZ-i.backZ,curveSegments:1,bevelEnabled:!1});return s.translate(0,0,i.backZ),s.clearGroups(),p(s,40*Math.PI/180,a)}function j(e,t,n){let r=new Map,i=[];for(let n of e.layout.glyphs){r.has(n.ch)||r.set(n.ch,t(n.ch));let a=r.get(n.ch);if(!a)continue;let o=a.clone();o.translate(n.x,e.layout.lines[n.line].y+e.offsetY,0),i.push(o)}for(let e of r.values())e?.dispose();let a;if(!i.length)a=new o;else{a=(i.length===1?i[0].clone():n.mergeGeometries(i,!1))??new o;for(let e of i)e.dispose()}return a.computeBoundingBox(),a.computeBoundingSphere(),a}function M(e,t,n){let r=f(e.stagger,.04),i=t;if(e.order===`reverse`)i=n-1-t;else if(e.order===`center`)i=Math.abs(t-(n-1)/2);else if(e.order===`random`){let e=(t+1)*2654435761;e=(e^e>>>13)>>>0,i=e%1e3/1e3*(n-1)}return f(e.delay,0)+i*r}function N(e,t){return(n,r)=>{let i=e.effect??`rise`,a=Math.max(f(e.duration,.6),.001),o=e.ease??(i===`scale`||i===`spin`?`outBack`:`outCubic`),s=i!==`scale`,c=[],l=[];if(s){let e=[];r.object.traverse(t=>{let n=t.material;if(n&&!t.userData.depthTwin){e.push(t);for(let e of Array.isArray(n)?n:[n])e.userData.baseOpacity===void 0&&(e.userData.baseOpacity=e.opacity),e.userData.baseTransparent===void 0&&(e.userData.baseTransparent=e.transparent),c.push(e)}});for(let t of e)l.push(F(t))}return{update(e){let n=Math.min(Math.max(e/a,0),1),u=d(o,n),f=r.object;if(s){let e=d(`outCubic`,Math.min(1,n*1.6));for(let t of c)t.opacity=t.userData.baseOpacity*e,t.transparent=e<1||t.userData.baseTransparent;for(let t of l)t.visible=e>0&&e<1}switch(n<=0&&(f.visible=!1),i){case`rise`:f.position.y-=(1-u)*t*.6;break;case`drop`:f.position.y+=(1-u)*t*1.2;break;case`scale`:f.scale.multiplyScalar(Math.max(1e-4,u));break;case`spin`:f.rotation.y+=(1-u)*Math.PI,f.scale.multiplyScalar(Math.max(1e-4,Math.min(1,n*2)))}}}}}var P=null;function F(e){P??=new r({colorWrite:!1,depthWrite:!0});let t=new c(e.geometry,P);return t.name=`${e.name}#depth`,t.visible=!1,t.castShadow=!1,t.receiveShadow=!1,t.renderOrder=-1,t.userData.helper=!0,t.userData.depthTwin=!0,e.add(t),t}function I(e,t){let n=e.font??`sans-bold`;return t.resolveAsset(n.includes(`/`)||n.includes(`:`)?n:`library:fonts/${n}`)}function L(e,t,n){let r=e.userData.gradient;r&&(r.uGradMin.value=t,r.uGradMax.value=n)}async function R(e,t){let[n,r]=await Promise.all([_(I(e,t)),u(()=>import(`./BufferGeometryUtils-CAlXAboW.js`).then(e=>e.t),__vite__mapDeps([2,1]),import.meta.url)]),a=S(n,e),o=E(e,a),s=!!e.splitLetters||!!e.reveal,l=a.depth<=0,d=()=>h(e.material,t,{defaultColor:`#ffffff`}),f=()=>o?h(o.material??{color:o.color,roughness:.55},t):null,p=(a.layout.lines.length?a.layout.lines[a.layout.lines.length-1].y:0)+a.offsetY,m=a.size+a.offsetY,g=e=>(l&&(e.side=2),e);if(!s){let t=j(a,e=>T(n,e,a,r),r),i=g(await d());L(i,p,m);let s=new c(t,i);if(o){let t=j(a,e=>A(n,e,a,o,r),r),i=await f();if(i){L(i,p,m);let n=new c(t,i);n.name=`${e.id}/outline`,s.add(n)}}return{object:s,letters:[]}}let v=new i,y=new Map,b=new Map,x=a.size/2,C=[],w=a.layout.glyphs.length,D=0;for(let t of a.layout.glyphs){if(!y.has(t.ch)){let e=T(n,t.ch,a,r),i=0;if(e&&(e.computeBoundingBox(),i=(e.boundingBox.min.x+e.boundingBox.max.x)/2,e.translate(-i,-x,0),e.computeBoundingSphere()),y.set(t.ch,e),o){let e=A(n,t.ch,a,o,r);e?.translate(-i,-x,0),b.set(t.ch,e)}e&&(e.userData.cx=i)}let i=y.get(t.ch);if(!i)continue;let s=i.userData.cx,l=a.layout.lines[t.line].y+a.offsetY,u=g(await d());L(u,p-l-x,m-l-x);let h=new c(i,u);h.position.set(t.x+s,l+x,0);let _=`${e.id}/${D}`;h.name=_,h.userData.a3dId=_;let S=b.get(t.ch);if(S){let e=await f();if(e){L(e,p-l-x,m-l-x);let t=new c(S,e);t.name=`${_}/outline`,h.add(t)}}v.add(h);let E={id:_,object:h,def:{id:_,kind:`text`,text:t.ch}};e.reveal&&(E.reveal={def:{type:`appear`,when:`visible`,delay:M(e.reveal,D,w)},impl:N(e.reveal,a.size)}),C.push(E),D++}return{object:v,letters:C}}export{R as buildText};
@@ -6,7 +6,7 @@
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-C87jPees.js"></script>
9
+ <script type="module" crossorigin src="./assets/index-DVTzVcBD.js"></script>
10
10
  <link rel="modulepreload" crossorigin href="./assets/three.module-CnI50X0U.js">
11
11
  <link rel="stylesheet" crossorigin href="./assets/index-BQT0otii.css">
12
12
  </head>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fleox/agent3d",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
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",
@@ -50,6 +50,7 @@
50
50
  "happy-dom": "^21.0.4",
51
51
  "lucide-react": "^1.77.0",
52
52
  "meshoptimizer": "~1.1.1",
53
+ "onnxruntime-web": "^1.31.1",
53
54
  "postcss": "^8.5.33",
54
55
  "react": "^19.3.1",
55
56
  "react-dom": "^19.3.1",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent3d",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
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"
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  name: agent3d-assets
3
- description: Find and add 3D assets to an Agent3D project - the built-in CC0 library shipped offline (models, PBR textures, HDRIs, fonts), procedural generators that cost zero bytes, free account-less CC0 sources (Poly Haven, ambientCG, Khronos samples searched and downloaded once into the project; Kenney and Quaternius packs imported from a zip the user downloads), the user's own files, licences and attribution, size budgets, and making textures and models lighter (assets optimize: per-usage sizes, WebP, meshopt, simplify). Use when a scene needs a model, a texture, an HDRI, a logo, a sound or music, or when the user asks where assets come from or how they are licensed.
3
+ description: Find and add 3D assets to an Agent3D project - the built-in CC0 library shipped offline (models, PBR textures, HDRIs, fonts), procedural generators that cost zero bytes, free account-less CC0 sources (Poly Haven, ambientCG, Khronos samples searched and downloaded once into the project; Kenney and Quaternius packs imported from a zip the user downloads), the user's own files, depth maps for 3D photos (assets depth, a local model downloaded once), licences and attribution, size budgets, and making textures and models lighter (assets optimize: per-usage sizes, WebP, meshopt, simplify). Use when a scene needs a model, a texture, an HDRI, a logo, a sound or music, or when the user asks where assets come from or how they are licensed.
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.2.2"
7
+ version: "0.3.0"
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.2.2 <command> --json` with `--project <dir>`. Read `error.hint` when `ok` is false.
16
+ Every command is `npx -y @fleox/agent3d@0.3.0 <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.2.2 <command> --json` with `--project
25
25
  ## The built-in library
26
26
 
27
27
  ```bash
28
- npx -y @fleox/agent3d@0.2.2 assets library --query tree --json
29
- npx -y @fleox/agent3d@0.2.2 assets library --kind hdri --json
30
- npx -y @fleox/agent3d@0.2.2 assets library --query character --kind model --json
28
+ npx -y @fleox/agent3d@0.3.0 assets library --query tree --json
29
+ npx -y @fleox/agent3d@0.3.0 assets library --kind hdri --json
30
+ npx -y @fleox/agent3d@0.3.0 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.2.2 assets library --kind model --offset 50 --json
37
- npx -y @fleox/agent3d@0.2.2 assets library --kind model --all --json
36
+ npx -y @fleox/agent3d@0.3.0 assets library --kind model --offset 50 --json
37
+ npx -y @fleox/agent3d@0.3.0 assets library --kind model --all --json
38
38
  ```
39
39
 
40
40
  ```json
@@ -51,9 +51,9 @@ npx -y @fleox/agent3d@0.2.2 assets library --kind model --all --json
51
51
  ## Searching free sources (network)
52
52
 
53
53
  ```bash
54
- npx -y @fleox/agent3d@0.2.2 assets search "wood planks" --kind texture --project my-scene --json
55
- npx -y @fleox/agent3d@0.2.2 assets search sunset --kind hdri --source polyhaven --project my-scene --json
56
- npx -y @fleox/agent3d@0.2.2 assets search fox --source khronos --project my-scene --json
54
+ npx -y @fleox/agent3d@0.3.0 assets search "wood planks" --kind texture --project my-scene --json
55
+ npx -y @fleox/agent3d@0.3.0 assets search sunset --kind hdri --source polyhaven --project my-scene --json
56
+ npx -y @fleox/agent3d@0.3.0 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.2.2 assets add --hit @hit.json --resolution 1k --project my-scene --json
64
+ npx -y @fleox/agent3d@0.3.0 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.2.2 assets add --hit @hit.json --resolution 512 --project my-banner --json
70
+ npx -y @fleox/agent3d@0.3.0 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.2.2 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.2.2 assets add ~/Downloads/kenney_platformer-kit.zip --source kenney --license CC0-1.0 --filter coin --filter flag --name platformer --project my-game --json
78
+ npx -y @fleox/agent3d@0.3.0 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.2.2 assets add ./logo.svg --license proprietary --project my-banner --json
87
- npx -y @fleox/agent3d@0.2.2 assets add ./bottle.glb --license proprietary --author "Acme" --project my-banner --json
88
- npx -y @fleox/agent3d@0.2.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
86
+ npx -y @fleox/agent3d@0.3.0 assets add ./logo.svg --license proprietary --project my-banner --json
87
+ npx -y @fleox/agent3d@0.3.0 assets add ./bottle.glb --license proprietary --author "Acme" --project my-banner --json
88
+ npx -y @fleox/agent3d@0.3.0 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" }`).
@@ -98,12 +98,27 @@ SVG logos and icons:
98
98
 
99
99
  Each path keeps its SVG colour (`keepColors`: default `true` without a `material`, `false` with one; `true` + a material = that finish with the SVG colours). Strokes (`stroke-width`, joins, caps) become solid outlines, so line-icon sets work (`currentColor` takes the material colour; `"strokes": false` ignores strokes). `size` is the width (`fit: "height"` or `"max"` sizes the other or the larger side), `layerGap` separates stacked paths. `<text>` is not supported: ask for the logo with text converted to outlines. Check it with `render --isolate logo`.
100
100
 
101
+ ## Depth maps for 3D photos
102
+
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
+
105
+ ```bash
106
+ npx -y @fleox/agent3d@0.3.0 assets add ./street.jpg --license CC0-1.0 --author "Jane Doe" --project my-hero --json
107
+ npx -y @fleox/agent3d@0.3.0 assets depth assets/textures/street.jpg --project my-hero --json
108
+ ```
109
+
110
+ - **Output.** `data.path` = `assets/depth/<photo name>-depth.png` (`--out` to change), at the photo size capped at 2048 px (`--max-size`), 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
+ - **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
+ - **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
+ - 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.
115
+
101
116
  ## Listing and removing
102
117
 
103
118
  ```bash
104
- npx -y @fleox/agent3d@0.2.2 assets list --project my-scene --json
105
- npx -y @fleox/agent3d@0.2.2 assets remove assets/textures/old.jpg --project my-scene --json
106
- npx -y @fleox/agent3d@0.2.2 assets remove assets/textures/old.jpg --yes --project my-scene --json
119
+ npx -y @fleox/agent3d@0.3.0 assets list --project my-scene --json
120
+ npx -y @fleox/agent3d@0.3.0 assets remove assets/textures/old.jpg --project my-scene --json
121
+ npx -y @fleox/agent3d@0.3.0 assets remove assets/textures/old.jpg --yes --project my-scene --json
107
122
  ```
108
123
 
109
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.
@@ -113,11 +128,11 @@ npx -y @fleox/agent3d@0.2.2 assets remove assets/textures/old.jpg --yes --projec
113
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:
114
129
 
115
130
  ```bash
116
- npx -y @fleox/agent3d@0.2.2 assets optimize --all --project my-hero --json
117
- npx -y @fleox/agent3d@0.2.2 assets optimize --all --dry-run --project my-hero --json
118
- npx -y @fleox/agent3d@0.2.2 assets optimize --all --yes --project my-hero --json
119
- npx -y @fleox/agent3d@0.2.2 assets optimize assets/models/robot.glb --simplify 0.5 --yes --project my-game --json
120
- npx -y @fleox/agent3d@0.2.2 assets optimize assets/textures/wood_planks --max-size 512 --format jpeg --yes --project my-banner --json
131
+ npx -y @fleox/agent3d@0.3.0 assets optimize --all --project my-hero --json
132
+ npx -y @fleox/agent3d@0.3.0 assets optimize --all --dry-run --project my-hero --json
133
+ npx -y @fleox/agent3d@0.3.0 assets optimize --all --yes --project my-hero --json
134
+ npx -y @fleox/agent3d@0.3.0 assets optimize assets/models/robot.glb --simplify 0.5 --yes --project my-game --json
135
+ npx -y @fleox/agent3d@0.3.0 assets optimize assets/textures/wood_planks --max-size 512 --format jpeg --yes --project my-banner --json
121
136
  ```
122
137
 
123
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.
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  name: agent3d-create
3
- description: Build a 3D element for a web page from a brief with Agent3D - an animated banner, a hero, a mascot or character, a low-poly landscape, a product showcase, a logo in 3D, a mini game - by writing a JSON scene, rendering it headless and LOOKING at the screenshots until it looks professional, then exporting a self-contained embed (Web Component + static files, or one HTML file). Use when the user asks for something 3D, animated or interactive for their website ("an animated banner for my bakery", "a low-poly island hero", "a 3D version of my logo", "a mini game where...").
3
+ description: Build a 3D element for a web page from a brief with Agent3D - an animated banner, a hero, a mascot or character, a low-poly landscape, a product showcase, a logo in 3D, a 3D photo (a user's photo given depth that moves with the pointer), a mini game - by writing a JSON scene, rendering it headless and LOOKING at the screenshots until it looks professional, then exporting a self-contained embed (Web Component + static files, or one HTML file). Use when the user asks for something 3D, animated or interactive for their website ("an animated banner for my bakery", "a low-poly island hero", "a 3D version of my logo", "make this photo 3D / bring this picture to life", "a mini game where...").
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.2.2"
7
+ version: "0.3.0"
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.2.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.2.2 help scene --json` lists any command's actions and options. Pass `--project <dir>` to every project command (default: the current directory).
18
+ Every command is `npx -y @fleox/agent3d@0.3.0 <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.0 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.2.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.
20
+ First run on a machine: `npx -y @fleox/agent3d@0.3.0 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.2.2 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.2.2 templates list --json
32
- npx -y @fleox/agent3d@0.2.2 new bakery-banner --target banner --title "Golden Crust Bakery" --json
33
- npx -y @fleox/agent3d@0.2.2 new bakery-banner --template banner-neon-title --title "Golden Crust Bakery" --json
31
+ npx -y @fleox/agent3d@0.3.0 templates list --json
32
+ npx -y @fleox/agent3d@0.3.0 new bakery-banner --target banner --title "Golden Crust Bakery" --json
33
+ npx -y @fleox/agent3d@0.3.0 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.2.2 catalog --json
39
- npx -y @fleox/agent3d@0.2.2 catalog generators terrain --json
40
- npx -y @fleox/agent3d@0.2.2 catalog behaviours --json
41
- npx -y @fleox/agent3d@0.2.2 catalog postfx look --json
42
- npx -y @fleox/agent3d@0.2.2 scene summary --project bakery-banner --json
38
+ npx -y @fleox/agent3d@0.3.0 catalog --json
39
+ npx -y @fleox/agent3d@0.3.0 catalog generators terrain --json
40
+ npx -y @fleox/agent3d@0.3.0 catalog behaviours --json
41
+ npx -y @fleox/agent3d@0.3.0 catalog postfx look --json
42
+ npx -y @fleox/agent3d@0.3.0 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.2.2 scene patch --project bakery-banner --file ops.json --json
47
+ npx -y @fleox/agent3d@0.3.0 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.2.2 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.2.2 render --project bakery-banner --sheet --count 4 --json
64
+ npx -y @fleox/agent3d@0.3.0 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,33 +76,68 @@ First run on a machine: `npx -y @fleox/agent3d@0.2.2 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.2.2 render --project bakery-banner --isolate croissant-left --json
79
+ npx -y @fleox/agent3d@0.3.0 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.2.2 check --project bakery-banner --render --json
85
+ npx -y @fleox/agent3d@0.3.0 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.2.2 export --project bakery-banner --json
92
+ npx -y @fleox/agent3d@0.3.0 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.2.2 serve --project bakery-banner --open`). Other formats (zip, single HTML file, poster image, MP4 / WebM video, GIF) and site integration: skill `agent3d-publish`.
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.0 serve --project bakery-banner --open`). Other formats (zip, single HTML file, poster image, MP4 / WebM video, GIF) and site integration: skill `agent3d-publish`.
95
+
96
+ ## Bring a photo to life (3D photo)
97
+
98
+ When the user gives a photo or an image and wants it in 3D, with parallax, "moving with the mouse" or "brought to life", don't model the scene: turn the picture itself into a **3D photo**, a `photo` object with a depth map. Start from the `hero-photo-3d` template (or the "3D photo hero" recipe in [references/recipes.md](references/recipes.md)).
99
+
100
+ 1. **Copy the image into the project** with its licence (ask who took it and under which licence; skill `agent3d-assets`):
101
+ ```bash
102
+ npx -y @fleox/agent3d@0.3.0 new my-hero --template hero-photo-3d --title "Old Town Tours" --json
103
+ npx -y @fleox/agent3d@0.3.0 assets add ./photo.jpg --license CC0-1.0 --author "Jane Doe" --project my-hero --json
104
+ ```
105
+ 2. **Estimate its depth map** (local, ~1-3 s; the first run downloads the 27 MB model once, then it works offline):
106
+ ```bash
107
+ npx -y @fleox/agent3d@0.3.0 assets depth assets/textures/photo.jpg --project my-hero --json
108
+ ```
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
+ 3. **Point the photo object at it** (or add one with `object add --json-def`):
111
+ ```json
112
+ [{ "op": "updateObject", "id": "photo", "set": { "src": "assets/textures/photo.jpg", "depth": "assets/depth/photo-depth.png", "strength": 0.3, "focus": 0.5 } }]
113
+ ```
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`: plays in renders, videos and on touch screens), `speed`, `scroll`.
116
+ 5. **Render and look**, then move the pointer to see the depth:
117
+ ```bash
118
+ npx -y @fleox/agent3d@0.3.0 render --project my-hero --count 4 --sheet --json
119
+ npx -y @fleox/agent3d@0.3.0 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
+ ```
121
+ Near things should slide against far things between frames, without smeared or doubled edges around the subject.
122
+
123
+ Tips:
124
+
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
+ - `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
+ - 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`), `photo-depth-lossy` (keep the depth map a PNG), and the covering photo as a `clipped` info (expected).
129
+ - Exports copy the photo and its depth map like any asset; the model never ships.
95
130
 
96
131
  ## Other front doors: MCP and the Studio
97
132
 
98
133
  Everything above also works without the shell:
99
134
 
100
- - **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.2.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`:
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.0 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`:
101
136
  ```json
102
- { "mcpServers": { "agent3d": { "command": "npx", "args": ["-y", "@fleox/agent3d@0.2.2", "mcp", "--project", "/Users/me/agent3d/my-banner"] } } }
137
+ { "mcpServers": { "agent3d": { "command": "npx", "args": ["-y", "@fleox/agent3d@0.3.0", "mcp", "--project", "/Users/me/agent3d/my-banner"] } } }
103
138
  ```
104
139
  `--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.
105
- - **Studio** — `npx -y @fleox/agent3d@0.2.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.
140
+ - **Studio** — `npx -y @fleox/agent3d@0.3.0 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.
106
141
 
107
142
  ## Art direction that looks professional
108
143
 
@@ -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.2.2 catalog lightRigs --json
7
- npx -y @fleox/agent3d@0.2.2 catalog postfx look --json
8
- npx -y @fleox/agent3d@0.2.2 catalog materialPresets --json
6
+ npx -y @fleox/agent3d@0.3.0 catalog lightRigs --json
7
+ npx -y @fleox/agent3d@0.3.0 catalog postfx look --json
8
+ npx -y @fleox/agent3d@0.3.0 catalog materialPresets --json
9
9
  ```
10
10
 
11
11
  Complete, rendered scenes for each idea below: [recipes.md](recipes.md).