3D engine that AI agents drive
feat(site,render): simplify homepage hero, add Helios-67 Dyson relay model, and introduce Glaze + Cook names
Nguyen Xuan An3d59166f7467
diff --git a/docs/path-tracer.md b/docs/path-tracer.mdindex 2b949fa4..d641c14e 100644--- a/docs/path-tracer.md+++ b/docs/path-tracer.md@@ -1,9 +1,9 @@-# Trace67 (path tracer)+# Cook (path tracer)-**Trace67** (`67js/addons/path-tracer`) is the 67js offline path tracer. Alongside `Renderer67` for real-time WebGL2, `Trace67` draws one still by following light paths on the CPU or GPU: it follows light paths on the CPU instead of rasterizing. It is in the current source and not yet published. It loads only when a render job asks for it, so a normal scene pays nothing (issue #57).+**Cook** (`67js/addons/path-tracer`) is the 67js offline path tracer (a nod to both the Cook-Torrance microfacet BSDF and *"let it cook"*). Alongside `Glaze` (`Renderer67`) for real-time WebGL2, `Cook` draws one still by following light paths on the CPU or GPU. It loads only when a render job asks for it, so a normal scene pays nothing (issue #57).```js-import { Trace67, renderPathTracedImage } from '67js/addons/path-tracer';+import { Cook, renderPathTracedImage } from '67js/addons/path-tracer';const { rgba, linear, report } = await renderPathTracedImage({ parts, environment, camera }, // the same objects the rasterizer takesdiff --git a/index.html b/index.htmlindex d7ab659e..7790dc60 100644--- a/index.html+++ b/index.html@@ -3,70 +3,39 @@<head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" />- <meta name="theme-color" content="#09070f" />- <meta name="description" content="67js is a WebGL2 3D engine built for AI agents: 22 MCP tools, procedural modeling, MeshBlend, PBD cloth, Renderer67 real-time and Trace67 path tracing in one lightweight package." />- <meta property="og:type" content="website" />- <meta property="og:site_name" content="67js" />- <meta property="og:title" content="67js — a 3D engine agents can drive" />- <meta property="og:description" content="WebGL2 rendering, deterministic animation, Trace67 path tracing and an MCP server in one npm package." />- <meta property="og:url" content="https://67js.codepawl.com/" />- <meta property="og:image" content="https://67js.codepawl.com/previews/showcase-airport.webp" />- <meta property="og:image:alt" content="An airport ramp rendered by 67js" />- <meta name="twitter:card" content="summary_large_image" />- <link rel="canonical" href="https://67js.codepawl.com/" />- <title>67js — a 3D engine agents can drive</title>+ <meta name="description" content="A WebGL2 3D engine that AI agents drive: Glaze real-time rendering, Cook path tracing, and an MCP server in one light package." />+ <title>67js — A 3D engine agents can drive</title><link rel="icon" href="/favicon.svg" /></head>- <body class="site">+ <body class="home site"><a class="skip-link" href="#content">Skip to content</a><header class="navigation"><a class="brand" href="/" aria-label="67js home">67js</a>- <span class="version" data-release-version>Loading release</span><nav aria-label="Library"><a href="/docs.html">Docs</a><a href="/changelog.html">Changelog</a></nav><a class="site-nav-cta" href="https://github.com/codepawl/67.js" aria-label="GitHub"><span class="package-logo package-logo-github" aria-hidden="true"></span><span class="site-nav-cta-label">GitHub</span></a></header><main id="content">- <section class="hero" aria-label="67js AI agent workbench and live 3D preview">+ <section class="hero" aria-label="67js introduction and live preview"><div class="hero-frame" data-glow="#ff6a2b"><a class="hero-shot" href="./showcase.html?scene=airport" aria-label="Open the airport ramp as a live 3D scene">- <img src="./previews/showcase-airport.webp" alt="An airport ramp with a 787 at its stand and the turnaround crew, rendered by 67js" width="1280" height="720" fetchpriority="high" />+ <img src="./previews/helios-relay.webp" alt="Helios-67 orbital Dyson relay with counter-rotating gimbals and basalt monoliths, rendered by 67js" width="1280" height="720" fetchpriority="high" /></a>- <canvas id="hero-viewport" class="hero-viewport" aria-label="Live 3D agent model workbench. Drag to orbit or switch agent prompts."></canvas>- <div class="hero-caption">- <span class="hero-status-dot" aria-hidden="true"></span>- <span data-agent-badge>scene_create · 64 parts · 0% exploded</span>- <span class="hero-caption-sep" aria-hidden="true">·</span>- <span data-agent-metrics>64 parts · 0.28 ms CPU · 50.9 KB gzip core</span>- </div>- <aside class="hero-workbench" aria-label="Agent prompt to 3D pipeline">- <div class="workbench-header">- <span class="workbench-pill">Agent MCP Session</span>- <span class="workbench-engine">Renderer67 + Trace67</span>- </div>- <div class="workbench-tabs" role="group" aria-label="Agent prompt presets">- <button type="button" data-prompt-preset="model" aria-pressed="true">01 Build model</button>- <button type="button" data-prompt-preset="explode" aria-pressed="false">02 Explode rig</button>- <button type="button" data-prompt-preset="blend" aria-pressed="false">03 Blend & cloth</button>- <button type="button" data-prompt-preset="review" aria-pressed="false">04 Visual review</button>- </div>- <p class="workbench-prompt" data-agent-prompt>"Build a 64-part articulated rover with weathered armor, stereo optics, and hydraulic treads."</p>- <ol class="workbench-tools" data-agent-tools aria-label="Executed MCP tool calls">- <li><code>scene_create</code><span>64 parts · 18.4k tris · shared instanced meshes</span></li>- <li><code>scene_apply</code><span>set-material armor (metallic 0.62, roughness 0.43)</span></li>- <li><code>scene_look</code><span>0.28 ms CPU · 0 overlap errors · bounds verified</span></li>- </ol>- <div class="workbench-links">- <a href="./object.html">Open Object Studio →</a>- <a href="./nature.html">Nature Blend & Cloth →</a>- <a href="./showcase.html?scene=airport">Airport World →</a>+ <canvas id="hero-viewport" class="hero-viewport" aria-label="Live 3D Dyson relay scene. Drag to orbit or switch agent prompts."></canvas>+ <aside class="hero-prompt" aria-label="Agent prompt presets">+ <div class="hero-prompt-tabs" role="group" aria-label="Agent prompt">+ <button type="button" data-prompt-preset="model" aria-pressed="true">Build</button>+ <button type="button" data-prompt-preset="explode" aria-pressed="false">Explode</button>+ <button type="button" data-prompt-preset="blend" aria-pressed="false">Blend & cloth</button>+ <button type="button" data-prompt-preset="review" aria-pressed="false">Inspect</button></div>+ <p class="hero-prompt-text" data-agent-prompt>"Build an orbital Dyson relay with counter-rotating gimbals, helical collectors, and a solar plasma core."</p></aside></div><div class="hero-copy"><h1>A 3D engine<br />agents can drive</h1>- <p class="lede">Prompt an AI agent to author complex 3D models, seamless terrain blends, PBD cloth and Trace67 path-traced stills through 22 deterministic MCP tools.</p>+ <p class="lede">Real-time WebGL2 with Glaze, offline path tracing with Cook, and 22 MCP tools in one package.</p><div class="hero-actions"><a href="/docs.html#getting-started" data-icon="book">Get started</a><a href="https://www.npmjs.com/package/@codepawlhq/67js"><span class="package-logo package-logo-npm brand-npm" aria-hidden="true"></span>npm</a>@@ -87,57 +56,17 @@</div></section>- <section id="performance" class="engine-benchmark" aria-labelledby="benchmark-title">- <div class="section-heading">- <h2 id="benchmark-title">Built for AI agents, lighter than general engines</h2>- <a href="/docs.html#performance-and-memory">Measured bundle & runtime numbers</a>- </div>- <div class="benchmark-grid">- <article class="benchmark-card">- <h3>Gzip bundle size (same scene)</h3>- <p class="benchmark-note">Measured by <code>npm run size</code> on equivalent lit-box and glTF scenes.</p>- <div class="meter-group">- <div class="meter-row">- <div class="meter-label"><span>lit-box · <strong>67js</strong></span><span>50.9 KB gzip (2.6× smaller)</span></div>- <div class="meter-track"><span class="meter-fill is-67js" style="width: 38%"></span></div>- </div>- <div class="meter-row">- <div class="meter-label"><span>lit-box · three.js</span><span>133.8 KB gzip</span></div>- <div class="meter-track"><span class="meter-fill is-other" style="width: 100%"></span></div>- </div>- <div class="meter-row">- <div class="meter-label"><span>gltf-box · <strong>67js</strong></span><span>79.8 KB gzip (2.0× smaller)</span></div>- <div class="meter-track"><span class="meter-fill is-67js" style="width: 51%"></span></div>- </div>- <div class="meter-row">- <div class="meter-label"><span>gltf-box · three.js</span><span>156.4 KB gzip</span></div>- <div class="meter-track"><span class="meter-fill is-other" style="width: 100%"></span></div>- </div>- </div>- </article>- <article class="benchmark-card">- <h3>Why agents build better 3D in 67js</h3>- <ul class="agent-advantage-list">- <li><strong>Zero-code MCP loop:</strong> <code>scene_create</code>, <code>scene_apply</code>, <code>scene_look</code> and <code>scene_review</code> validate every edit against a strict schema and revision lock.</li>- <li><strong>Spatial self-diagnostics:</strong> Automatic closed-room detection, surface-normal inspection, contact & ground-clearance checks, and multi-angle contact sheets.</li>- <li><strong>Dual render engines:</strong> <code>Renderer67</code> for sub-millisecond WebGL2 frames + <strong>Trace67</strong> for deterministic CPU/GPU path-traced stills with OIDN/wavelet denoising.</li>- <li><strong>High-craft primitives built in:</strong> Screen-space <code>MeshBlend</code>, deterministic PBD <code>Cloth</code>, cascaded shadows, water reflections, and L1 SH light baking.</li>- </ul>- </article>- </div>- </section>-<section id="code" class="code-section" aria-labelledby="code-title"><div class="code-copy"><h2 id="code-title">A scene in a few lines</h2><div class="code-block">- <pre><code id="home-code" data-language="javascript">import { Renderer67 } from '67js';+ <pre><code id="home-code" data-language="javascript">import { Glaze } from '67js';import { loadGltf } from '67js/addons/gltf';import { loadHdri } from '67js/addons/hdri';const { parts } = await loadGltf('/airport.glb');const map = await loadHdri('/sky.hdr');-const renderer = new Renderer67(canvas, parts, {+const renderer = new Glaze(canvas, parts, {hdr: true,ground: false,environment: { map },@@ -147,13 +76,13 @@ renderer.render({ eye: [58, 31, 84], target: [-8, 3, -18] });</code></pre><button data-copy-code="home-code" aria-label="Copy the code example">Copy</button></div></div>- <img class="code-result" src="./previews/showcase-datacenter.webp" alt="A cutaway AI data center hall rendered by 67js from a GLB and an HDRI" width="1280" height="720" loading="lazy" />+ <img class="code-result" src="./previews/helios-relay.webp" alt="Helios-67 orbital Dyson relay rendered in real time by Glaze in 67js" width="1280" height="720" loading="lazy" /></section><section id="examples" class="examples" aria-labelledby="examples-title"><div class="section-heading"><h2 id="examples-title">Showcase</h2><a href="./showcase.html">Open the live scenes</a></div><ul class="capability-list" aria-label="Engine capabilities">- <li>PBR materials</li><li>Trace67 path tracer</li><li>MeshBlend seams</li><li>Live PBD cloth</li><li>Cascaded shadows</li><li>HDR and bloom</li><li>Volumetric fog</li><li>Skinning and morphs</li><li>Physics</li><li>Spume liquid</li><li>HDRI lighting</li><li>Textured terrain</li><li>Trees and grass</li><li>Vehicles</li><li>GLB import and export</li><li>PNG and MP4 export</li>+ <li>PBR materials</li><li>Shadows</li><li>HDR and bloom</li><li>MSAA</li><li>Mesh blend</li><li>Live cloth</li><li>Volumetric fog</li><li>Skinning and morphs</li><li>Physics</li><li>Spume liquid</li><li>HDRI lighting</li><li>Textured terrain</li><li>Trees and grass</li><li>Vehicles</li><li>GLB import and export</li><li>Cook path tracer</li></ul><div class="gallery"><a class="example is-lead" href="./showcase.html?scene=airport" data-glow="#ff6a2b"><span class="work-media"><img src="./previews/showcase-airport.webp" alt="Airport ramp, rendered by 67js" width="1280" height="720" loading="lazy" /></span><span class="work-title"><span class="work-index" aria-hidden="true">01</span><span class="work-name">Airport ramp</span><span class="work-date">A widebody at the stand with its service trucks</span></span></a>@@ -165,16 +94,26 @@ renderer.render({ eye: [58, 31, 84], target: [-8, 3, -18] });</code></pre><section id="agents" class="agents" aria-labelledby="agents-title"><div class="agents-intro"><h2 id="agents-title">Built for agents</h2>- <p>An agent gets a live scene to edit, render with Renderer67 or Trace67, and visually review.</p>+ <p>An agent gets a live scene to edit, glaze in real time or cook with path tracing, and review at 2.6× smaller bundle weight.</p><div class="code-block"><pre><code id="home-mcp" data-language="shell">npx 67js-mcp --backend gpu --memory 192</code></pre><button data-copy-code="home-mcp" aria-label="Copy the MCP server command">Copy</button></div>+ <div class="agent-size-bars" aria-label="Measured gzip bundle size on lit-box">+ <div class="size-bar-row">+ <div class="size-bar-label"><span><strong>67js</strong> (lit-box)</span><span>50.9 KB gzip · 2.6× smaller</span></div>+ <div class="size-bar-track"><span class="size-bar-fill is-67js" style="width: 38%"></span></div>+ </div>+ <div class="size-bar-row">+ <div class="size-bar-label"><span>three.js (lit-box)</span><span>133.8 KB gzip</span></div>+ <div class="size-bar-track"><span class="size-bar-fill is-other" style="width: 100%"></span></div>+ </div>+ </div></div><div class="agent-cards">- <a href="/mcp.md" data-icon="cube"><h3>22 MCP tools</h3><p>Create, edit, undo and render over stdio.</p></a>- <a href="/agent-scene.md" data-icon="code"><h3>Scene recipes</h3><p>One JSON file describes a whole scene.</p></a>- <a href="/agent-review.md" data-icon="image"><h3>Visual review</h3><p>Compare labeled views from one snapshot.</p></a>+ <a href="/mcp.md" data-icon="cube"><h3>22 MCP tools</h3><p>Create, edit, explode, blend and render over stdio.</p></a>+ <a href="/path-tracer.md" data-icon="code"><h3>Glaze + Cook</h3><p>Sub-millisecond WebGL2 frames or path-traced stills.</p></a>+ <a href="/agent-review.md" data-icon="image"><h3>Visual review</h3><p>Compare labeled views and normals from one snapshot.</p></a></div></section>diff --git a/public/previews/helios-relay.webp b/public/previews/helios-relay.webpnew file mode 100644index 00000000..2db3b18aBinary files /dev/null and b/public/previews/helios-relay.webp differdiff --git a/skills/render-67js-media/SKILL.md b/skills/render-67js-media/SKILL.mdindex 6cb4ac4e..4248f384 100644--- a/skills/render-67js-media/SKILL.md+++ b/skills/render-67js-media/SKILL.md@@ -17,7 +17,7 @@ For procedural motion, read `docs/agent-motion.md` and select `settings.motion.sFor imported character motion from `0.8.0`, read `docs/agent-character-motion.md`. Use independent `settings.animation` and `settings.motion` clocks.-For an offline path-traced still with **Trace67** (glass refraction, soft multi-bounce indirect light, subsurface random walk, many lights), read `docs/path-tracer.md` and submit an `image` job with `settings.renderer: { type: "trace67" }` (or `"pathTracer"`). It is slow, bounded and offline: read `scene_capabilities` `pathTracer` for its limits and what it skips, and keep rasterizer jobs for video and passes.+For an offline path-traced still with **Cook** (glass refraction, soft multi-bounce indirect light, subsurface random walk, many lights), read `docs/path-tracer.md` and submit an `image` job with `settings.renderer: { type: "cook" }` (or `"pathTracer"`). It is slow, bounded and offline: read `scene_capabilities` `pathTracer` for its limits and what it skips, and keep rasterizer jobs for video and passes.## Choose and renderdiff --git a/src/home-agent-hero.js b/src/home-agent-hero.jsindex ff179447..ae496faf 100644--- a/src/home-agent-hero.js+++ b/src/home-agent-hero.js@@ -1,113 +1,109 @@-// Live AI Agent 3D Workbench for the homepage hero: prompts an agent, shows the MCP tool pipeline, and drives a real-// procedural 3D model (WALL-E study, 60+ parts) with MeshBlend terrain rocks and a live PBD cloth banner in Renderer67.+// Live 3D hero scene for the homepage: HELIOS-67 Orbital Dyson Relay & Autonomous Strider Rig.+// Built with lathe, extrude, and tube modeling tools, brushed metal normal/roughness maps, HDRI sky reflections,+// screen-space MeshBlend basalt monoliths, and a live PBD cloth banner in Glaze (Renderer67).import { mat4, quat } from 'gl-matrix';-import { Renderer67 } from './renderer.js';-import { createModel } from './model.js';-import { box, cylinder, grid, sphere } from './geometry.js';+import { Glaze } from './renderer.js';+import { lathe, extrude, tube } from './modeling.js';+import { cylinder, grid, sphere, torus } from './geometry.js';+import { assemblyOffset } from './assembly.js';import { installMeshBlend } from './mesh-blend.js';import { createFlagAnimation } from './nature-flag.js';+import { loadHdri } from './hdri.js';const PROMPTS = {model: {- badge: 'scene_create · 64 parts · 0% exploded',- prompt: '"Build a 64-part articulated rover with weathered armor, stereo optics, and hydraulic treads."',- tools: [- { tool: 'scene_create', detail: '64 parts · 18.4k tris · shared instanced meshes' },- { tool: 'scene_apply', detail: 'set-material armor (metallic 0.62, roughness 0.43)' },- { tool: 'scene_look', detail: '0.28 ms CPU · 0 overlap errors · bounds verified' },- ],+ prompt: '"Build an orbital Dyson relay with counter-rotating gimbals, helical collectors, and a solar plasma core."',state: {- azimuth: 0.52,- elevation: 0.19,+ azimuth: 0.54,+ elevation: 0.22,distance: 7.4,- targetHeight: 1.32,+ targetHeight: 1.52,assembly: 0,inspection: false,- armorColor: [0.68, 0.38, 0.045],- armorSurface: [0.52, 0.38],- lightDirection: [-3.5, 6.2, 4.2],+ lightDirection: [-3.8, 6.2, 4.4],temperature: 0.04,- contrast: 1.04,- wind: 0.25,+ contrast: 1.06,+ wind: 0.35,},},explode: {- badge: 'scene_apply · explode-rig · 68% exploded',- prompt: '"Explode the outer shell 68% along assembly vectors so the agent can inspect the internal drive and boards."',- tools: [- { tool: 'scene_apply', detail: 'set-assembly 0.68 · interior & exterior layers' },- { tool: 'scene_inspect', detail: 'Battery cassette + Control electronics unobstructed' },- { tool: 'scene_review', detail: '4-view orthographic & perspective sheet passed' },- ],+ prompt: '"Explode the gimbal rings, collector blades, and strider legs 72% outward to inspect the singularity core."',state: {- azimuth: -0.58,- elevation: 0.24,- distance: 10.6,- targetHeight: 1.52,- assembly: 0.68,+ azimuth: -0.48,+ elevation: 0.26,+ distance: 9.8,+ targetHeight: 1.62,+ assembly: 0.72,inspection: false,- armorColor: [0.72, 0.78, 0.76],- armorSurface: [0.12, 0.24],- lightDirection: [4.2, 5.5, 3.4],- temperature: -0.08,- contrast: 1.06,- wind: 0.2,+ lightDirection: [4.2, 5.8, 3.6],+ temperature: -0.04,+ contrast: 1.07,+ wind: 0.25,},},blend: {- badge: 'addons/mesh-blend + cloth · live PBD wind',- prompt: '"Place basalt boulders with screen-space MeshBlend on the ground pad and pin a live wind banner behind the rover."',- tools: [- { tool: 'scene_apply', detail: 'enable createMeshBlend(radius: 0.22) on boulders' },- { tool: 'scene_apply', detail: 'attach createCloth PBD banner (pinned mast edge)' },- { tool: 'scene_render', detail: 'Renderer67 real-time + Trace67 path-traced still ready' },- ],+ prompt: '"Fuse volcanic basalt monoliths into the pad with MeshBlend and pin a live PBD wind banner to the mast."',state: {- azimuth: 0.34,- elevation: 0.15,- distance: 8.2,- targetHeight: 1.25,- assembly: 0.12,+ azimuth: 0.32,+ elevation: 0.14,+ distance: 8.1,+ targetHeight: 1.26,+ assembly: 0.1,inspection: false,- armorColor: [0.64, 0.36, 0.04],- armorSurface: [0.48, 0.40],- lightDirection: [-5.0, 3.4, 2.6],- temperature: 0.14,- contrast: 1.07,- wind: 0.85,+ lightDirection: [-5.2, 3.6, 2.8],+ temperature: 0.12,+ contrast: 1.08,+ wind: 0.9,},},review: {- badge: 'scene_review · surface normals & spatial check',- prompt: '"Switch to surface-normal diagnostic pass to verify bevel continuity, silhouette separation, and zero self-intersections."',- tools: [- { tool: 'scene_review', detail: 'pass: normal · crease & silhouette check passed' },- { tool: 'scene_diagnostics', detail: '0 warnings · all matrices finite & invertible' },- { tool: 'Trace67', detail: 'optional offline path trace: 64 spp wavelet / OIDN' },- ],+ prompt: '"Inspect surface normals across the turned nozzles and helical tubes before cooking a path-traced still."',state: {- azimuth: 0.78,- elevation: 0.22,+ azimuth: 0.82,+ elevation: 0.24,distance: 7.6,- targetHeight: 1.35,+ targetHeight: 1.54,assembly: 0.28,inspection: true,- armorColor: [0.62, 0.34, 0.035],- armorSurface: [0.48, 0.43],- lightDirection: [-3, 6, 4],+ lightDirection: [-3.2, 6.0, 4.0],temperature: 0,- contrast: 1.02,+ contrast: 1.03,wind: 0.4,},},};-function place(position, scale, rotation = [0, 0, 0]) {- const orientation = quat.fromEuler(quat.create(), ...rotation.map(angle => angle * 180 / Math.PI));+function place(position, scale = [1, 1, 1], degrees = [0, 0, 0]) {+ const orientation = quat.fromEuler(quat.create(), ...degrees);return mat4.fromRotationTranslationScale(mat4.create(), orientation, position, scale);}-function buildFlagGeometry(columns = 18, rows = 10, width = 1.35, height = 0.72) {+function brushedMaps() {+ const normal = document.createElement('canvas');+ const packed = document.createElement('canvas');+ normal.width = normal.height = packed.width = packed.height = 128;+ const normalContext = normal.getContext('2d');+ const packedContext = packed.getContext('2d');+ const normals = normalContext.createImageData(128, 128);+ const surfaces = packedContext.createImageData(128, 128);+ for (let row = 0; row < 128; row++) {+ for (let col = 0; col < 128; col++) {+ const offset = (row * 128 + col) * 4;+ const brushed = Math.sin(row * 3.8 + Math.sin(col * 0.35) * 0.2);+ normals.data.set([128, Math.round(128 + brushed * 5), 255, 255], offset);+ surfaces.data.set([255, Math.round(212 + brushed * 16), 255, 255], offset);+ }+ }+ normalContext.putImageData(normals, 0, 0);+ packedContext.putImageData(surfaces, 0, 0);+ return {+ normalMap: { image: normal, colorSpace: 'linear' },+ metallicRoughnessMap: { image: packed, colorSpace: 'linear' },+ normalScale: [0.45, 0.45],+ };+}++function buildFlagGeometry(columns = 18, rows = 10, width = 1.45, height = 0.74) {const base = grid(columns);const positions = new Float32Array((columns + 1) * (rows + 1) * 3);const normals = new Float32Array(positions.length);@@ -118,7 +114,7 @@ function buildFlagGeometry(columns = 18, rows = 10, width = 1.35, height = 0.72)const u = col / columns;const v = row / rows;positions[idx] = -(1 - u) * width;- positions[idx + 1] = (v - 0.5) * height;+ positions[idx + 1] = (0.5 - v) * height;positions[idx + 2] = 0;normals[idx + 2] = 1;}@@ -127,281 +123,612 @@ function buildFlagGeometry(columns = 18, rows = 10, width = 1.35, height = 0.72)for (let col = 0; col < columns; col++) {const a = row * (columns + 1) + col;const b = a + 1;- const c = a + columns + 1;+ const c = a + (columns + 1);const d = c + 1;- indices.push(a, b, c, b, d, c);+ indices.push(a, c, b, b, c, d);}}- return { positions, normals, indices: new Uint32Array(indices), _base: base };+ return {+ positions,+ normals,+ indices: new Uint32Array(indices),+ pinnedVertices: Array.from({ length: rows + 1 }, (_, row) => row * (columns + 1) + columns),+ };+}++function withUvs(geom) {+ if (geom.uvs) return geom;+ const count = geom.positions.length / 3;+ const uvs = new Float32Array(count * 2);+ for (let i = 0; i < count; i++) {+ const x = geom.positions[i * 3];+ const y = geom.positions[i * 3 + 1];+ const z = geom.positions[i * 3 + 2];+ uvs[i * 2] = Math.atan2(z, x) / (Math.PI * 2) + 0.5;+ uvs[i * 2 + 1] = y * 0.5 + 0.5;+ }+ return { ...geom, uvs };}-function createEnvironmentParts() {- const padMesh = cylinder(64, 0.04, 4);- const rockMesh = sphere(28, 18);- const mastMesh = cylinder(20, 0.01, 2);- const flagGeometry = buildFlagGeometry();-- const groundMaterial = { tag: 'floor', color: [0.16, 0.15, 0.19], metallic: 0.08, roughness: 0.82, emission: 0 };- const rockMaterial = { tag: 'rock', color: [0.24, 0.22, 0.27], metallic: 0.12, roughness: 0.74, emission: 0 };- const rimMaterial = { tag: 'steel', color: [1.0, 0.42, 0.17], metallic: 0.2, roughness: 0.3, emission: 0.65 };- const mastMaterial = { tag: 'steel', color: [0.52, 0.55, 0.58], metallic: 0.88, roughness: 0.26, emission: 0 };- const flagMaterial = { tag: 'cloth', color: [0.96, 0.38, 0.14], metallic: 0.06, roughness: 0.64, emission: 0.08, doubleSided: true };-- const flagPart = {- name: 'Agent signal banner',- geometry: flagGeometry,- matrix: place([-1.55, 2.75, -1.35], [1, 1, 1]),- material: flagMaterial,+function createHeliosScene() {+ const maps = brushedMaps();+ const obsidian = { tag: 'metal', color: [0.055, 0.06, 0.085], metallic: 0.88, roughness: 0.26, ...maps };+ const titanium = { tag: 'metal', color: [0.42, 0.46, 0.54], metallic: 0.94, roughness: 0.2, ...maps };+ const gold = { tag: 'metal', color: [0.76, 0.46, 0.14], metallic: 0.95, roughness: 0.22, ...maps };+ const copper = { tag: 'metal', color: [0.64, 0.28, 0.14], metallic: 0.9, roughness: 0.28, ...maps };+ const ceramic = { tag: 'ceramic', color: [0.78, 0.82, 0.88], metallic: 0.08, roughness: 0.22 };+ const solarCore = {+ tag: 'light',+ color: [0.95, 0.45, 0.12],+ metallic: 0.05,+ roughness: 0.15,+ emissiveColor: [1.0, 0.46, 0.1],+ emission: 2.8,+ };+ const cyanGlow = {+ tag: 'light',+ color: [0.16, 0.72, 0.98],+ metallic: 0.1,+ roughness: 0.18,+ emissiveColor: [0.18, 0.78, 1.0],+ emission: 2.1,};- const parts = [- {- name: 'Calibration pad',- geometry: padMesh,- matrix: place([0, -0.09, 0], [3.6, 0.09, 3.6]),- material: groundMaterial,- },- {- name: 'Calibration ring',- geometry: box(0.02, 2),- matrix: place([0, 0.005, 2.15], [1.4, 0.012, 0.05]),- material: rimMaterial,- },- {- name: 'Basalt outcrop West',- geometry: rockMesh,- matrix: place([-1.75, 0.22, 0.85], [0.62, 0.38, 0.52], [0.2, 0.5, -0.15]),- material: rockMaterial,- blend: { radius: 0.22 },- },- {- name: 'Basalt outcrop East',- geometry: rockMesh,- matrix: place([1.85, 0.18, -0.75], [0.55, 0.32, 0.48], [-0.15, 0.8, 0.2]),- material: rockMaterial,- blend: { radius: 0.22 },- },- {- name: 'Basalt boulder North',- geometry: rockMesh,- matrix: place([1.45, 0.14, 1.25], [0.38, 0.24, 0.34], [0.1, -0.4, 0.1]),- material: rockMaterial,- blend: { radius: 0.18 },- },- {- name: 'Telemetry mast',- geometry: mastMesh,- matrix: place([-1.52, 1.62, -1.35], [0.045, 1.65, 0.045]),- material: mastMaterial,- },- flagPart,- ];- return { parts, flagPart };-}+ // High-precision procedural meshes+ const gearContour = Array.from({ length: 128 }, (_, i) => {+ const a = (i / 128) * Math.PI * 2;+ const r = i % 4 < 2 ? 0.98 : 0.92;+ return [Math.cos(a) * r, Math.sin(a) * r];+ });+ const gearHole = Array.from({ length: 64 }, (_, i) => {+ const a = (i / 64) * Math.PI * 2;+ return [Math.cos(a) * 0.76, Math.sin(a) * 0.76];+ });-function damp(current, target, rate, dt) {- return target + (current - target) * Math.exp(-rate * dt);-}+ const meridianContour = Array.from({ length: 96 }, (_, i) => {+ const a = (i / 96) * Math.PI * 2;+ const r = i % 6 < 3 ? 1.18 : 1.13;+ return [Math.cos(a) * r, Math.sin(a) * r];+ });+ const meridianHole = Array.from({ length: 72 }, (_, i) => {+ const a = (i / 72) * Math.PI * 2;+ return [Math.cos(a) * 1.03, Math.sin(a) * 1.03];+ });-export function mountHeroAgentWorkbench() {- const canvas = document.querySelector('#hero-viewport');- const stage = document.querySelector('.hero-frame');- if (!canvas || !stage) return;-- const promptText = document.querySelector('[data-agent-prompt]');- const toolList = document.querySelector('[data-agent-tools]');- const badgeText = document.querySelector('[data-agent-badge]');- const metricsText = document.querySelector('[data-agent-metrics]');- const buttons = [...document.querySelectorAll('[data-prompt-preset]')];- const reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;-- let renderer = null;- let flagAnimation = null;- let initError = null;- let activeKey = 'model';- const current = {- azimuth: PROMPTS.model.state.azimuth,- elevation: PROMPTS.model.state.elevation,- distance: PROMPTS.model.state.distance,- targetHeight: PROMPTS.model.state.targetHeight,- assembly: PROMPTS.model.state.assembly,- armorColor: [...PROMPTS.model.state.armorColor],- armorSurface: [...PROMPTS.model.state.armorSurface],- lightDirection: [...PROMPTS.model.state.lightDirection],- temperature: PROMPTS.model.state.temperature,- contrast: PROMPTS.model.state.contrast,- wind: PROMPTS.model.state.wind,- inspection: false,+ const meshes = {+ pedestal: lathe(+ [+ [0, 0.02], [1.18, 0.02], [1.26, 0.07], [1.22, 0.16], [1.04, 0.22],+ [0.96, 0.3], [0.88, 0.38], [0.74, 0.44], [0.68, 0.54], [0, 0.54],+ ],+ { segments: 96 },+ ),+ lowerNozzle: lathe(+ [+ [0, 0.56], [0.36, 0.56], [0.58, 0.64], [0.74, 0.78], [0.78, 0.92],+ [0.72, 0.95], [0.64, 0.82], [0.46, 0.7], [0.22, 0.66], [0, 0.66],+ ],+ { segments: 96 },+ ),+ upperCrown: lathe(+ [+ [0, 2.52], [0.44, 2.52], [0.72, 2.6], [0.78, 2.68], [0.7, 2.76],+ [0.54, 2.82], [0.42, 2.96], [0.24, 3.08], [0.12, 3.18], [0.04, 3.32], [0, 3.32],+ ],+ { segments: 96 },+ ),+ collectorRib: tube(+ [+ [0.72, 0.84, 0],+ [1.16, 1.22, 0.16],+ [1.24, 1.74, 0.28],+ [1.02, 2.26, 0.2],+ [0.66, 2.58, 0],+ ],+ { radius: 0.036, segments: 56, radialSegments: 10 },+ ),+ innerCoil: tube(+ [+ [0.54, 0.8, 0],+ [0.82, 1.26, -0.14],+ [0.84, 1.82, -0.18],+ [0.58, 2.38, -0.08],+ [0.48, 2.54, 0],+ ],+ { radius: 0.018, segments: 48, radialSegments: 8 },+ ),+ striderLeg: tube(+ [+ [0.88, 0.36, 0],+ [1.36, 0.52, 0.08],+ [1.72, 0.28, 0.04],+ [1.92, 0.04, 0],+ ],+ { radius: 0.055, segments: 36, radialSegments: 10 },+ ),+ gear: extrude(gearContour, { holes: [gearHole], depth: 0.045, bevel: 0.006, bevelSegments: 2 }),+ meridian: extrude(meridianContour, { holes: [meridianHole], depth: 0.06, bevel: 0.008, bevelSegments: 2 }),+ gyroRing: withUvs(torus(0.032, 84, 14)),+ innerRing: withUvs(torus(0.022, 72, 12)),+ orb: withUvs(sphere(44, 28)),+ bolt: withUvs(cylinder(12, 0.04, 2)),};- let target = { ...PROMPTS.model.state };- function renderHud(key) {- const preset = PROMPTS[key];- if (!preset) return;- if (promptText) promptText.textContent = preset.prompt;- if (badgeText) badgeText.textContent = preset.badge;- if (toolList) {- toolList.innerHTML = preset.tools- .map(item => `<li><code>${item.tool}</code><span>${item.detail}</span></li>`)- .join('');- }- for (const button of buttons) {- button.setAttribute('aria-pressed', String(button.dataset.promptPreset === key));- }+ const parts = [];+ const animated = [];++ function add(name, geometry, material, position = [0, 0, 0], scale = [1, 1, 1], degrees = [0, 0, 0], assembly = [0, 0, 0]) {+ const baseMatrix = place(position, scale, degrees);+ const part = {+ name,+ geometry,+ material,+ matrix: mat4.clone(baseMatrix),+ baseMatrix,+ assembly,+ };+ parts.push(part);+ return part;+ }++ // Pedestal & nozzles+ add('Obsidian reactor plinth', meshes.pedestal, obsidian, [0, 0, 0], [1, 1, 1], [0, 0, 0], [0, -0.7, 0]);+ add('Lower magnetic confinement bell', meshes.lowerNozzle, gold, [0, 0, 0], [1, 1, 1], [0, 0, 0], [0, -0.35, 0]);+ add('Upper Dyson collector crown', meshes.upperCrown, gold, [0, 0, 0], [1, 1, 1], [0, 0, 0], [0, 1.35, 0]);++ // Singularity core & inner plasma shell+ const core = add('Solar plasma singularity core', meshes.orb, solarCore, [0, 1.68, 0], [0.42, 0.42, 0.42], [0, 0, 0], [0, 0, 0]);+ animated.push({ part: core, kind: 'pulse', basePosition: [0, 1.68, 0], baseScale: [0.42, 0.42, 0.42] });++ add('Lower Cerenkov injector', meshes.orb, cyanGlow, [0, 0.88, 0], [0.2, 0.11, 0.2], [0, 0, 0], [0, -0.25, 0]);+ add('Upper Cerenkov injector', meshes.orb, cyanGlow, [0, 2.48, 0], [0.2, 0.11, 0.2], [0, 0, 0], [0, 0.95, 0]);+ add('Apex telemetry jewel', meshes.orb, titanium, [0, 3.38, 0], [0.09, 0.09, 0.09], [0, 0, 0], [0, 1.7, 0]);++ // Counter-rotating base gear rings+ for (let i = 0; i < 2; i++) {+ const g = add(+ `Azimuth drive gear ${i}`,+ meshes.gear,+ i === 0 ? gold : titanium,+ [0, 0.46 + i * 0.055, 0],+ [1, 1, 1],+ [-90, 0, 0],+ [0, -0.45 + i * 0.12, 0],+ );+ animated.push({ part: g, kind: 'spinZ', speed: i === 0 ? 0.18 : -0.24 });+ }++ // 3-Axis Counter-Rotating Gimbal Cage around the core+ const outerGimbal = add(+ 'Outer meridian gimbal ring',+ meshes.meridian,+ obsidian,+ [0, 1.68, 0],+ [0.86, 0.86, 0.86],+ [18, 0, 0],+ [0, 0.35, 1.15],+ );+ animated.push({ part: outerGimbal, kind: 'gimbalOuter', center: [0, 1.68, 0], scale: [0.86, 0.86, 0.86] });++ const middleGimbal = add(+ 'Middle gold gyroscope ring',+ meshes.gyroRing,+ gold,+ [0, 1.68, 0],+ [0.78, 0.78, 0.78],+ [62, 24, 0],+ [-1.05, 0.25, 0.45],+ );+ animated.push({ part: middleGimbal, kind: 'gimbalMid', center: [0, 1.68, 0], scale: [0.78, 0.78, 0.78] });++ const innerGimbal = add(+ 'Inner Cerenkov containment ring',+ meshes.innerRing,+ cyanGlow,+ [0, 1.68, 0],+ [0.58, 0.58, 0.58],+ [35, -40, 0],+ [1.05, 0.2, -0.45],+ );+ animated.push({ part: innerGimbal, kind: 'gimbalInner', center: [0, 1.68, 0], scale: [0.58, 0.58, 0.58] });++ // 10 Helical collector ribs + 10 copper superconducting coils+ for (let i = 0; i < 10; i++) {+ const deg = (i / 10) * 360;+ const rad = (deg * Math.PI) / 180;+ const dirX = Math.cos(rad);+ const dirZ = Math.sin(rad);+ add(+ `Helical collector rib ${i}`,+ meshes.collectorRib,+ i % 2 === 0 ? titanium : obsidian,+ [0, 0, 0],+ [1, 1, 1],+ [0, deg, 0],+ [dirX * 1.15, 0.22, dirZ * 1.15],+ );+ add(+ `Superconducting coil ${i}`,+ meshes.innerCoil,+ copper,+ [0, 0, 0],+ [1, 1, 1],+ [0, deg + 18, 0],+ [dirX * 0.72, 0.1, dirZ * 0.72],+ );+ }++ // Collar containment rings+ for (const [idx, height] of [0.96, 1.32, 2.04, 2.42].entries()) {+ const r = idx === 1 || idx === 2 ? 0.94 : 0.74;+ add(+ `Containment collar ${idx}`,+ meshes.gyroRing,+ idx % 2 === 0 ? gold : titanium,+ [0, height, 0],+ [r, r, r],+ [90, 0, 0],+ [0, (idx - 1.5) * 0.55, 0],+ );+ }++ // 6 Heavy articulated strider anchor legs + footpads + cyan beacon nodes+ for (let i = 0; i < 6; i++) {+ const deg = (i / 6) * 360 + 15;+ const rad = (deg * Math.PI) / 180;+ const dirX = Math.cos(rad);+ const dirZ = Math.sin(rad);+ add(+ `Strider anchor leg ${i}`,+ meshes.striderLeg,+ obsidian,+ [0, 0, 0],+ [1, 1, 1],+ [0, deg, 0],+ [dirX * 1.25, -0.3, dirZ * 1.25],+ );+ add(+ `Strider footpad ${i}`,+ meshes.bolt,+ gold,+ [dirX * 1.92, 0.04, -dirZ * 1.92],+ [0.22, 0.04, 0.22],+ [0, deg, 0],+ [dirX * 1.4, -0.45, -dirZ * 1.4],+ );+ add(+ `Strider knee node ${i}`,+ meshes.orb,+ i % 2 === 0 ? cyanGlow : solarCore,+ [dirX * 1.36, 0.54, -dirZ * 1.36],+ [0.055, 0.055, 0.055],+ [0, 0, 0],+ [dirX * 1.35, -0.1, -dirZ * 1.35],+ );}+ // 16 Radial pedestal bolts+ for (let i = 0; i < 16; i++) {+ const a = (i / 16) * Math.PI * 2;+ add(+ `Plinth bolt ${i}`,+ meshes.bolt,+ ceramic,+ [Math.cos(a) * 1.12, 0.19, Math.sin(a) * 1.12],+ [0.032, 0.02, 0.032],+ [0, 0, 0],+ [Math.cos(a) * 0.45, -0.5, Math.sin(a) * 0.45],+ );+ }++ // 3 Autonomous orbital recon drones+ for (let i = 0; i < 3; i++) {+ const drone = add(+ `Orbital recon drone ${i}`,+ meshes.orb,+ i === 0 ? solarCore : cyanGlow,+ [1.8, 1.8, 0],+ [0.075, 0.045, 0.075],+ [0, 0, 0],+ [Math.cos(i * 2.1) * 0.9, 0.6, Math.sin(i * 2.1) * 0.9],+ );+ animated.push({ part: drone, kind: 'drone', index: i, radius: 1.58 + i * 0.18, height: 1.45 + i * 0.32 });+ }++ return { parts, animated };+}++export function mountHeroAgentWorkbench() {+ return mountHomeAgentHero();+}++export function mountHomeAgentHero() {+ const canvas = document.querySelector('#hero-viewport');+ const frame = document.querySelector('.hero-frame');+ if (!canvas || !frame) return;++ let helios;+ let allParts;+ let renderer;+ let flagAnimation;try {- const modelParts = createModel();- const env = createEnvironmentParts();- const allParts = [...modelParts, ...env.parts];- renderer = new Renderer67(canvas, allParts, {+ helios = createHeliosScene();++ // Volcanic obsidian landing pad + MeshBlend basalt monoliths + live PBD Cloth banner+ const groundDisk = cylinder(64, 0.01, 2);+ const basaltSpire = sphere(20, 14);+ const poleMesh = cylinder(16, 0.03, 2);+ const flagGeometry = buildFlagGeometry(18, 10, 1.45, 0.74);++ const groundMaterial = { tag: 'floor', color: [0.09, 0.085, 0.12], metallic: 0.12, roughness: 0.84 };+ const basaltMaterial = { tag: 'rock', color: [0.13, 0.12, 0.16], metallic: 0.18, roughness: 0.76, blend: { radius: 0.24 } };+ const mastMaterial = { tag: 'metal', color: [0.58, 0.62, 0.7], metallic: 0.88, roughness: 0.24 };+ const flagMaterial = {+ tag: 'cloth',+ color: [0.92, 0.36, 0.09],+ metallic: 0.08,+ roughness: 0.62,+ doubleSided: true,+ };++ const flagPart = {+ name: 'Expedition wind banner',+ geometry: flagGeometry,+ matrix: place([-2.55, 2.28, -1.25], [1, 1, 1], [0, 26, 0]),+ material: flagMaterial,+ };++ const environmentParts = [+ {+ name: 'Landing pad ground',+ geometry: groundDisk,+ matrix: place([0, -0.02, 0], [6.4, 0.04, 6.4]),+ material: groundMaterial,+ },+ {+ name: 'Basalt monolith West',+ geometry: basaltSpire,+ matrix: place([-2.25, 0.24, 1.18], [0.82, 0.56, 0.68], [8, 22, -6]),+ material: basaltMaterial,+ },+ {+ name: 'Basalt monolith West shard',+ geometry: basaltSpire,+ matrix: place([-1.68, 0.12, 1.54], [0.46, 0.3, 0.42], [-5, 45, 11]),+ material: basaltMaterial,+ },+ {+ name: 'Basalt monolith East',+ geometry: basaltSpire,+ matrix: place([2.35, 0.28, -0.92], [0.92, 0.62, 0.74], [-6, -28, 8]),+ material: basaltMaterial,+ },+ {+ name: 'Basalt monolith East outcrop',+ geometry: basaltSpire,+ matrix: place([1.84, 0.14, -1.48], [0.52, 0.32, 0.46], [9, 14, -10]),+ material: basaltMaterial,+ },+ {+ name: 'Telemetry mast',+ geometry: poleMesh,+ matrix: place([-2.55, 1.38, -1.25], [0.04, 1.38, 0.04]),+ material: mastMaterial,+ },+ flagPart,+ ];++ allParts = [...helios.parts, ...environmentParts];++ renderer = new Glaze(canvas, allParts, {hdr: true,- depth: true,ground: false,+ depth: true,samples: 4,- memoryBudgetMiB: 256,- pixelRatio: Math.min(window.devicePixelRatio || 1, 1.5),- shadowBounds: { extent: 6.5, eye: [-3.5, 7, 4], target: [0, 1.3, 0] },+ pixelRatio: Math.min(window.devicePixelRatio || 1, 1.75),+ memoryBudgetMiB: 192,+ environment: {+ pointLights: [+ { position: [0, 1.68, 0], color: [1.0, 0.54, 0.18], intensity: 6.5, range: 8, radius: 0.12 },+ { position: [-2.4, 2.6, 2.2], color: [0.24, 0.74, 1.0], intensity: 4.2, range: 10, radius: 0.15 },+ ],+ },});installMeshBlend(renderer);- flagAnimation = createFlagAnimation(renderer, env.flagPart);- stage.dataset.live = 'true';- } catch (error) {- initError = error?.message || String(error);+ flagAnimation = createFlagAnimation(renderer, flagPart);+ } catch (err) {+ window.__heroWorkbench = { error: err.message };+ return;}- let frameId = 0;- let lastTimestamp = 0;- let visible = true;- let dragging = null;+ frame.dataset.live = 'true';+ frame.dataset.live = 'true';+ frame.classList.add('is-live-3d');- function step(timestamp) {- frameId = 0;- if (document.hidden || !visible || !renderer) {- lastTimestamp = 0;- return;- }- const dt = lastTimestamp ? Math.min((timestamp - lastTimestamp) / 1000, 0.05) : 1 / 60;- lastTimestamp = timestamp;- const rate = reducedMotion ? 18 : 6.5;+ // Load preview HDRI asynchronously for real sky reflections on brushed gold & obsidian+ let envMap = null;+ loadHdri('./showcase/datacenter/sky.preview.hdr')+ .then(map => {+ envMap = map;+ })+ .catch(() => {});++ const current = { ...PROMPTS.model.state };+ let target = { ...PROMPTS.model.state };+ let activeKey = 'model';+ let dragging = false;+ let userInteracted = false;+ let pointerStart = [0, 0];+ let orbitStart = [0, 0];+ let simTime = 0;+ let lastNow = performance.now();++ const promptEl = document.querySelector('[data-agent-prompt]');+ const presetButtons = [...document.querySelectorAll('[data-prompt-preset]')];++ function applyPresetUI(key) {+ const preset = PROMPTS[key];+ if (!preset) return;+ activeKey = key;+ target = { ...preset.state };+ presetButtons.forEach(btn => {+ btn.setAttribute('aria-pressed', String(btn.dataset.promptPreset === key));+ });+ if (promptEl) promptEl.textContent = preset.prompt;+ }- if (!dragging && !reducedMotion) {- target.azimuth += dt * 0.08;+ presetButtons.forEach(btn => {+ btn.addEventListener('click', () => {+ userInteracted = true;+ applyPresetUI(btn.dataset.promptPreset);+ });+ });++ const presetKeys = Object.keys(PROMPTS);+ const autoCycle = setInterval(() => {+ if (userInteracted || document.hidden) return;+ const nextIdx = (presetKeys.indexOf(activeKey) + 1) % presetKeys.length;+ applyPresetUI(presetKeys[nextIdx]);+ }, 6500);++ canvas.addEventListener('pointerdown', event => {+ userInteracted = true;+ dragging = true;+ pointerStart = [event.clientX, event.clientY];+ orbitStart = [target.azimuth, target.elevation];+ canvas.setPointerCapture(event.pointerId);+ });++ canvas.addEventListener('pointermove', event => {+ if (!dragging) return;+ const dx = event.clientX - pointerStart[0];+ const dy = event.clientY - pointerStart[1];+ target.azimuth = orbitStart[0] - dx * 0.0065;+ target.elevation = Math.max(0.05, Math.min(1.15, orbitStart[1] + dy * 0.0055));+ });++ const endDrag = () => { dragging = false; };+ canvas.addEventListener('pointerup', endDrag);+ canvas.addEventListener('pointercancel', endDrag);++ function updateRigTransforms(assemblyAmount, time) {+ // Animate dynamic parts first+ for (const item of helios.animated) {+ if (item.kind === 'pulse') {+ const s = 1 + Math.sin(time * 3.2) * 0.055;+ mat4.fromRotationTranslationScale(+ item.part.baseMatrix,+ quat.create(),+ item.basePosition,+ item.baseScale.map(v => v * s),+ );+ } else if (item.kind === 'spinZ') {+ const q = quat.fromEuler(quat.create(), -90, (time * item.speed * 180) / Math.PI, 0);+ mat4.fromRotationTranslationScale(item.part.baseMatrix, q, [0, item.part.baseMatrix[13], 0], [1, 1, 1]);+ } else if (item.kind === 'gimbalOuter') {+ const q = quat.fromEuler(quat.create(), 18, (time * 0.38 * 180) / Math.PI, 12);+ mat4.fromRotationTranslationScale(item.part.baseMatrix, q, item.center, item.scale);+ } else if (item.kind === 'gimbalMid') {+ const q = quat.fromEuler(quat.create(), 62 + Math.sin(time * 0.7) * 22, (-time * 0.62 * 180) / Math.PI, 24);+ mat4.fromRotationTranslationScale(item.part.baseMatrix, q, item.center, item.scale);+ } else if (item.kind === 'gimbalInner') {+ const q = quat.fromEuler(quat.create(), (time * 1.15 * 180) / Math.PI, -40, (time * 0.85 * 180) / Math.PI);+ mat4.fromRotationTranslationScale(item.part.baseMatrix, q, item.center, item.scale);+ } else if (item.kind === 'drone') {+ const a = time * (0.65 + item.index * 0.18) + item.index * 2.09;+ const pos = [+ Math.cos(a) * item.radius,+ item.height + Math.sin(time * 1.8 + item.index) * 0.18,+ Math.sin(a) * item.radius,+ ];+ mat4.fromRotationTranslationScale(item.part.baseMatrix, quat.create(), pos, [0.075, 0.045, 0.075]);+ }}- current.azimuth = damp(current.azimuth, target.azimuth, rate, dt);- current.elevation = damp(current.elevation, target.elevation, rate, dt);- current.distance = damp(current.distance, target.distance, rate, dt);- current.targetHeight = damp(current.targetHeight, target.targetHeight, rate, dt);- current.assembly = damp(current.assembly, target.assembly, rate, dt);- current.temperature = damp(current.temperature, target.temperature, rate, dt);- current.contrast = damp(current.contrast, target.contrast, rate, dt);- current.wind = damp(current.wind, target.wind, rate, dt);- for (let i = 0; i < 3; i++) {- current.armorColor[i] = damp(current.armorColor[i], target.armorColor[i], rate, dt);- current.lightDirection[i] = damp(current.lightDirection[i], target.lightDirection[i], rate, dt);+ // Apply exploded assembly vectors+ for (const part of helios.parts) {+ const offset = assemblyOffset(part.assembly, assemblyAmount);+ part.matrix.set(part.baseMatrix);+ part.matrix[12] += offset[0];+ part.matrix[13] += offset[1];+ part.matrix[14] += offset[2];}- for (let i = 0; i < 2; i++) {- current.armorSurface[i] = damp(current.armorSurface[i], target.armorSurface[i], rate, dt);+ renderer.updateParts(allParts);+ }++ const resizeObserver = new ResizeObserver(() => {+ renderer.resize();+ });+ resizeObserver.observe(canvas);++ let rafId = 0;+ function tick(now) {+ const dt = Math.min(0.05, Math.max(0.001, (now - lastNow) / 1000));+ lastNow = now;+ simTime += dt;++ const blend = 1 - Math.exp(-dt * 5.5);+ if (!dragging) {+ target.azimuth += dt * 0.11;}+ current.azimuth += (target.azimuth - current.azimuth) * blend;+ current.elevation += (target.elevation - current.elevation) * blend;+ current.distance += (target.distance - current.distance) * blend;+ current.targetHeight += (target.targetHeight - current.targetHeight) * blend;+ current.assembly += (target.assembly - current.assembly) * blend;+ current.temperature += (target.temperature - current.temperature) * blend;+ current.contrast += (target.contrast - current.contrast) * blend;+ current.wind += (target.wind - current.wind) * blend;current.inspection = target.inspection;+ for (let i = 0; i < 3; i++) {+ current.lightDirection[i] += (target.lightDirection[i] - current.lightDirection[i]) * blend;+ }- flagAnimation.update(timestamp / 1000, current.wind);+ updateRigTransforms(current.assembly, simTime);+ flagAnimation.update(simTime, current.wind);- const mobile = canvas.clientWidth <= 820;- renderer.projection[8] = mobile ? 0 : 0.16;- const dist = current.distance * (mobile ? 1.12 : 1);- const lookTarget = [0, current.targetHeight, 0];+ const cosEl = Math.cos(current.elevation);const eye = [- Math.sin(current.azimuth) * Math.cos(current.elevation) * dist,- lookTarget[1] + Math.sin(current.elevation) * dist,- Math.cos(current.azimuth) * Math.cos(current.elevation) * dist,+ Math.sin(current.azimuth) * cosEl * current.distance,+ current.targetHeight + Math.sin(current.elevation) * current.distance,+ Math.cos(current.azimuth) * cosEl * current.distance,];renderer.render({- target: lookTarget,eye,- armorColor: current.armorColor,- armorSurface: current.armorSurface,- exposure: 1.04,+ target: [0, current.targetHeight, 0],+ fov: 35,+ time: simTime,inspection: current.inspection,- assemblyAmount: current.assembly,- environment: { lightDirection: current.lightDirection },+ environment: {+ lightDirection: current.lightDirection,+ wind: current.wind,+ ...(envMap ? { map: envMap } : {}),+ pointLights: [+ { position: [0, 1.68, 0], color: [1.0, 0.54, 0.18], intensity: 6.5, range: 8, radius: 0.12 },+ { position: [-2.4, 2.6, 2.2], color: [0.24, 0.74, 1.0], intensity: 4.2, range: 10, radius: 0.15 },+ ],+ },effects: {+ bloom: { strength: 0.24, threshold: 0.9, radius: 1.2 },contrast: current.contrast,temperature: current.temperature,- saturation: 1.04,- vignette: 0.12,- bloom: { strength: 0.14, threshold: 1.1, radius: 1 },+ vignette: 0.14,},});- if (metricsText) {- metricsText.textContent = `${renderer.batches.length} draws · ${(renderer.cpuMilliseconds || 0.25).toFixed(2)} ms CPU · 50.9 KB gzip core`;- }-- if (!reducedMotion) wake();- }-- function wake() {- if (!frameId && visible && !document.hidden && renderer) {- frameId = requestAnimationFrame(step);- }- }-- for (const button of buttons) {- button.addEventListener('click', () => {- const key = button.dataset.promptPreset;- if (!PROMPTS[key]) return;- activeKey = key;- target = {- ...PROMPTS[key].state,- armorColor: [...PROMPTS[key].state.armorColor],- armorSurface: [...PROMPTS[key].state.armorSurface],- lightDirection: [...PROMPTS[key].state.lightDirection],- };- renderHud(key);- if (reducedMotion) {- Object.assign(current, target);- }- wake();- });+ rafId = requestAnimationFrame(tick);}- if (renderer) {- canvas.addEventListener('pointerdown', event => {- if (event.button !== 0) return;- dragging = { x: event.clientX, y: event.clientY, azimuth: target.azimuth, elevation: target.elevation };- canvas.setPointerCapture(event.pointerId);- });- canvas.addEventListener('pointermove', event => {- if (!dragging) return;- const dx = (event.clientX - dragging.x) / Math.max(canvas.clientWidth, 1);- const dy = (event.clientY - dragging.y) / Math.max(canvas.clientHeight, 1);- target.azimuth = dragging.azimuth - dx * 2.6;- target.elevation = Math.max(-0.05, Math.min(0.85, dragging.elevation + dy * 1.4));- wake();- });- const endDrag = () => { dragging = null; };- canvas.addEventListener('pointerup', endDrag);- canvas.addEventListener('pointercancel', endDrag);-- new IntersectionObserver(entries => {- visible = entries[0]?.isIntersecting ?? true;- wake();- }).observe(stage);- document.addEventListener('visibilitychange', wake);- window.addEventListener('resize', () => {- renderer.resize();- wake();- });- }+ updateRigTransforms(0, 0);+ renderer.resize();+ rafId = requestAnimationFrame(tick);- renderHud(activeKey);- wake();- window.__heroWorkbench = {- get renderer() { return renderer; },- get error() { return initError; },- selectPreset: key => buttons.find(b => b.dataset.promptPreset === key)?.click(),- };+ window.__heroWorkbench = { renderer, applyPresetUI };+ window.addEventListener('pagehide', () => {+ clearInterval(autoCycle);+ cancelAnimationFrame(rafId);+ resizeObserver.disconnect();+ renderer.dispose();+ });}diff --git a/src/index.js b/src/index.jsindex 09c6805b..d6371d72 100644--- a/src/index.js+++ b/src/index.js@@ -1,5 +1,5 @@export { VERSION } from './version.js';-export { Renderer67 } from './renderer.js';+export { Renderer67, Glaze, Mog } from './renderer.js';export { box, cylinder, sphere, torus } from './geometry.js';export { exportGlb } from './export.js';export { createAnimationMixer } from './animation-mixer.js';diff --git a/src/path-tracer.js b/src/path-tracer.jsindex 17781138..53a777c1 100644--- a/src/path-tracer.js+++ b/src/path-tracer.js@@ -1069,4 +1069,5 @@ export async function renderPathTracedImage({ parts, environment = {}, camera },};}+export const Cook = renderPathTracedImage;export const Trace67 = renderPathTracedImage;diff --git a/src/renderer.js b/src/renderer.jsindex 9ff6666d..44f579e0 100644--- a/src/renderer.js+++ b/src/renderer.js@@ -2303,3 +2303,5 @@ export class Renderer67 {this.updateBatches?.clear();}}++export { Renderer67 as Glaze, Renderer67 as Mog };diff --git a/src/site.css b/src/site.cssindex 5a4cc620..fc65765a 100644--- a/src/site.css+++ b/src/site.css@@ -433,213 +433,96 @@ body.site > main > section { scroll-margin-top: 96px; }.site .hero-viewport:active { cursor: grabbing; }.site .hero-frame[data-live="true"] .hero-viewport { opacity: 1; }.site .hero-frame[data-live="true"] .hero-shot { opacity: 0; pointer-events: none; transition: opacity .35s ease; }-.site .hero-caption {- display: inline-flex;- align-items: center;- gap: 8px;- font-family: var(--mono);- font-size: 12px;-}-.site .hero-status-dot {- width: 8px;- height: 8px;- border-radius: 999px;- background: #22c55e;- box-shadow: 0 0 10px #22c55ecc;- flex-shrink: 0;-}-.site .hero-caption-sep { color: var(--muted); }-.site .hero-workbench {++.site .hero-prompt {position: absolute;z-index: 2;- right: 20px;- bottom: 20px;- width: min(430px, calc(100% - 40px));+ right: 22px;+ bottom: 22px;+ width: min(370px, calc(100% - 44px));display: grid;- gap: 10px;- padding: 14px 16px;- border-radius: 18px;- background: #0d0a16d9;- box-shadow: inset 0 0 0 1px #ffffff24, 0 24px 60px #00000080;- -webkit-backdrop-filter: blur(18px) saturate(1.5);- backdrop-filter: blur(18px) saturate(1.5);-}-.site .workbench-header {- display: flex;- align-items: center;- justify-content: space-between;gap: 8px;- font-size: 12px;-}-.site .workbench-pill {- padding: 2px 9px;- border-radius: 999px;- background: #ff6a2b2e;- color: #ffb088;- font-weight: 600;- letter-spacing: .2px;-}-.site .workbench-engine {- color: var(--muted);- font-family: var(--mono);- font-size: 11px;-}-.site .workbench-tabs {+ padding: 10px 12px;+ border-radius: 14px;+ background: #0d0a16cc;+ box-shadow: inset 0 0 0 1px #ffffff24, 0 18px 44px #00000066;+ -webkit-backdrop-filter: blur(16px) saturate(1.4);+ backdrop-filter: blur(16px) saturate(1.4);+}+.site .hero-prompt-tabs {display: grid;grid-template-columns: repeat(4, minmax(0, 1fr));- gap: 5px;+ gap: 4px;}-.site .workbench-tabs button {- min-height: 28px;- padding: 4px 6px;+.site .hero-prompt-tabs button {+ min-height: 27px;+ padding: 3px 6px;border-radius: 8px;background: #ffffff0f;color: var(--muted);- font-size: 11px;- font-weight: 600;+ font-size: 11.5px;+ font-weight: 500;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}-.site .workbench-tabs button[aria-pressed="true"] {+.site .hero-prompt-tabs button[aria-pressed="true"] {background: var(--primary);color: var(--primary-text);+ font-weight: 600;}-.site .workbench-prompt {- padding: 8px 10px;- border-radius: 10px;- background: #07050cb3;- box-shadow: inset 0 0 0 1px #ffffff14;- color: #f4f1ff;+.site .hero-prompt-text {+ margin: 0;+ padding: 2px 4px;+ color: #f1edff;font-family: var(--mono);font-size: 12px;line-height: 1.45;}-.site .workbench-tools {- margin: 0;- padding: 0;- list-style: none;- display: grid;- gap: 5px;-}-.site .workbench-tools li {- display: grid;- grid-template-columns: auto minmax(0, 1fr);- align-items: baseline;- gap: 8px;- font-size: 12px;- color: var(--muted);-}-.site .workbench-tools code {- padding: 1px 6px;- border-radius: 6px;- background: #ffffff12;- color: #a5b4fc;- font-size: 11px;-}-.site .workbench-tools span {- overflow: hidden;- text-overflow: ellipsis;- white-space: nowrap;-}-.site .workbench-links {- display: flex;- flex-wrap: wrap;- gap: 6px 14px;- padding-top: 4px;- border-top: 1px solid #ffffff14;- font-size: 12px;-}-.site .workbench-links a {- color: #d9d3ee;- font-weight: 500;-}-.site .workbench-links a:hover {- color: #fff;- text-decoration: underline;-}-.site .engine-benchmark {+.site .agent-size-bars {display: grid;- gap: 20px;-}-.site .benchmark-grid {- display: grid;- grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);- gap: 20px;-}-.site .benchmark-card {- display: grid;- align-content: start;- gap: 14px;- padding: clamp(20px, 3vw, 28px);- border-radius: 20px;- background: #ffffff0d;- box-shadow: inset 0 0 0 1px var(--invert-border);-}-.site .benchmark-note {- color: var(--muted);- font-size: 13px;-}-.site .meter-group {- display: grid;- gap: 12px;- margin-top: 4px;+ gap: 8px;+ margin-top: 6px;+ padding-top: 10px;+ border-top: 1px solid #ffffff17;}-.site .meter-row {+.site .size-bar-row {display: grid;- gap: 5px;+ gap: 4px;}-.site .meter-label {+.site .size-bar-label {display: flex;justify-content: space-between;gap: 10px;- font-size: 13px;+ font-size: 12.5px;color: var(--muted);}-.site .meter-label strong { color: var(--text); }-.site .meter-track {- height: 8px;+.site .size-bar-label strong { color: var(--text); }+.site .size-bar-track {+ height: 6px;border-radius: 999px;- background: #ffffff12;+ background: #ffffff14;overflow: hidden;}-.site .meter-fill {+.site .size-bar-fill {display: block;height: 100%;border-radius: 999px;}-.site .meter-fill.is-67js {+.site .size-bar-fill.is-67js {background: linear-gradient(90deg, #ff6a2b, #f59e0b);}-.site .meter-fill.is-other {- background: #ffffff38;-}-.site .agent-advantage-list {- margin: 0;- padding-left: 18px;- display: grid;- gap: 10px;- color: var(--muted);- font-size: 14px;- line-height: 1.5;-}-.site .agent-advantage-list strong { color: var(--text); }-.site .agent-advantage-list code {- padding: 1px 5px;- border-radius: 5px;- background: #ffffff12;- color: var(--text);- font-size: 12px;+.site .size-bar-fill.is-other {+ background: #ffffff36;}@media (max-width: 1120px) {.site .hero .hero-copy { max-width: 32rem; }- .site .hero-workbench { width: min(380px, calc(100% - 32px)); }+ .site .hero-prompt { width: min(340px, calc(100% - 32px)); }}@media (max-width: 960px) {- .site .benchmark-grid { grid-template-columns: 1fr; }- .site .hero-workbench {+ .site .hero-prompt {position: relative;right: auto;bottom: auto;@@ -667,7 +550,6 @@ body.site > main > section { scroll-margin-top: 96px; }max-width: none;}}-@media (max-width: 600px) {- .site .hero-caption-sep, .site .hero-caption [data-agent-metrics] { display: none; }- .site .workbench-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }+@media (max-width: 520px) {+ .site .hero-prompt-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }}