Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

feat(forge/irl): IRL AR page, forge mesh-refine, NVIDIA fallback, and studio improvements

nirholasd146284642c8
diff --git a/.gitignore b/.gitignore
index 3247c0db5..3be34f491 100644
--- a/.gitignore
+++ b/.gitignore
@@ -128,7 +128,6 @@ test-results/
reports/
.auth/
.env*
-docs/internal/COINMARKETCAP_PARTNERSHIP_ARTICLE.md
docs/internal/COINMARKETCAP_ARTICLE.md
docs/internal/PRESS_RELEASE_SHORT.md
scripts/load-test.mjs
@@ -191,7 +190,6 @@ docs/3d-generation-api/texture/texture-model-v3-0-20250812.md
# Snapshot day-exports — recoverable from git history, never commit
snapshots/exported/
-docs/ibm.md
# Vanity keypair files — contain private keys, never commit
.keys/
@@ -218,3 +216,13 @@ scripts/genesis-results.json
docs/three-ws-feature-article.md
animation-sources/
scripts/mixamo-dl/
+demo.html
+demo2.html
+demo1.html
+demo3.html
+demo5.html
+scripts/demo1.mjs
+
+bvefj.txt
+bvefj.csv
+bvefj.json
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9e356caf7..5e405bc8d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
## 2026-06-13
- **AR & WebXR — Place Any 3D Agent in Your Real World** (`/features/ar`) — Every three.ws avatar and Forge model has a View in AR button. On mobile it anchors the model to real surfaces through your camera. WebXR on Android, Quick Look on iOS — no app, no download.
+- **IRL** (`/irl`) — Place a 3D avatar in your real environment. Camera AR passthrough, joystick movement, and tap-to-place 3D objects on your floor.
- **Scene Composer** (`/compose`) — Real-time 3D scene composer: forge items from text, attach them to your avatar's skeleton bones, arrange and scale freely, then export your creation or save it as an outfit.
- **3D model categories — every model is now typed as Avatar, Accessory, Item, Scene, Creature, or Vehicle** — All 3D models on the platform now carry a category that describes what they actually are, not just how they were created. Avatar cards in the marketplace show a color-coded type badge (Avatar, Accessory, Item, Scene, Creature, or Vehicle) and a new filter row lets you browse by type. The Forge gallery shows the same badges on showcase cards, and when you finish forging a model you can tag it right in the result bar with a single click. This is the foundation for the upcoming agent equipment system — where your agents will be able to wear accessories, hold items, and inhabit scenes. (`/marketplace`) `[feature, improvement]`
- **All 14 three.ws MCP servers are now live on npm and the official MCP registry** — Every three.ws MCP server is now publicly installable and discoverable. The eight install-and-run servers ship on npm under the @three-ws scope — pull any of them with one command, e.g. npx -y @three-ws/mcp-server (3D + agent tools), @three-ws/three-token-mcp ($THREE price, hold, and burn), @three-ws/pumpfun-mcp, @three-ws/ibm-x402-mcp, @three-ws/avatar-agent, and more. Together with the six hosted remote servers, all 14 are registered in the official Model Context Protocol registry, so any MCP-compatible client — Claude, Cursor, and others — can find them by name. No more dead install links: the documented commands now work. (`/docs/mcp`) `[sdk, feature]`
@@ -17,10 +18,14 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Embed any Forge model on your own site with one line** — Every model you forge now has an Embed button next to Download. It hands you a ready-to-paste snippet — an iframe by default, or a <model-viewer> web component for builders — that drops a live, orbitable, AR-ready 3D model onto any website, with a live preview and size presets (16:9, square, 4:5) right in the panel. The iframe points at a new lightweight three.ws viewer (/forge/embed) that needs no scripts on the host page, and clicking its corner badge brings visitors back to Forge with your prompt pre-loaded to remix. Same idea as the <agent-3d> embed, now for any generated object. (`/forge`) `[feature]`
- **Embed straight from the homepage demo — no trip to the full Forge** — The text-to-3D demo on the homepage now has an Embed button right in its result toolbar, so a model you forge there can go on your own site without opening the full Forge first. It pops a panel with a live preview, an iframe or <model-viewer> snippet, and the same 16:9 / square / 4:5 size presets, ready to copy in one tap. It's the same one-line embed the full Forge gives you, now one step shorter from the front page. (`/`) `[feature]`
- **Forge adds four more 3D engines — bring your own Rodin, Stability, Tripo, or Replicate key** — Forge now speaks to more best-in-class 3D generators, so you can pick the engine that fits the job. Rodin (Hyper3D) joins for native text-to-geometry and image-to-3D with clean quad topology and a real polygon target; Stable Fast 3D turns a single photo into a textured model in seconds; and you can now run reconstructions on your own Replicate account. Tripo, which was already supported, finally has a key field in your account settings alongside Meshy. All of these are bring-your-own-key — add a key under Account, then Provider Keys, and the engine lights up. The free, no-setup lanes for prompts and sketches are unchanged, and if you choose the geometry path without a key, Forge now quietly falls back to the free engine instead of asking for one. (`/forge`) `[feature]`
+- **Forge free lane never fails: automatic fallback when the free engine is busy** — The free text-to-3D engine runs on a hosted preview that occasionally goes unreachable or returns nothing, which could leave a generation failing with a server error while the paid Fast engine kept working. Forge now detects any free-lane hiccup mid-generation and transparently re-routes the same prompt to the platform's image-intermediate engine, so a free generation always returns a model with zero setup. The result reports the engine that actually produced it, so the swap is never hidden. (`/forge`) `[fix, improvement]`
- **Forge improvements: category tagging, model load errors, and more** — Several Forge improvements ship today: a new Tag As strip appears after generation so you can label your model (Avatar, Creature, Item, Accessory, Scene, Vehicle) — this feeds the explore feed's category filters. An Open in Composer button links directly to /compose with the model pre-loaded. When a stored GLB fails to stream, the viewer now shows a clear error overlay instead of going blank, with a prompt to use the direct download link. The Download button shows a Preparing… state while stamping provenance metadata into the file. A crossorigin attribute was added to the model-viewer element for proper range-request handling on CORS-enabled CDN paths. Three unhandled-promise-rejection sources on the homepage were plugged — async IntersectionObserver callbacks and the AR-section IIFE now guard against abort errors when users navigate away mid-load. Backend health probes retry twice (at 30 s and 60 s) if the first check fails, so a brief cold-start no longer leaves all engine buttons stuck in an unknown state. Empty (0-byte) image uploads are now rejected immediately with a clear message instead of failing silently mid-upload. (`/forge`) `[improvement, fix]`
+- **IRL — walk your avatar in the real world, place 3D objects on your floor** — New page at /irl. Open it and your avatar appears with a joystick. Hit Camera and your phone's rear camera becomes the background — the avatar walks on your real floor. Switch on Add Object, pick a shape (Orb, Crate, Crystal, Ring, or Pillar), and tap anywhere on the floor to drop it into the scene. Objects spawn with a smooth scale animation. Drag to orbit the camera, WASD on desktop. Share your setup with one tap. (`/irl`) `[feature]`
- **Platform scalability improvements across the board** — Five infrastructure changes to keep the platform fast as usage grows: usage telemetry now buffers writes in Redis and batch-inserts into Postgres instead of one DB connection per request, cutting Neon write pressure significantly at scale. A new hourly quota watchdog alerts the ops channel when Upstash Redis approaches 70% of its daily request limit — before the ceiling is hit. QStash's dead-letter queue is now monitored automatically so failed background jobs surface within the hour instead of going silent. The club live-stream switched to a shared per-instance poll loop with adaptive cadence — N open tabs now cost one Neon query per tick instead of N, and the poll slows to 5s during idle periods to preserve quota. Cold-start bundle sizes for monitoring crons and background jobs are now minimal — no more pulling skill files and data archives into endpoints that don't need them. `[infra, improvement]`
- **pump.fun MCP server now listed in the official MCP registry** — Our free, read-only pump.fun and Solana tools are now discoverable in the official Model Context Protocol registry, so any MCP-compatible client (Claude, Cursor, and others) can find and connect to them by name. It's a remote server — no install, no API key for the free tools — covering token discovery, bonding-curve and holder analysis, creator intelligence, and Solana Name Service lookups. This brings the number of three.ws servers in the registry to six. (`/`) `[feature, sdk]`
+- **Record videos from the Animation Studio: send a pose animation straight to Scene Studio** — The keyframe timeline in the Animation Studio (/pose) now has a 'Record in Scene →' button. It bakes your posed animation into the rig and opens it inside Scene Studio (/scene) as a ready-to-play timeline track, already wired to play during rendering. From there, Render ▸ Video captures the motion to an MP4 at the resolution, frame rate, and length you choose — no export, re-import, or scripting in between. Works with the built-in mannequin and any avatar you load. (`/pose`) `[feature]`
- **Refine any Forge model to higher quality in one click — plus sharper multi-view guidance** — Three upgrades to the Forge (/forge). After a model generates, a new Refine button re-runs that exact prompt or photos one quality tier higher — Draft to Standard to High — so you can preview cheaply, then commit to the best version without retyping anything. When building from photos, a live counter now shows how many of the four reference views you've added and reminds you that more angles make a sharper mesh. And the action bar under each finished model now reflows cleanly on phones, with Refine and Make-another leading at full width. Sketch mode also makes its required description unmistakable. (`/forge`) `[improvement]`
+- **Refine any forged model instantly, on-device — no waiting, no limits** — Forge has a new Refine panel that perfects the model you already have, right in your browser — no re-generation and no rate limits. Pick an intent — Clean (weld duplicate vertices and fix faceted shading), Smooth (relax the surface noise generated meshes carry), Game-ready (decimate to a real-time triangle budget while keeping the silhouette and UVs), or Hero (subdivide and smooth for render-quality close-ups). Each runs in milliseconds and shows the exact before/after triangle, vertex, and file-size change, with a one-click revert. Because it never calls the generation service, Refine also works the moment that service is busy: if a generation is throttled, Forge now shows a live countdown and offers to refine your current model locally instead, so you're never stuck at a dead end. (`/forge`) `[feature, improvement]`
- **Reliability pass: steadier live feed, token art that never blanks, and a graceful 3D fallback** — We traced a batch of production errors to their roots and fixed them. The live activity ticker no longer hammers our rate store on every open tab — one shared reader now fans updates out to everyone on a server and quiets down while the feed is idle, which is what was silently exhausting our request quota and freezing the feed. When a remote token image stalls, you now get a clean, on-brand placeholder — a unique gradient gem per token — instead of a timeout or a broken-image tile. On devices that can't run 3D (some locked-down or headless browsers), the viewer now shows a clear 'preview unavailable' card with a reload option instead of a blank stage. Text-to-3D generations that take a little longer to start no longer get cut off early, and a stray click-handling error on the homepage, search, and glossary is gone. `[fix, infra]`
- **Scene Composer — forge items in real time and dress your avatar** — New /compose page lets you build a 3D scene live: load an avatar (or start empty), type a prompt to forge new items, and drop them straight into the scene. Select any object with a click to translate, rotate, or scale it with the gizmo. Items can be attached to specific avatar bones — hat to head, sword to right hand — and the inspector shows live transform values you can also type in. When you're done, export the full scene as a GLB or save an outfit back to your avatar. Your recent forge creations appear in the panel so you can reuse them across sessions without re-generating. (`/compose`) `[feature]`
- **Security and scalability hardening** — Several infrastructure improvements ship today to keep the platform safe and fast at growth scale. All Redis connections across the API now share a single Upstash client instance, eliminating the duplicate quota consumption that caused the June 2026 rate-limit outage. A per-user daily LLM spend cap is now enforced on platform-paid inference keys — callers who exhaust their daily budget receive a clear 429 with a reset time rather than silently running up costs. The SSRF guard gains an IP-pinned fetch variant for proxy and webhook endpoints, closing a DNS-rebinding window where a hostile DNS server could swap an address between the safety check and the actual TCP connection. An admin Redis health panel exposes live quota usage and latency with one click, complementing the existing automated hourly quota watchdog that pages the ops channel at 70% and 90% of the daily limit. `[security, infra, improvement]`
@@ -45,7 +50,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Every three.ws npm package got a polish pass and a new release** — We went through all fifteen published three.ws packages — the avatar SDK and React bindings, the agent UI overlay, the cross-chain and Solana agent SDKs, the agent-payments engine, the avatar schema, viewer presets, the avatar CLI, and the MCP servers — and brought them to one consistent bar. Every package now has complete npm metadata (homepage, repository, issue tracker, license, keywords) and a redesigned README with badges, a copy-paste quick start, a real API/tools reference grounded in the actual code, and cross-links between related packages. Several READMEs that had drifted out of date now list the real, current tool sets. The Solana and agent-payments SDK bundles ship roughly 75% smaller by dropping sourcemaps from the minified release build. The avatar CLI gained colored output, per-command help, 'did you mean' suggestions for typos, and friendlier errors. Packages with missing license or notice files now ship them. `[improvement, sdk, docs]`
- **Forge a 3D model right on the homepage** — The homepage now has a live slice of Forge. Type a description of an object — or tap an example — and the real text-to-3D pipeline reconstructs a textured mesh and drops an interactive 3D model into the page, usually in seconds, that you can orbit and download as GLB. Anything you forge there also shows up in the full Forge gallery on the same device. (`/forge`) `[feature]`
- **Forge engine picker now shows live engine health** — The engine buttons on Forge now reflect what's actually running, probed live against each provider — not just whether it's set up. An engine whose upstream is down or unreachable is disabled with the reason in its tooltip, a throttled one shows an amber busy dot, and bring-your-own-key engines (Meshy, Tripo) say so before you pick them. Behind it is a new public health check at /api/forge?health, and the self-hosted Hunyuan3D lane was rewired to its own worker so it no longer fails every prompt by routing to the avatar pipeline. (`/forge`) `[improvement, fix]`
-- **Forge gets a community showcase — and takes photos from anywhere** — The /forge page now ends with “Fresh from the Forge”: a live strip of the newest models other people generated. Hover a card and the actual model spins in place; open it in the full viewer with download, share, and stylize working; or hit Remix to copy its prompt into the composer and make your own version. Getting photos in is easier too — paste an image from the clipboard (⌘V) anywhere on the page, or drag files onto the page and Forge switches to photo mode and places them for you. (`/forge`) `[feature]`
+- **Forge gets a community showcase — and takes photos from anywhere** — The /forge page now ends with "Fresh from the Forge": a live strip of the newest models other people generated. Hover a card and the actual model spins in place; open it in the full viewer with download, share, and stylize working; or hit Remix to copy its prompt into the composer and make your own version. Getting photos in is easier too — paste an image from the clipboard (⌘V) anywhere on the page, or drag files onto the page and Forge switches to photo mode and places them for you. (`/forge`) `[feature]`
- **Forge helps you write a better prompt before you spend a generation** — The Forge (/forge) text box now coaches you in real time: it flags when a prompt asks for a whole scene (which reconstructs poorly) and nudges you to name a material or finish for a sharper mesh, with a live character counter. A new "Surprise me" button drops in a vivid, ready-to-forge prompt, and "More ideas" reshuffles the example chips — so you always have a strong starting point. The keyboard shortcut to generate (⌘/Ctrl + Enter) is now shown right on the button. (`/forge`) `[feature, improvement]`
- **Forge is now one click away from every feed** — Text-to-3D was easy to miss unless you knew where to look. Now every browsing surface points you at it: the avatar gallery leads with “Create from a prompt”, the marketplace's featured carousel has a “Forge your own from text” link, the agent directory and launches feed both carry Forge shortcuts, and empty feeds suggest forging your first model instead of showing a dead end. The project README also gained a full Forge chapter — REST, MCP, and pay-per-call examples included. (`/forge`) `[improvement]`
- **Forge models now carry straight into Scene Studio** — The "what's next" card after a Forge or Parts Studio result used to send you to the studio empty-handed — the model stayed behind. The primary action is now "Open in Scene Studio" and it brings the exact model you just made with it: Scene Studio opens with the GLB already imported, named after your prompt, ready to compose, edit, and export. Your work carries over instead of starting from a blank scene. (`/forge`) `[improvement, fix]`
diff --git a/api/_lib/forge-tiers.js b/api/_lib/forge-tiers.js
index 3e795fe76..6fc131ac0 100644
--- a/api/_lib/forge-tiers.js
+++ b/api/_lib/forge-tiers.js
@@ -247,8 +247,12 @@ export const BACKENDS = Object.freeze({
}),
});
-// Backend chosen when the caller doesn't name one, per path. Image path keeps
-// the existing TRELLIS fast default; geometry path defaults to Meshy.
+// Standing backend chosen when the caller doesn't name one, per path. The image
+// path keeps the image-capable Replicate TRELLIS default — it accepts user
+// photos and serves every tier. The free NVIDIA NIM lane (text-only) is layered
+// on top of this for prompt-only drafts via FREE_DEFAULT_FOR_DRAFT below, so it
+// must NOT be the standing default: a photo upload or a standard/high request
+// would otherwise route to a backend that can't serve it. Geometry → Meshy.
export const DEFAULT_BACKEND_FOR_PATH = Object.freeze({
image: 'trellis',
geometry: 'meshy',
diff --git a/api/_lib/http.js b/api/_lib/http.js
index 4d636ddec..8423a8489 100644
--- a/api/_lib/http.js
+++ b/api/_lib/http.js
@@ -110,7 +110,17 @@ export function setRateLimitHeaders(res, result) {
export function rateLimited(res, result, message = 'too many requests', extra = {}) {
const retryAfter = Math.max(1, setRateLimitHeaders(res, result));
res.setHeader('retry-after', String(retryAfter));
- return error(res, 429, 'rate_limited', message, { retry_after: retryAfter, ...extra });
+ // Surface the limiter's own `reason` (set by api/_lib/rate-limit.js) so clients
+ // can tell a genuine quota hit from a degraded/unavailable limiter — e.g. a
+ // Redis outage fails critical buckets closed with `rate_limiter_unavailable`,
+ // which a client should present as "temporarily unavailable, retrying" rather
+ // than "you've hit your limit".
+ const reason = result?.reason;
+ return error(res, 429, 'rate_limited', message, {
+ retry_after: retryAfter,
+ ...(reason ? { reason } : {}),
+ ...extra,
+ });
}
// Response shape used for zod validation errors so clients can render
diff --git a/api/forge.js b/api/forge.js
index 76889dc48..955c827ef 100644
--- a/api/forge.js
+++ b/api/forge.js
@@ -499,19 +499,27 @@ async function startJob(req, res) {
// NVCF normally returns a poll handle; on the rare synchronous completion
// the GLB is already in R2.
if (backendId === 'nvidia') {
- let nv;
+ // The free NVIDIA NIM lane is a flaky synchronous upstream — NVCF can be
+ // unreachable, accept the job but drop the request id, or finish with no
+ // artifact (each throws status 502 in api/_providers/nvidia.js), and a
+ // missing module/key throws on load. Per the free-first "AI must never
+ // fail" policy none of these may surface as a dead 502: any failure here
+ // transparently degrades to the platform image-intermediate TRELLIS lane
+ // so the zero-setup free default still returns a model. Only the unit
+ // cost changes, and only when NIM is down. Provenance reports the lane
+ // that actually ran (trellis below), so the downgrade is never silent.
+ let submitted = null;
try {
- nv = await loadNvidiaProvider();
- } catch {
- return json(res, 501, {
- error: 'backend_unconfigured',
- backend: 'nvidia',
- message: 'The free NVIDIA NIM 3D lane is not available on this deployment yet.',
- });
+ const nv = await loadNvidiaProvider();
+ submitted = await nv.textTo3d({ prompt, tier });
+ } catch (err) {
+ console.warn(
+ `[forge] free NVIDIA NIM lane unavailable, falling back to TRELLIS: ${err?.message || err}`,
+ );
+ backendId = 'trellis';
}
- const submitted = await nv.textTo3d({ prompt, tier });
-
+ if (submitted) {
const provenance = {
mode: 'text_to_3d',
path,
@@ -588,6 +596,9 @@ async function startJob(req, res) {
status: 'queued',
...provenance,
});
+ }
+ // nvidia failed → backendId is now 'trellis'; fall through to the
+ // image-intermediate path below, which serves the same free draft prompt.
}
// ── Image-intermediate path (TRELLIS default, or Hunyuan3D self-host) ────
diff --git a/data/changelog.json b/data/changelog.json
index 20878343c..56cb6209c 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,35 @@
{
"$comment": "Curated changelog entries for three.ws — the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.",
"entries": [
+ {
+ "date": "2026-06-13",
+ "title": "Refine any forged model instantly, on-device — no waiting, no limits",
+ "summary": "Forge has a new Refine panel that perfects the model you already have, right in your browser — no re-generation and no rate limits. Pick an intent — Clean (weld duplicate vertices and fix faceted shading), Smooth (relax the surface noise generated meshes carry), Game-ready (decimate to a real-time triangle budget while keeping the silhouette and UVs), or Hero (subdivide and smooth for render-quality close-ups). Each runs in milliseconds and shows the exact before/after triangle, vertex, and file-size change, with a one-click revert. Because it never calls the generation service, Refine also works the moment that service is busy: if a generation is throttled, Forge now shows a live countdown and offers to refine your current model locally instead, so you're never stuck at a dead end.",
+ "tags": [
+ "feature",
+ "improvement"
+ ],
+ "link": "/forge"
+ },
+ {
+ "date": "2026-06-13",
+ "title": "Record videos from the Animation Studio: send a pose animation straight to Scene Studio",
+ "summary": "The keyframe timeline in the Animation Studio (/pose) now has a 'Record in Scene →' button. It bakes your posed animation into the rig and opens it inside Scene Studio (/scene) as a ready-to-play timeline track, already wired to play during rendering. From there, Render ▸ Video captures the motion to an MP4 at the resolution, frame rate, and length you choose — no export, re-import, or scripting in between. Works with the built-in mannequin and any avatar you load.",
+ "tags": [
+ "feature"
+ ],
+ "link": "/pose"
+ },
+ {
+ "date": "2026-06-13",
+ "title": "Forge free lane never fails: automatic fallback when the free engine is busy",
+ "summary": "The free text-to-3D engine runs on a hosted preview that occasionally goes unreachable or returns nothing, which could leave a generation failing with a server error while the paid Fast engine kept working. Forge now detects any free-lane hiccup mid-generation and transparently re-routes the same prompt to the platform's image-intermediate engine, so a free generation always returns a model with zero setup. The result reports the engine that actually produced it, so the swap is never hidden.",
+ "tags": [
+ "fix",
+ "improvement"
+ ],
+ "link": "/forge"
+ },
{
"date": "2026-06-13",
"title": "Animation library expands: 100+ clips, FBX and BVH upload",
@@ -1453,11 +1482,20 @@
{
"date": "2026-06-12",
"title": "Forge gets a community showcase — and takes photos from anywhere",
- "summary": "The /forge page now ends with “Fresh from the Forge”: a live strip of the newest models other people generated. Hover a card and the actual model spins in place; open it in the full viewer with download, share, and stylize working; or hit Remix to copy its prompt into the composer and make your own version. Getting photos in is easier too — paste an image from the clipboard (⌘V) anywhere on the page, or drag files onto the page and Forge switches to photo mode and places them for you.",
+ "summary": "The /forge page now ends with \"Fresh from the Forge\": a live strip of the newest models other people generated. Hover a card and the actual model spins in place; open it in the full viewer with download, share, and stylize working; or hit Remix to copy its prompt into the composer and make your own version. Getting photos in is easier too — paste an image from the clipboard (⌘V) anywhere on the page, or drag files onto the page and Forge switches to photo mode and places them for you.",
"tags": [
"feature"
],
"link": "/forge"
+ },
+ {
+ "date": "2026-06-13",
+ "title": "IRL — walk your avatar in the real world, place 3D objects on your floor",
+ "summary": "New page at /irl. Open it and your avatar appears with a joystick. Hit Camera and your phone's rear camera becomes the background — the avatar walks on your real floor. Switch on Add Object, pick a shape (Orb, Crate, Crystal, Ring, or Pillar), and tap anywhere on the floor to drop it into the scene. Objects spawn with a smooth scale animation. Drag to orbit the camera, WASD on desktop. Share your setup with one tap.",
+ "tags": [
+ "feature"
+ ],
+ "link": "/irl"
}
]
}
diff --git a/data/pages.json b/data/pages.json
index be3d520b6..00787da75 100644
--- a/data/pages.json
+++ b/data/pages.json
@@ -46,6 +46,14 @@
"changefreq": "monthly",
"added": "2026-05-10"
},
+ {
+ "path": "/irl",
+ "title": "IRL",
+ "description": "Place a 3D avatar in your real environment. Camera AR passthrough, joystick movement, and tap-to-place 3D objects on your floor.",
+ "priority": 0.75,
+ "changefreq": "monthly",
+ "added": "2026-06-13"
+ },
{
"path": "/marketplace",
"title": "Marketplace",
diff --git a/pages/forge-v2.html b/pages/forge-v2.html
index 6c9afffcf..799e33b39 100644
--- a/pages/forge-v2.html
+++ b/pages/forge-v2.html
@@ -2316,6 +2316,7 @@
</p>
<div class="actions">
<button class="btn" type="button" id="retry">Try again</button>
+ <button class="btn btn-ghost is-hidden" type="button" id="refine-locally">Refine current model instead</button>
<button class="btn btn-ghost is-hidden" type="button" id="generate-anyway">Generate anyway</button>
</div>
</div>
@@ -2397,6 +2398,7 @@
<script type="module" src="/src/forge.js"></script>
<script type="module" src="/src/forge-prompt-studio.js"></script>
<script type="module" src="/src/forge-enhance.js"></script>
+ <script type="module" src="/src/forge-refine.js"></script>
<script type="module" src="/src/forge-stylize.js"></script>
<script type="module" src="/src/forge-optimize.js"></script>
<script type="module" src="/src/forge-showcase.js"></script>
diff --git a/pages/forge.html b/pages/forge.html
index 49cc5f8c1..da8a70c1d 100644
--- a/pages/forge.html
+++ b/pages/forge.html
@@ -2751,6 +2751,7 @@
</p>
<div class="actions">
<button class="btn" type="button" id="retry">Try again</button>
+ <button class="btn btn-ghost is-hidden" type="button" id="refine-locally">Refine current model instead</button>
<button class="btn btn-ghost is-hidden" type="button" id="generate-anyway">Generate anyway</button>
</div>
</div>
@@ -2829,7 +2830,8 @@
<script type="module" src="/src/forge.js"></script>
<script type="module" src="/src/forge-prompt-studio.js"></script>
<script type="module" src="/src/forge-enhance.js"></script>
- <script type="module" src="/src/forge-stylize.js"></script>
+ <script type="module" src="/src/forge-refine.js"></script>
+ <script type="module" src="/src/forge-stylize.js"></script>
<script type="module" src="/src/forge-optimize.js"></script>
<script type="module" src="/src/forge-export.js"></script>
<script type="module" src="/src/forge-embed-panel.js"></script>
diff --git a/pages/irl.html b/pages/irl.html
new file mode 100644
index 000000000..8c475d732
--- /dev/null
+++ b/pages/irl.html
@@ -0,0 +1,547 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <script>/* three.ws theme boot */(function(){try{var m=localStorage.getItem('twx_theme');var l=m==='auto'?(window.matchMedia&&window.matchMedia('(prefers-color-scheme: light)').matches):m==='light';document.documentElement.setAttribute('data-theme',l?'light':'dark');}catch(e){document.documentElement.setAttribute('data-theme','dark');}})();</script>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
+ <meta name="theme-color" content="#000000" />
+ <title>IRL · three.ws</title>
+ <meta name="description" content="Walk a 3D avatar in your real space. Camera AR passthrough, joystick movement, tap-to-place objects." />
+ <meta property="og:type" content="website" />
+ <meta property="og:site_name" content="three.ws" />
+ <meta property="og:url" content="https://three.ws/irl" />
+ <meta property="og:title" content="IRL · three.ws" />
+ <meta property="og:description" content="Walk a 3D avatar in your real space. Camera AR passthrough, joystick movement, tap-to-place objects." />
+ <meta property="og:image" content="https://three.ws/og-image.png" />
+ <meta name="twitter:card" content="summary_large_image" />
+ <meta name="twitter:title" content="IRL · three.ws" />
+ <meta name="twitter:description" content="Walk a 3D avatar in your real space." />
+ <meta name="twitter:image" content="https://three.ws/og-image.png" />
+ <link rel="icon" href="/favicon.ico" sizes="any" />
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
+ <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
+ <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
+ <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
+ <link rel="manifest" href="/site.webmanifest" />
+ <link rel="stylesheet" href="/fonts/fonts.css" />
+
+ <style>
+ :root {
+ --bg: #000000;
+ --bg2: #0a0a0a;
+ --text: #e8e8e8;
+ --text-2: #888888;
+ --text-3: #444444;
+ --accent: #ffffff;
+ --panel: rgba(255, 255, 255, 0.04);
+ --border: rgba(255, 255, 255, 0.08);
+ --border-hi: rgba(255, 255, 255, 0.22);
+ --danger: #f87171;
+ --green: #4ade80;
+ --radius: 14px;
+ }
+
+ *, *::before, *::after { box-sizing: border-box; }
+
+ html, body {
+ margin: 0;
+ padding: 0;
+ width: 100%;
+ height: 100%;
+ overflow: hidden;
+ background: var(--bg);
+ color: var(--text);
+ font-family: 'Inter', system-ui, -apple-system, sans-serif;
+ -webkit-font-smoothing: antialiased;
+ touch-action: none;
+ overscroll-behavior: none;
+ }
+
+ /* ── Background ambient glow ─────────────────────────────── */
+ .irl-bg {
+ position: fixed;
+ inset: 0;
+ pointer-events: none;
+ z-index: 0;
+ }
+ .irl-bg::before {
+ content: '';
+ position: absolute;
+ inset: 0;
+ background:
+ radial-gradient(ellipse 80% 60% at 50% 0%, rgba(255,255,255,0.04) 0%, transparent 65%),
+ radial-gradient(ellipse 60% 50% at 80% 80%, rgba(255,255,255,0.025) 0%, transparent 60%),
+ radial-gradient(ellipse 50% 40% at 20% 70%, rgba(255,255,255,0.025) 0%, transparent 55%);
+ }
+
+ /* ── Camera feed ─────────────────────────────────────────── */
+ #irl-camera {
+ position: fixed;
+ inset: 0;
+ width: 100vw;
+ height: 100vh;
+ object-fit: cover;
+ z-index: 1;
+ display: none;
+ background: #000;
+ }
+ body.is-ar #irl-camera { display: block; }
+
+ /* ── Three.js canvas ─────────────────────────────────────── */
+ #irl-canvas {
+ position: fixed;
+ inset: 0;
+ width: 100vw;
+ height: 100vh;
+ z-index: 2;
+ display: block;
+ touch-action: none;
+ }
+
+ /* ── Top bar ─────────────────────────────────────────────── */
+ .irl-topbar {
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ z-index: 10;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding-left: 16px;
+ padding-right: 16px;
+ padding-top: calc(env(safe-area-inset-top, 0px) + 14px);
+ padding-bottom: 14px;
+ background: linear-gradient(to bottom, rgba(0,0,0,0.85) 0%, transparent 100%);
+ }
+
+ .irl-back {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ color: var(--text-2);
+ text-decoration: none;
+ font-size: 14px;
+ font-weight: 500;
+ transition: color 0.15s;
+ padding: 6px 0;
+ }
+ .irl-back:hover { color: var(--text); }
+ .irl-back svg { flex-shrink: 0; }
+
+ .irl-topbar-center {
+ position: absolute;
+ left: 50%;
+ transform: translateX(-50%);
+ text-align: center;
+ pointer-events: none;
+ }
+ .irl-badge {
+ display: inline-flex;
+ align-items: center;
+ gap: 5px;
+ font-size: 11px;
+ font-weight: 600;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ color: var(--accent);
+ background: rgba(255,255,255,0.08);
+ border: 1px solid rgba(255,255,255,0.2);
+ border-radius: 999px;
+ padding: 4px 10px;
+ transition: border-color 0.3s;
+ }
+ body.is-ar .irl-badge { border-color: rgba(74,222,128,0.5); }
+ .irl-badge-dot {
+ width: 5px;
+ height: 5px;
+ border-radius: 50%;
+ background: var(--text-2);
+ transition: background 0.3s, box-shadow 0.3s;
+ }
+ body.is-ar .irl-badge-dot {
+ background: var(--green);
+ box-shadow: 0 0 6px var(--green);
+ animation: irl-pulse 2s ease-in-out infinite;
+ }
+ @keyframes irl-pulse {
+ 0%, 100% { opacity: 1; transform: scale(1); }
+ 50% { opacity: 0.5; transform: scale(0.7); }
+ }
+
+ .irl-share-btn {
+ background: transparent;
+ border: 1px solid var(--border);
+ border-radius: 999px;
+ color: var(--text-2);
+ font-size: 13px;
+ font-weight: 500;
+ font-family: inherit;
+ cursor: pointer;
+ padding: 6px 14px;
+ transition: border-color 0.15s, color 0.15s;
+ }
+ .irl-share-btn:hover { border-color: var(--text-3); color: var(--text); }
+
+ /* ── Joystick ────────────────────────────────────────────── */
+ #irl-joystick {
+ position: fixed;
+ z-index: 9;
+ left: 0;
+ bottom: 0;
+ width: min(50vw, 220px);
+ height: min(55vh, 360px);
+ touch-action: none;
+ pointer-events: auto;
+ }
+ @media (hover: hover) and (pointer: fine) {
+ #irl-joystick {
+ left: 24px;
+ bottom: calc(200px + env(safe-area-inset-bottom, 0));
+ width: 140px;
+ height: 140px;
+ }
+ }
+
+ /* ── Bottom panel ────────────────────────────────────────── */
+ .irl-bottom {
+ position: fixed;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ z-index: 10;
+ padding: 0 20px;
+ padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 28px);
+ background: linear-gradient(
+ to top,
+ rgba(0,0,0,0.95) 0%,
+ rgba(0,0,0,0.75) 55%,
+ transparent 100%
+ );
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 10px;
+ pointer-events: none;
+ }
+ .irl-bottom > * { pointer-events: auto; }
+
+ .irl-avatar-name {
+ font-size: 22px;
+ font-weight: 700;
+ letter-spacing: -0.02em;
+ color: var(--text);
+ text-align: center;
+ margin: 0;
+ line-height: 1.2;
+ font-family: 'Space Grotesk', system-ui, sans-serif;
+ }
+
+ .irl-subtitle {
+ font-size: 13px;
+ color: var(--text-2);
+ text-align: center;
+ margin: 0;
+ transition: opacity 0.3s;
+ }
+
+ .irl-status {
+ font-size: 12.5px;
+ color: var(--accent);
+ text-align: center;
+ height: 18px;
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ opacity: 1;
+ transition: opacity 0.3s;
+ }
+ .irl-status.is-hidden { opacity: 0; }
+ .irl-status.is-error { color: var(--danger); }
+ .irl-status-spinner {
+ width: 13px;
+ height: 13px;
+ border-radius: 50%;
+ border: 2px solid rgba(255,255,255,0.2);
+ border-top-color: var(--accent);
+ animation: irl-spin 0.7s linear infinite;
+ flex-shrink: 0;
+ }
+ .irl-status-spinner.hidden { display: none; }
+ @keyframes irl-spin { to { transform: rotate(360deg); } }
+
+ /* Hero camera button */
+ #irl-camera-btn {
+ width: 100%;
+ max-width: 380px;
+ height: 60px;
+ background: #ffffff;
+ color: #000000;
+ border: 0;
+ border-radius: 18px;
+ font-family: 'Space Grotesk', system-ui, sans-serif;
+ font-size: 17px;
+ font-weight: 700;
+ letter-spacing: -0.01em;
+ cursor: pointer;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 10px;
+ transition: transform 0.12s, box-shadow 0.2s, opacity 0.15s, background 0.25s, color 0.25s;
+ box-shadow: 0 8px 32px -8px rgba(255,255,255,0.2), 0 0 0 1px rgba(255,255,255,0.08) inset;
+ position: relative;
+ overflow: hidden;
+ }
+ #irl-camera-btn::after {
+ content: '';
+ position: absolute;
+ inset: 0;
+ background: linear-gradient(to bottom, rgba(255,255,255,0.12) 0%, transparent 50%);
+ pointer-events: none;
+ }
+ #irl-camera-btn:hover:not(:disabled) {
+ transform: translateY(-2px);
+ box-shadow: 0 14px 40px -8px rgba(255,255,255,0.25), 0 0 0 1px rgba(255,255,255,0.1) inset;
+ }
+ #irl-camera-btn:active:not(:disabled) { transform: translateY(0); }
+ #irl-camera-btn:disabled { opacity: 0.4; cursor: not-allowed; }
+ #irl-camera-btn.is-active {
+ background: rgba(74,222,128,0.15);
+ color: var(--green);
+ border: 1px solid rgba(74,222,128,0.45);
+ box-shadow: 0 0 24px -8px rgba(74,222,128,0.3);
+ }
+ #irl-camera-btn svg { flex-shrink: 0; }
+
+ /* Secondary row: place + clear */
+ .irl-secondary-row {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ justify-content: center;
+ }
+
+ .irl-pill-btn {
+ appearance: none;
+ border: 1px solid var(--border);
+ background: rgba(255,255,255,0.05);
+ color: var(--text-2);
+ font: inherit;
+ font-size: 13px;
+ font-weight: 600;
+ padding: 9px 18px;
+ border-radius: 999px;
+ cursor: pointer;
+ display: inline-flex;
+ align-items: center;
+ gap: 7px;
+ transition: transform 0.1s, background 0.15s, border-color 0.15s, color 0.15s;
+ -webkit-tap-highlight-color: transparent;
+ white-space: nowrap;
+ backdrop-filter: blur(8px);
+ -webkit-backdrop-filter: blur(8px);
+ }
+ .irl-pill-btn:hover { color: var(--text); border-color: var(--border-hi); background: rgba(255,255,255,0.08); }
+ .irl-pill-btn:active { transform: scale(0.95); }
+ .irl-pill-btn.is-active {
+ color: var(--text);
+ border-color: rgba(255,255,255,0.35);
+ background: rgba(255,255,255,0.1);
+ }
+ .irl-pill-btn:disabled { opacity: 0.35; cursor: not-allowed; }
+ #irl-clear-btn { color: var(--danger); border-color: rgba(248,113,113,0.3); background: rgba(248,113,113,0.06); }
+ #irl-clear-btn:hover { background: rgba(248,113,113,0.12); border-color: rgba(248,113,113,0.5); }
+
+ /* Object picker — slides up above the secondary row */
+ #irl-picker {
+ display: flex;
+ flex-direction: row;
+ gap: 8px;
+ justify-content: center;
+ flex-wrap: wrap;
+ max-width: 380px;
+ animation: irl-slide-up 0.2s ease-out;
+ }
+ #irl-picker[hidden] { display: none; }
+ @keyframes irl-slide-up {
+ from { opacity: 0; transform: translateY(10px); }
+ to { opacity: 1; transform: translateY(0); }
+ }
+ .irl-obj-btn {
+ appearance: none;
+ border: 1px solid var(--border);
+ background: rgba(255,255,255,0.05);
+ color: var(--text-2);
+ font: inherit;
+ font-size: 12px;
+ font-weight: 600;
+ padding: 7px 14px;
+ border-radius: 999px;
+ cursor: pointer;
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ transition: transform 0.1s, background 0.15s, border-color 0.15s, color 0.15s;
+ -webkit-tap-highlight-color: transparent;
+ backdrop-filter: blur(8px);
+ -webkit-backdrop-filter: blur(8px);
+ }
+ .irl-obj-btn:hover { color: var(--text); border-color: var(--border-hi); }
+ .irl-obj-btn:active { transform: scale(0.95); }
+ .irl-obj-btn.active {
+ color: var(--text);
+ border-color: rgba(255,255,255,0.4);
+ background: rgba(255,255,255,0.12);
+ }
+ .irl-obj-swatch {
+ width: 12px;
+ height: 12px;
+ border-radius: 50%;
+ flex-shrink: 0;
+ }
+
+ /* Desktop keyboard hints */
+ #irl-keys {
+ position: fixed;
+ z-index: 5;
+ right: 16px;
+ top: 50%;
+ transform: translateY(-50%);
+ display: flex;
+ flex-direction: column;
+ gap: 6px;
+ align-items: flex-end;
+ color: var(--text-2);
+ font-size: 11px;
+ pointer-events: none;
+ }
+ @media (hover: none), (max-width: 640px) { #irl-keys { display: none; } }
+ .irl-key {
+ display: inline-flex;
+ align-items: center;
+ gap: 4px;
+ background: rgba(0,0,0,0.6);
+ border: 1px solid var(--border);
+ border-radius: 8px;
+ padding: 4px 8px;
+ backdrop-filter: blur(10px);
+ -webkit-backdrop-filter: blur(10px);
+ }
+ .irl-key kbd {
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
+ font-size: 10px;
+ padding: 1px 5px;
+ border-radius: 4px;
+ background: rgba(255,255,255,0.08);
+ border: 1px solid var(--border);
+ color: var(--text);
+ }
+ </style>
+</head>
+<body>
+
+<!-- Ambient background glow (behind everything) -->
+<div class="irl-bg" aria-hidden="true"></div>
+
+<!-- Camera passthrough (shown only in AR mode) -->
+<video id="irl-camera" autoplay muted playsinline></video>
+
+<!-- Three.js canvas -->
+<canvas id="irl-canvas"></canvas>
+
+<!-- Top bar -->
+<header class="irl-topbar">
+ <a class="irl-back" id="irl-back-link" href="/walk">
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="15 18 9 12 15 6"/></svg>
+ Back
+ </a>
+ <div class="irl-topbar-center">
+ <span class="irl-badge">
+ <span class="irl-badge-dot"></span>
+ IRL
+ </span>
+ </div>
+ <button class="irl-share-btn" id="irl-share-btn" type="button" aria-label="Share">Share</button>
+</header>
+
+<!-- Joystick zone -->
+<div id="irl-joystick"></div>
+
+<!-- Desktop keyboard hints -->
+<div id="irl-keys">
+ <span class="irl-key"><kbd>W</kbd><kbd>A</kbd><kbd>S</kbd><kbd>D</kbd> move</span>
+ <span class="irl-key"><kbd>Shift</kbd> run</span>
+ <span class="irl-key">drag to orbit</span>
+</div>
+
+<!-- Bottom panel -->
+<footer class="irl-bottom">
+ <h1 class="irl-avatar-name" id="irl-avatar-name">Loading…</h1>
+ <p class="irl-subtitle" id="irl-subtitle">Turn on camera to place in your space</p>
+
+ <p class="irl-status is-hidden" id="irl-status">
+ <span class="irl-status-spinner hidden" id="irl-spinner" aria-hidden="true"></span>
+ <span id="irl-status-text"></span>
+ </p>
+
+ <button id="irl-camera-btn" type="button" disabled aria-busy="true">
+ <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M23 7 16 12l7 5V7z"/><rect x="1" y="5" width="15" height="14" rx="2" ry="2"/></svg>
+ <span id="irl-camera-label">Camera AR</span>
+ </button>
+
+ <div class="irl-secondary-row">
+ <button class="irl-pill-btn" id="irl-place-btn" type="button" aria-pressed="false">
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>
+ Add object
+ </button>
+ <button class="irl-pill-btn" id="irl-clear-btn" type="button" hidden>
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6l-1 14H6L5 6"/><path d="M10 11v6M14 11v6"/></svg>
+ Clear
+ </button>
+ </div>
+
+ <!-- Object picker (revealed when Add Object is active) -->
+ <div id="irl-picker" hidden>
+ <button class="irl-obj-btn" data-type="orb">
+ <span class="irl-obj-swatch" style="background:rgba(136,187,255,0.9);box-shadow:0 0 6px rgba(136,187,255,0.6)"></span>
+ Orb
+ </button>
+ <button class="irl-obj-btn" data-type="crate">
+ <span class="irl-obj-swatch" style="background:#b07830;border-radius:2px"></span>
+ Crate
+ </button>
+ <button class="irl-obj-btn" data-type="crystal">
+ <span class="irl-obj-swatch" style="background:rgba(204,119,255,0.9);clip-path:polygon(50% 0%,100% 50%,50% 100%,0% 50%);border-radius:0"></span>
+ Crystal
+ </button>
+ <button class="irl-obj-btn" data-type="ring">
+ <span class="irl-obj-swatch" style="background:transparent;border:2px solid #ffd700;box-shadow:0 0 5px rgba(255,215,0,0.5)"></span>
+ Ring
+ </button>
+ <button class="irl-obj-btn" data-type="pillar">
+ <span class="irl-obj-swatch" style="background:#c8c0b8;border-radius:3px;width:7px;height:12px;margin:0 3px"></span>
+ Pillar
+ </button>
+ </div>
+</footer>
+
+<script type="module" src="/src/irl.js"></script>
+
+<script>
+document.getElementById('irl-share-btn').addEventListener('click', async () => {
+ const url = location.href;
+ if (navigator.share) {
+ try { await navigator.share({ title: 'IRL · three.ws', url }); return; } catch {}
+ }
+ try {
+ await navigator.clipboard.writeText(url);
+ const btn = document.getElementById('irl-share-btn');
+ const orig = btn.textContent;
+ btn.textContent = 'Copied!';
+ setTimeout(() => { btn.textContent = orig; }, 1800);
+ } catch {}
+});
+</script>
+</body>
+</html>
diff --git a/pages/pose.html b/pages/pose.html
index 4129bd8f8..bd9136ebf 100644
--- a/pages/pose.html
+++ b/pages/pose.html
@@ -1976,6 +1976,14 @@
>
Export GLB
</button>
+ <button
+ type="button"
+ id="tl-open-scene"
+ class="pose-btn pose-btn-primary tl-export"
+ title="Send this animation to Scene Studio to record a video"
+ >
+ Record in Scene →
+ </button>
</div>
<div
diff --git a/public/agents/index.html b/public/agents/index.html
index bab7a1a2e..0af383305 100644
--- a/public/agents/index.html
+++ b/public/agents/index.html
@@ -2,237 +2,325 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <title>Agents Directory — three.ws</title>
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
+ <title>Agent Directory · three.ws</title>
+ <meta name="description" content="Browse every registered agent on three.ws — filter by chain, search by name, and view on-chain passports." />
+ <meta name="theme-color" content="#000000" />
+ <link rel="canonical" href="https://three.ws/agents" />
+ <meta property="og:type" content="website" />
+ <meta property="og:site_name" content="three.ws" />
+ <meta property="og:title" content="Agent Directory · three.ws" />
+ <meta property="og:description" content="Browse every registered agent on three.ws." />
+ <meta property="og:url" content="https://three.ws/agents" />
+ <meta property="og:image" content="https://three.ws/og-image.png" />
+ <meta property="og:image:width" content="1200" />
+ <meta property="og:image:height" content="630" />
+ <meta name="twitter:card" content="summary_large_image" />
+ <meta name="twitter:title" content="Agent Directory · three.ws" />
+ <meta name="twitter:description" content="Browse every registered agent on three.ws." />
+ <meta name="twitter:image" content="https://three.ws/og-image.png" />
+ <script type="application/ld+json">{"@context":"https://schema.org","@type":"WebPage","name":"Agent Directory","description":"Browse every registered agent on three.ws.","url":"https://three.ws/agents","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"}}</script>
+ <link rel="shortcut icon" href="/favicon.ico" />
+ <link rel="stylesheet" href="/style.css" />
+ <link rel="stylesheet" href="/nav.css" />
+ <link rel="stylesheet" href="/fonts/fonts.css" />
<style>
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- }
-
- html,
- body {
- font-family:
- -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
- 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
- background: linear-gradient(135deg, #101010 0%, #141414 100%);
- color: #e0e0e0;
- min-height: 100vh;
- overflow-x: hidden;
- }
-
- header {
- background: rgba(15, 15, 35, 0.95);
- border-bottom: 1px solid rgba(255, 255, 255, 0.1);
- padding: 2rem 1rem;
+ /* ── Page-scoped styles ── */
+ .agents-hero {
text-align: center;
+ padding: 4rem 1rem 2.5rem;
}
- header h1 {
- font-size: 2.5rem;
- margin-bottom: 0.5rem;
- background: linear-gradient(135deg, #00d9ff, #ffffff);
+ .agents-eyebrow {
+ font-size: 0.78rem;
+ font-weight: 600;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ color: var(--ink-dim, #888);
+ margin-bottom: 0.75rem;
+ }
+
+ .agents-hero h1 {
+ font-size: clamp(2rem, 5vw, 3rem);
+ font-weight: 700;
+ line-height: 1.1;
+ margin-bottom: 0.75rem;
+ background: linear-gradient(135deg, #00d9ff 0%, #ffffff 60%);
background-clip: text;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
- header p {
+ .agents-hero p {
font-size: 1rem;
- color: #a0a0a0;
+ color: var(--ink-dim, #a0a0a0);
+ max-width: 520px;
+ margin: 0 auto;
}
- .container {
+ /* Controls bar */
+ .agents-controls {
max-width: 1400px;
- margin: 2rem auto;
- padding: 0 1rem;
- }
-
- .controls {
+ margin: 0 auto 2rem;
+ padding: 0 1.5rem;
display: flex;
flex-wrap: wrap;
gap: 1rem;
- margin-bottom: 2rem;
align-items: center;
}
- .search-box {
+ .agents-search {
+ position: relative;
flex: 1;
- min-width: 250px;
- padding: 0.75rem 1rem;
+ min-width: 220px;
+ }
+
+ .agents-search input {
+ width: 100%;
+ padding: 0.65rem 1rem;
background: rgba(255, 255, 255, 0.05);
- border: 1px solid rgba(255, 255, 255, 0.1);
+ border: 1px solid rgba(255, 255, 255, 0.12);
border-radius: 8px;
- color: #e0e0e0;
- font-size: 1rem;
+ color: var(--ink, #e0e0e0);
+ font-size: 0.95rem;
+ font-family: inherit;
+ transition: border-color 0.18s ease, background 0.18s ease;
}
- .search-box::placeholder {
- color: #666;
- }
+ .agents-search input::placeholder { color: #555; }
- .search-box:focus {
+ .agents-search input:focus {
outline: none;
border-color: #00d9ff;
- background: rgba(0, 217, 255, 0.05);
+ background: rgba(0, 217, 255, 0.04);
}
- .filter-group {
+ .agents-filter-group {
display: flex;
+ align-items: center;
gap: 0.5rem;
flex-wrap: wrap;
}
- .filter-label {
- font-size: 0.85rem;
+ .agents-filter-label {
+ font-size: 0.8rem;
font-weight: 600;
text-transform: uppercase;
- color: #999;
- align-self: center;
+ letter-spacing: 0.06em;
+ color: var(--ink-dim, #888);
}
.filter-chip {
- padding: 0.5rem 1rem;
+ padding: 0.4rem 0.9rem;
background: rgba(255, 255, 255, 0.05);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 20px;
cursor: pointer;
- font-size: 0.9rem;
- color: #a0a0a0;
- transition: all 0.2s ease;
+ font-size: 0.85rem;
+ font-family: inherit;
+ color: var(--ink-dim, #a0a0a0);
+ transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
- .filter-chip:hover {
- background: rgba(255, 255, 255, 0.1);
- }
+ .filter-chip:hover { background: rgba(255, 255, 255, 0.1); }
.filter-chip.active {
- background: linear-gradient(135deg, #00d9ff, #ffffff);
+ background: #00d9ff;
border-color: transparent;
- color: #fff;
+ color: #000;
font-weight: 600;
}
- .sort-select {
- padding: 0.5rem 1rem;
+ .agents-sort {
+ padding: 0.45rem 0.9rem;
background: rgba(255, 255, 255, 0.05);
- border: 1px solid rgba(255, 255, 255, 0.1);
+ border: 1px solid rgba(255, 255, 255, 0.12);
border-radius: 8px;
- color: #e0e0e0;
+ color: var(--ink, #e0e0e0);
cursor: pointer;
- font-size: 0.9rem;
+ font-size: 0.85rem;
+ font-family: inherit;
}
- .sort-select:focus {
- outline: none;
- border-color: #00d9ff;
- }
+ .agents-sort:focus { outline: none; border-color: #00d9ff; }
+ .agents-sort option { background: #111; color: #e0e0e0; }
- .sort-select option {
- background: #101010;
- color: #e0e0e0;
+ /* Grid */
+ .agents-wrap {
+ max-width: 1400px;
+ margin: 0 auto;
+ padding: 0 1.5rem 4rem;
}
.agent-grid {
display: grid;
- grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
+ grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
gap: 1.5rem;
margin-bottom: 2rem;
}
+ /* Cards rendered by AgentsDirectory.js */
.agent-card {
background: rgba(255, 255, 255, 0.03);
- border: 1px solid rgba(255, 255, 255, 0.1);
+ border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 12px;
overflow: hidden;
cursor: pointer;
- transition: all 0.3s ease;
+ transition: border-color 0.22s ease, background 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
display: flex;
flex-direction: column;
+ padding: 1.1rem 1.25rem 1.25rem;
+ gap: 0.65rem;
}
.agent-card:hover {
- border-color: rgba(0, 217, 255, 0.5);
- background: rgba(0, 217, 255, 0.05);
- transform: translateY(-4px);
- box-shadow: 0 8px 24px rgba(0, 217, 255, 0.15);
+ border-color: rgba(0, 217, 255, 0.45);
+ background: rgba(0, 217, 255, 0.04);
+ transform: translateY(-3px);
+ box-shadow: 0 8px 28px rgba(0, 217, 255, 0.12);
}
- .card-avatar {
- width: 100%;
- aspect-ratio: 1;
- background: rgba(255, 255, 255, 0.02);
+ /* card-head: small avatar + title side by side */
+ .card-head {
+ display: flex;
+ align-items: center;
+ gap: 0.85rem;
+ }
+
+ .card-avatar-sm {
+ width: 52px;
+ height: 52px;
+ flex-shrink: 0;
+ border-radius: 8px;
+ background: rgba(255, 255, 255, 0.04);
+ border: 1px solid rgba(255, 255, 255, 0.08);
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
+ color: #555;
+ font-size: 1.4rem;
}
- .card-avatar img {
+ .card-avatar-sm img {
width: 100%;
height: 100%;
object-fit: cover;
}
- .avatar-placeholder {
- font-size: 3rem;
- opacity: 0.3;
- }
+ .avatar-placeholder { opacity: 0.4; }
- .card-content {
- padding: 1.25rem;
- flex: 1;
+ .card-title { flex: 1; min-width: 0; }
+
+ .card-name-row {
display: flex;
- flex-direction: column;
+ align-items: center;
+ gap: 0.4rem;
+ margin-bottom: 0.2rem;
}
.card-name {
- font-size: 1.1rem;
+ font-size: 0.95rem;
font-weight: 600;
- margin-bottom: 0.5rem;
- color: #fff;
+ color: var(--ink, #fff);
line-height: 1.3;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+
+ .active-dot {
+ width: 7px;
+ height: 7px;
+ border-radius: 50%;
+ background: #22c55e;
+ flex-shrink: 0;
+ }
+
+ .card-id {
+ font-size: 0.75rem;
+ color: var(--ink-dim, #888);
+ font-family: 'Monaco', 'Courier New', monospace;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
}
.card-desc {
- font-size: 0.85rem;
- color: #a0a0a0;
- margin-bottom: 1rem;
- line-height: 1.4;
- flex: 1;
+ font-size: 0.82rem;
+ color: var(--ink-dim, #a0a0a0);
+ line-height: 1.45;
}
- .card-meta {
+ .card-protos, .card-trust, .card-onchain, .card-owner {
display: flex;
- gap: 0.5rem;
flex-wrap: wrap;
- font-size: 0.75rem;
+ gap: 0.35rem;
+ font-size: 0.72rem;
+ }
+
+ .proto-badge {
+ padding: 0.2rem 0.45rem;
+ background: rgba(255, 255, 255, 0.06);
+ border: 1px solid rgba(255, 255, 255, 0.12);
+ border-radius: 4px;
+ color: var(--ink-dim, #aaa);
+ font-weight: 500;
}
+ .trust-pill {
+ padding: 0.2rem 0.45rem;
+ background: rgba(34, 197, 94, 0.1);
+ border: 1px solid rgba(34, 197, 94, 0.25);
+ border-radius: 4px;
+ color: #86efac;
+ font-weight: 500;
+ }
+
+ .owner-addr {
+ font-family: 'Monaco', 'Courier New', monospace;
+ color: var(--ink-dim, #888);
+ cursor: pointer;
+ }
+
+ .owner-copy {
+ background: none;
+ border: none;
+ color: var(--ink-dim, #888);
+ cursor: pointer;
+ font-size: 0.9em;
+ padding: 0 0.2rem;
+ }
+
+ .owner-copy.copied { color: #22c55e; }
+
.card-actions {
- margin-top: 0.75rem;
display: flex;
+ gap: 0.5rem;
+ flex-wrap: wrap;
+ margin-top: auto;
+ padding-top: 0.2rem;
}
.card-see3d {
display: inline-flex;
align-items: center;
- gap: 0.4rem;
- padding: 0.4rem 0.7rem;
- font-size: 0.78rem;
+ gap: 0.35rem;
+ padding: 0.35rem 0.65rem;
+ font-size: 0.76rem;
font-weight: 600;
color: #00d9ff;
background: rgba(0, 217, 255, 0.08);
- border: 1px solid rgba(0, 217, 255, 0.3);
+ border: 1px solid rgba(0, 217, 255, 0.28);
border-radius: 6px;
text-decoration: none;
transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.card-see3d:hover {
- background: rgba(0, 217, 255, 0.16);
- border-color: rgba(0, 217, 255, 0.6);
+ background: rgba(0, 217, 255, 0.15);
+ border-color: rgba(0, 217, 255, 0.55);
transform: translateY(-1px);
}
@@ -241,236 +329,196 @@
outline-offset: 2px;
}
- .card-see3d svg {
- opacity: 0.9;
+ /* States */
+ .agents-loading {
+ text-align: center;
+ padding: 3rem 2rem;
+ color: var(--ink-dim, #a0a0a0);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 0.75rem;
}
- .chain-badge {
- background: rgba(255, 255, 255, 0.08);
- border: 1px solid rgba(255, 255, 255, 0.2);
- padding: 0.3rem 0.6rem;
- border-radius: 4px;
- color: var(--ink-dim, #888888);
+ .agents-loading::after {
+ content: '';
+ display: inline-block;
+ width: 1rem;
+ height: 1rem;
+ border: 2px solid rgba(0, 217, 255, 0.3);
+ border-top-color: #00d9ff;
+ border-radius: 50%;
+ animation: spin 0.8s linear infinite;
}
- .agent-id {
- background: rgba(0, 217, 255, 0.1);
- border: 1px solid rgba(0, 217, 255, 0.3);
- padding: 0.3rem 0.6rem;
- border-radius: 4px;
- color: #00d9ff;
- font-family: 'Monaco', 'Courier New', monospace;
- }
+ @keyframes spin { to { transform: rotate(360deg); } }
- .empty-state {
+ .agents-empty {
text-align: center;
- padding: 4rem 2rem;
+ padding: 5rem 2rem;
}
- .empty-state h2 {
- font-size: 1.5rem;
- margin-bottom: 1rem;
- color: #fff;
+ .agents-empty h2 {
+ font-size: 1.4rem;
+ font-weight: 600;
+ color: var(--ink, #fff);
+ margin-bottom: 0.75rem;
}
- .empty-state p {
- font-size: 1rem;
- color: #a0a0a0;
+ .agents-empty p {
+ font-size: 0.95rem;
+ color: var(--ink-dim, #a0a0a0);
margin-bottom: 2rem;
+ max-width: 460px;
+ margin-inline: auto;
}
- .cta-button {
- padding: 0.75rem 1.5rem;
- background: linear-gradient(135deg, #00d9ff, #ffffff);
+ .agents-empty-actions {
+ display: flex;
+ gap: 0.75rem;
+ justify-content: center;
+ flex-wrap: wrap;
+ }
+
+ .btn-primary {
+ padding: 0.65rem 1.4rem;
+ background: #00d9ff;
border: none;
border-radius: 8px;
- color: #fff;
+ color: #000;
font-weight: 600;
+ font-size: 0.9rem;
cursor: pointer;
- transition: all 0.2s ease;
text-decoration: none;
display: inline-block;
+ transition: opacity 0.18s ease, transform 0.18s ease;
}
- .cta-button:hover {
- transform: scale(1.05);
- box-shadow: 0 8px 24px rgba(0, 217, 255, 0.3);
- }
+ .btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }
- .cta-button--ghost {
+ .btn-ghost {
+ padding: 0.65rem 1.4rem;
background: transparent;
- border: 1px solid rgba(255, 255, 255, 0.25);
- margin-left: 0.75rem;
+ border: 1px solid rgba(255, 255, 255, 0.22);
+ border-radius: 8px;
+ color: var(--ink, #e0e0e0);
+ font-weight: 500;
+ font-size: 0.9rem;
+ cursor: pointer;
+ text-decoration: none;
+ display: inline-block;
+ transition: border-color 0.18s ease, background 0.18s ease;
}
- .cta-button--ghost:hover {
- box-shadow: 0 8px 24px rgba(255, 255, 255, 0.12);
- border-color: rgba(255, 255, 255, 0.45);
+ .btn-ghost:hover {
+ border-color: rgba(255, 255, 255, 0.4);
+ background: rgba(255, 255, 255, 0.05);
}
- .pagination {
+ /* Pagination */
+ .agents-pagination {
display: flex;
justify-content: center;
align-items: center;
gap: 1rem;
- margin-top: 2rem;
- padding: 2rem;
+ padding: 2rem 0;
flex-wrap: wrap;
}
- .pagination-button {
+ .pag-btn {
padding: 0.5rem 1rem;
background: rgba(255, 255, 255, 0.05);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 8px;
- color: #e0e0e0;
+ color: var(--ink, #e0e0e0);
cursor: pointer;
- transition: all 0.2s ease;
+ font-size: 0.88rem;
+ font-family: inherit;
+ transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
- .pagination-button:hover:not(:disabled) {
+ .pag-btn:hover:not(:disabled) {
background: rgba(0, 217, 255, 0.1);
border-color: #00d9ff;
color: #00d9ff;
}
- .pagination-button:disabled {
- opacity: 0.3;
- cursor: not-allowed;
- }
-
- .pagination-info {
- color: #a0a0a0;
- font-size: 0.9rem;
- }
-
- .loading {
- text-align: center;
- padding: 2rem;
- color: #a0a0a0;
- }
-
- .loading::after {
- content: '';
- display: inline-block;
- margin-left: 0.5rem;
- width: 1rem;
- height: 1rem;
- border: 2px solid rgba(0, 217, 255, 0.3);
- border-top-color: #00d9ff;
- border-radius: 50%;
- animation: spin 0.8s linear infinite;
- }
-
- @keyframes spin {
- to {
- transform: rotate(360deg);
- }
- }
+ .pag-btn:disabled { opacity: 0.3; cursor: not-allowed; }
- .header-logo {
- width: 20px;
- height: 20px;
- vertical-align: middle;
- margin-right: 6px;
+ .pag-info {
+ font-size: 0.88rem;
+ color: var(--ink-dim, #a0a0a0);
}
- @media (max-width: 768px) {
- header h1 {
- font-size: 1.75rem;
- }
-
- .controls {
- flex-direction: column;
- }
-
- .search-box {
- min-width: 100%;
- }
-
- .agent-grid {
- grid-template-columns: 1fr;
- }
-
- .sort-select,
- .search-box input {
- font-size: max(16px, 1em);
- }
+ @media (max-width: 640px) {
+ .agents-controls { flex-direction: column; align-items: stretch; }
+ .agents-search { min-width: 100%; }
+ .agents-search input { font-size: max(16px, 1em); }
+ .agent-grid { grid-template-columns: 1fr; }
}
</style>
-
- <meta name="description" content="Browse every registered agent on three.ws.">
- <link rel="canonical" href="https://three.ws/agents">
- <meta property="og:type" content="website">
- <meta property="og:site_name" content="three.ws">
- <meta property="og:title" content="Agents Index · three.ws">
- <meta property="og:description" content="Browse every registered agent on three.ws.">
- <meta property="og:url" content="https://three.ws/agents">
- <meta property="og:image" content="https://three.ws/og-image.png">
- <meta property="og:image:width" content="1200">
- <meta property="og:image:height" content="630">
- <meta name="twitter:card" content="summary_large_image">
- <meta name="twitter:title" content="Agents Index · three.ws">
- <meta name="twitter:description" content="Browse every registered agent on three.ws.">
- <meta name="twitter:image" content="https://three.ws/og-image.png">
- <script type="application/ld+json">{"@context":"https://schema.org","@type":"WebPage","name":"Agents Index","description":"Browse every registered agent on three.ws.","url":"https://three.ws/agents","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"}}</script>
-</head>
+ </head>
<body>
<header>
<div id="nav-container"></div>
</header>
<script src="/nav.js"></script>
- <header class="page-header">
- <a href="/" class="brand"><img src="/three.svg" alt="" class="header-logo" aria-hidden="true" />three.ws</a>
- <h1>Agent Directory</h1>
- <p>Discover registered agents across the ecosystem</p>
- </header>
-
- <div class="container">
- <div class="controls">
- <input
- type="text"
- id="search"
- class="search-box"
- placeholder="Search by name, ID, or description…"
- />
- <div class="filter-group">
- <span class="filter-label">Chain:</span>
+ <main>
+ <section class="agents-hero">
+ <p class="agents-eyebrow">ERC-8004 Agent Directory</p>
+ <h1>Agent Directory</h1>
+ <p>Discover registered agents across the ecosystem</p>
+ </section>
+
+ <div class="agents-controls">
+ <div class="agents-search">
+ <input
+ type="text"
+ id="search"
+ placeholder="Search by name, ID, or description…"
+ aria-label="Search agents"
+ />
+ </div>
+ <div class="agents-filter-group">
+ <span class="agents-filter-label">Chain:</span>
<button class="filter-chip active" data-filter="all">All</button>
<button class="filter-chip" data-filter="8453">Base</button>
<button class="filter-chip" data-filter="84532">Base Sepolia</button>
<button class="filter-chip" data-filter="10">Optimism</button>
<button class="filter-chip" data-filter="137">Polygon</button>
</div>
- <select id="sort" class="sort-select">
+ <select id="sort" class="agents-sort" aria-label="Sort agents">
<option value="newest">Newest First</option>
<option value="oldest">Oldest First</option>
<option value="name">Alphabetical</option>
</select>
</div>
- <div id="loading" class="loading" style="display: none">Loading agents</div>
- <div id="agents" class="agent-grid"></div>
-
- <div id="empty-state" class="empty-state" style="display: none">
- <h2>No agents found</h2>
- <p>Be the first to register your agent on-chain — generate its 3D body from a text prompt, then give it a brain.</p>
- <a href="/create" class="cta-button">Create Agent</a>
- <a href="/create/prompt" class="cta-button cta-button--ghost">Generate a body from text</a>
- </div>
+ <div class="agents-wrap">
+ <div id="loading" class="agents-loading" style="display: none">Loading agents</div>
+ <div id="agents" class="agent-grid"></div>
+
+ <div id="empty-state" class="agents-empty" style="display: none">
+ <h2>No agents found</h2>
+ <p>Be the first to register your agent on-chain — generate its 3D body from a text prompt, then give it a brain.</p>
+ <div class="agents-empty-actions">
+ <a href="/create" class="btn-primary">Create Agent</a>
+ <a href="/forge" class="btn-ghost">Generate 3D from text</a>
+ </div>
+ </div>
- <div id="pagination" class="pagination" style="display: none">
- <button id="prev-btn" class="pagination-button">← Previous</button>
- <span id="page-info" class="pagination-info"></span>
- <button id="next-btn" class="pagination-button">Next →</button>
+ <div id="pagination" class="agents-pagination" style="display: none">
+ <button id="prev-btn" class="pag-btn">← Previous</button>
+ <span id="page-info" class="pag-info"></span>
+ <button id="next-btn" class="pag-btn">Next →</button>
+ </div>
</div>
- </div>
+ </main>
<div id="footer-container"></div>
<script src="/footer.js" defer></script>
-
<script type="module" src="./boot.js"></script>
<script src="/brand.js" defer></script>
-</body>
+ </body>
</html>
diff --git a/public/changelog.json b/public/changelog.json
index be9d14a77..f451276cd 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-13T10:02:14.558Z",
+ "generated_at": "2026-06-13T14:19:18.109Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -16,6 +16,16 @@
"launch"
]
},
+ {
+ "date": "2026-06-13",
+ "type": "launch",
+ "title": "IRL",
+ "summary": "Place a 3D avatar in your real environment. Camera AR passthrough, joystick movement, and tap-to-place 3D objects on your floor.",
+ "link": "/irl",
+ "tags": [
+ "launch"
+ ]
+ },
{
"date": "2026-06-13",
"type": "launch",
@@ -120,6 +130,17 @@
"feature"
]
},
+ {
+ "date": "2026-06-13",
+ "type": "update",
+ "title": "Forge free lane never fails: automatic fallback when the free engine is busy",
+ "summary": "The free text-to-3D engine runs on a hosted preview that occasionally goes unreachable or returns nothing, which could leave a generation failing with a server error while the paid Fast engine kept working. Forge now detects any free-lane hiccup mid-generation and transparently re-routes the same prompt to the platform's image-intermediate engine, so a free generation always returns a model with zero setup. The result reports the engine that actually produced it, so the swap is never hidden.",
+ "link": "/forge",
+ "tags": [
+ "fix",
+ "improvement"
+ ]
+ },
{
"date": "2026-06-13",
"type": "update",
@@ -131,6 +152,16 @@
"fix"
]
},
+ {
+ "date": "2026-06-13",
+ "type": "update",
+ "title": "IRL — walk your avatar in the real world, place 3D objects on your floor",
+ "summary": "New page at /irl. Open it and your avatar appears with a joystick. Hit Camera and your phone's rear camera becomes the background — the avatar walks on your real floor. Switch on Add Object, pick a shape (Orb, Crate, Crystal, Ring, or Pillar), and tap anywhere on the floor to drop it into the scene. Objects spawn with a smooth scale animation. Drag to orbit the camera, WASD on desktop. Share your setup with one tap.",
+ "link": "/irl",
+ "tags": [
+ "feature"
+ ]
+ },
{
"date": "2026-06-13",
"type": "update",
@@ -153,6 +184,16 @@
"sdk"
]
},
+ {
+ "date": "2026-06-13",
+ "type": "update",
+ "title": "Record videos from the Animation Studio: send a pose animation straight to Scene Studio",
+ "summary": "The keyframe timeline in the Animation Studio (/pose) now has a 'Record in Scene →' button. It bakes your posed animation into the rig and opens it inside Scene Studio (/scene) as a ready-to-play timeline track, already wired to play during rendering. From there, Render ▸ Video captures the motion to an MP4 at the resolution, frame rate, and length you choose — no export, re-import, or scripting in between. Works with the built-in mannequin and any avatar you load.",
+ "link": "/pose",
+ "tags": [
+ "feature"
+ ]
+ },
{
"date": "2026-06-13",
"type": "update",
@@ -163,6 +204,17 @@
"improvement"
]
},
+ {
+ "date": "2026-06-13",
+ "type": "update",
+ "title": "Refine any forged model instantly, on-device — no waiting, no limits",
+ "summary": "Forge has a new Refine panel that perfects the model you already have, right in your browser — no re-generation and no rate limits. Pick an intent — Clean (weld duplicate vertices and fix faceted shading), Smooth (relax the surface noise generated meshes carry), Game-ready (decimate to a real-time triangle budget while keeping the silhouette and UVs), or Hero (subdivide and smooth for render-quality close-ups). Each runs in milliseconds and shows the exact before/after triangle, vertex, and file-size change, with a one-click revert. Because it never calls the generation service, Refine also works the moment that service is busy: if a generation is throttled, Forge now shows a live countdown and offers to refine your current model locally instead, so you're never stuck at a dead end.",
+ "link": "/forge",
+ "tags": [
+ "feature",
+ "improvement"
+ ]
+ },
{
"date": "2026-06-13",
"type": "update",
@@ -388,7 +440,7 @@
"date": "2026-06-12",
"type": "update",
"title": "Forge gets a community showcase — and takes photos from anywhere",
- "summary": "The /forge page now ends with “Fresh from the Forge”: a live strip of the newest models other people generated. Hover a card and the actual model spins in place; open it in the full viewer with download, share, and stylize working; or hit Remix to copy its prompt into the composer and make your own version. Getting photos in is easier too — paste an image from the clipboard (⌘V) anywhere on the page, or drag files onto the page and Forge switches to photo mode and places them for you.",
+ "summary": "The /forge page now ends with \"Fresh from the Forge\": a live strip of the newest models other people generated. Hover a card and the actual model spins in place; open it in the full viewer with download, share, and stylize working; or hit Remix to copy its prompt into the composer and make your own version. Getting photos in is easier too — paste an image from the clipboard (⌘V) anywhere on the page, or drag files onto the page and Forge switches to photo mode and places them for you.",
"link": "/forge",
"tags": [
"feature"
diff --git a/public/changelog.xml b/public/changelog.xml
index 460093a83..5ab137822 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -14,6 +14,14 @@
<category>launch</category>
<description>Every three.ws avatar and Forge model has a View in AR button. On mobile it anchors the model to real surfaces through your camera. WebXR on Android, Quick Look on iOS — no app, no download.</description>
</item>
+ <item>
+ <title>IRL</title>
+ <link>https://three.ws/irl</link>
+ <guid isPermaLink="false">2026-06-13:IRL</guid>
+ <pubDate>Sat, 13 Jun 2026 12:00:00 GMT</pubDate>
+ <category>launch</category>
+ <description>Place a 3D avatar in your real environment. Camera AR passthrough, joystick movement, and tap-to-place 3D objects on your floor.</description>
+ </item>
<item>
<title>Scene Composer</title>
<link>https://three.ws/compose</link>
@@ -94,6 +102,14 @@
<category>feature</category>
<description>Forge now speaks to more best-in-class 3D generators, so you can pick the engine that fits the job. Rodin (Hyper3D) joins for native text-to-geometry and image-to-3D with clean quad topology and a real polygon target; Stable Fast 3D turns a single photo into a textured model in seconds; and you can now run reconstructions on your own Replicate account. Tripo, which was already supported, finally has a key field in your account settings alongside Meshy. All of these are bring-your-own-key — add a key under Account, then Provider Keys, and the engine lights up. The free, no-setup lanes for prompts and sketches are unchanged, and if you choose the geometry path without a key, Forge now quietly falls back to the free engine instead of asking for one.</description>
</item>
+ <item>
+ <title>Forge free lane never fails: automatic fallback when the free engine is busy</title>
+ <link>https://three.ws/forge</link>
+ <guid isPermaLink="false">2026-06-13:Forge free lane never fails: automatic fallback when the free engine is busy</guid>
+ <pubDate>Sat, 13 Jun 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>The free text-to-3D engine runs on a hosted preview that occasionally goes unreachable or returns nothing, which could leave a generation failing with a server error while the paid Fast engine kept working. Forge now detects any free-lane hiccup mid-generation and transparently re-routes the same prompt to the platform's image-intermediate engine, so a free generation always returns a model with zero setup. The result reports the engine that actually produced it, so the swap is never hidden.</description>
+ </item>
<item>
<title>Forge improvements: category tagging, model load errors, and more</title>
<link>https://three.ws/forge</link>
@@ -102,6 +118,14 @@
<category>improvement</category>
<description>Several Forge improvements ship today: a new Tag As strip appears after generation so you can label your model (Avatar, Creature, Item, Accessory, Scene, Vehicle) — this feeds the explore feed's category filters. An Open in Composer button links directly to /compose with the model pre-loaded. When a stored GLB fails to stream, the viewer now shows a clear error overlay instead of going blank, with a prompt to use the direct download link. The Download button shows a Preparing… state while stamping provenance metadata into the file. A crossorigin attribute was added to the model-viewer element for proper range-request handling on CORS-enabled CDN paths. Three unhandled-promise-rejection sources on the homepage were plugged — async IntersectionObserver callbacks and the AR-section IIFE now guard against abort errors when users navigate away mid-load. Backend health probes retry twice (at 30 s and 60 s) if the first check fails, so a brief cold-start no longer leaves all engine buttons stuck in an unknown state. Empty (0-byte) image uploads are now rejected immediately with a clear message instead of failing silently mid-upload.</description>
</item>
+ <item>
+ <title>IRL — walk your avatar in the real world, place 3D objects on your floor</title>
+ <link>https://three.ws/irl</link>
+ <guid isPermaLink="false">2026-06-13:IRL — walk your avatar in the real world, place 3D objects on your floor</guid>
+ <pubDate>Sat, 13 Jun 2026 12:00:00 GMT</pubDate>
+ <category>feature</category>
+ <description>New page at /irl. Open it and your avatar appears with a joystick. Hit Camera and your phone's rear camera becomes the background — the avatar walks on your real floor. Switch on Add Object, pick a shape (Orb, Crate, Crystal, Ring, or Pillar), and tap anywhere on the floor to drop it into the scene. Objects spawn with a smooth scale animation. Drag to orbit the camera, WASD on desktop. Share your setup with one tap.</description>
+ </item>
<item>
<title>Platform scalability improvements across the board</title>
<link>https://three.ws/changelog</link>
@@ -118,6 +142,14 @@
<category>feature</category>
<description>Our free, read-only pump.fun and Solana tools are now discoverable in the official Model Context Protocol registry, so any MCP-compatible client (Claude, Cursor, and others) can find and connect to them by name. It's a remote server — no install, no API key for the free tools — covering token discovery, bonding-curve and holder analysis, creator intelligence, and Solana Name Service lookups. This brings the number of three.ws servers in the registry to six.</description>
</item>
+ <item>
+ <title>Record videos from the Animation Studio: send a pose animation straight to Scene Studio</title>
+ <link>https://three.ws/pose</link>
+ <guid isPermaLink="false">2026-06-13:Record videos from the Animation Studio: send a pose animation straight to Scene Studio</guid>
+ <pubDate>Sat, 13 Jun 2026 12:00:00 GMT</pubDate>
+ <category>feature</category>
+ <description>The keyframe timeline in the Animation Studio (/pose) now has a 'Record in Scene →' button. It bakes your posed animation into the rig and opens it inside Scene Studio (/scene) as a ready-to-play timeline track, already wired to play during rendering. From there, Render ▸ Video captures the motion to an MP4 at the resolution, frame rate, and length you choose — no export, re-import, or scripting in between. Works with the built-in mannequin and any avatar you load.</description>
+ </item>
<item>
<title>Refine any Forge model to higher quality in one click — plus sharper multi-view guidance</title>
<link>https://three.ws/forge</link>
@@ -126,6 +158,14 @@
<category>improvement</category>
<description>Three upgrades to the Forge (/forge). After a model generates, a new Refine button re-runs that exact prompt or photos one quality tier higher — Draft to Standard to High — so you can preview cheaply, then commit to the best version without retyping anything. When building from photos, a live counter now shows how many of the four reference views you've added and reminds you that more angles make a sharper mesh. And the action bar under each finished model now reflows cleanly on phones, with Refine and Make-another leading at full width. Sketch mode also makes its required description unmistakable.</description>
</item>
+ <item>
+ <title>Refine any forged model instantly, on-device — no waiting, no limits</title>
+ <link>https://three.ws/forge</link>
+ <guid isPermaLink="false">2026-06-13:Refine any forged model instantly, on-device — no waiting, no limits</guid>
+ <pubDate>Sat, 13 Jun 2026 12:00:00 GMT</pubDate>
+ <category>feature</category>
+ <description>Forge has a new Refine panel that perfects the model you already have, right in your browser — no re-generation and no rate limits. Pick an intent — Clean (weld duplicate vertices and fix faceted shading), Smooth (relax the surface noise generated meshes carry), Game-ready (decimate to a real-time triangle budget while keeping the silhouette and UVs), or Hero (subdivide and smooth for render-quality close-ups). Each runs in milliseconds and shows the exact before/after triangle, vertex, and file-size change, with a one-click revert. Because it never calls the generation service, Refine also works the moment that service is busy: if a generation is throttled, Forge now shows a live countdown and offers to refine your current model locally instead, so you're never stuck at a dead end.</description>
+ </item>
<item>
<title>Reliability pass: steadier live feed, token art that never blanks, and a graceful 3D fallback</title>
<link>https://three.ws/changelog</link>
@@ -300,7 +340,7 @@
<guid isPermaLink="false">2026-06-12:Forge gets a community showcase — and takes photos from anywhere</guid>
<pubDate>Fri, 12 Jun 2026 12:00:00 GMT</pubDate>
<category>feature</category>
- <description>The /forge page now ends with “Fresh from the Forge”: a live strip of the newest models other people generated. Hover a card and the actual model spins in place; open it in the full viewer with download, share, and stylize working; or hit Remix to copy its prompt into the composer and make your own version. Getting photos in is easier too — paste an image from the clipboard (⌘V) anywhere on the page, or drag files onto the page and Forge switches to photo mode and places them for you.</description>
+ <description>The /forge page now ends with &quot;Fresh from the Forge&quot;: a live strip of the newest models other people generated. Hover a card and the actual model spins in place; open it in the full viewer with download, share, and stylize working; or hit Remix to copy its prompt into the composer and make your own version. Getting photos in is easier too — paste an image from the clipboard (⌘V) anywhere on the page, or drag files onto the page and Forge switches to photo mode and places them for you.</description>
</item>
<item>
<title>Forge helps you write a better prompt before you spend a generation</title>
diff --git a/public/demos-embed/agents.html b/public/demos-embed/agents.html
new file mode 100644
index 000000000..466dfc28d
--- /dev/null
+++ b/public/demos-embed/agents.html
@@ -0,0 +1,220 @@
+<!doctype html>
+<html lang="en" style="background:transparent">
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width,initial-scale=1">
+ <title>Agent Directory · three.ws</title>
+ <meta name="robots" content="noindex">
+ <link rel="stylesheet" href="/style.css">
+ <link rel="stylesheet" href="/fonts/fonts.css">
+ <style>
+ html, body {
+ background: transparent !important;
+ color: #161616 !important;
+ font-family: 'Helvetica Neue', 'Helvetica Neue', Arial, sans-serif !important;
+ margin: 0; padding: 0;
+ }
+ :root {
+ color-scheme: light !important;
+ --bg: transparent !important;
+ --ink: #161616 !important;
+ --ink-dim: #525252 !important;
+ --border: #e0e0e0 !important;
+ --accent: #0f62fe !important;
+ }
+ header, footer, #nav-container, #footer-container { display: none !important; }
+
+ .agents-hero {
+ text-align: center;
+ padding: 32px 1rem 20px;
+ background: transparent;
+ }
+ .agents-eyebrow {
+ font-size: 0.75rem;
+ font-weight: 600;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ color: #0f62fe;
+ margin-bottom: 0.5rem;
+ }
+ .agents-hero h1 {
+ font-size: clamp(24px, 4vw, 36px);
+ font-weight: 300;
+ line-height: 1.1;
+ margin-bottom: 0.5rem;
+ color: #161616;
+ background: none !important;
+ -webkit-text-fill-color: #161616 !important;
+ }
+ .agents-hero p { font-size: 0.95rem; color: #525252; max-width: 500px; margin: 0 auto; }
+
+ .agents-controls {
+ max-width: 1400px;
+ margin: 0 auto 1.5rem;
+ padding: 0 1.5rem;
+ display: flex;
+ flex-wrap: wrap;
+ gap: 0.75rem;
+ align-items: center;
+ background: transparent;
+ }
+ .agents-search { position: relative; flex: 1; min-width: 220px; }
+ .agents-search input {
+ width: 100%;
+ padding: 0.6rem 1rem;
+ background: transparent;
+ border: 1px solid #e0e0e0;
+ color: #161616;
+ font-size: 0.9rem;
+ font-family: inherit;
+ transition: border-color 0.15s;
+ }
+ .agents-search input::placeholder { color: #a8a8a8; }
+ .agents-search input:focus { outline: none; border-color: #0f62fe; }
+ .agents-filter-group { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
+ .agents-filter-label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: #525252; }
+ .filter-chip {
+ padding: 0.35rem 0.8rem;
+ background: transparent;
+ border: 1px solid #e0e0e0;
+ cursor: pointer;
+ font-size: 0.82rem;
+ font-family: inherit;
+ color: #525252;
+ transition: background 0.15s, border-color 0.15s, color 0.15s;
+ }
+ .filter-chip:hover { border-color: #161616; color: #161616; }
+ .filter-chip.active { background: #0f62fe; border-color: #0f62fe; color: #fff; font-weight: 600; }
+ .agents-sort {
+ padding: 0.4rem 0.8rem;
+ background: transparent;
+ border: 1px solid #e0e0e0;
+ color: #161616;
+ cursor: pointer;
+ font-size: 0.85rem;
+ font-family: inherit;
+ }
+ .agents-sort:focus { outline: none; border-color: #0f62fe; }
+
+ .agents-wrap { max-width: 1400px; margin: 0 auto; padding: 0 1.5rem 3rem; background: transparent; }
+ .agent-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
+ gap: 1px;
+ background: #e0e0e0;
+ margin-bottom: 2rem;
+ }
+ .agent-card {
+ background: transparent;
+ padding: 1.1rem 1.25rem 1.25rem;
+ gap: 0.5rem;
+ display: flex;
+ flex-direction: column;
+ cursor: pointer;
+ transition: background 0.15s;
+ }
+ .agent-card:hover { background: rgba(15,98,254,0.04); }
+ .card-head { display: flex; align-items: center; gap: 0.75rem; }
+ .card-avatar-sm {
+ width: 48px; height: 48px; flex-shrink: 0;
+ border: 1px solid #e0e0e0;
+ display: flex; align-items: center; justify-content: center;
+ overflow: hidden; color: #c6c6c6; font-size: 1.2rem;
+ background: transparent;
+ }
+ .card-avatar-sm img { width: 100%; height: 100%; object-fit: cover; }
+ .card-title { flex: 1; min-width: 0; }
+ .card-name-row { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.15rem; }
+ .card-name { font-size: 0.9rem; font-weight: 600; color: #161616; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+ .active-dot { width: 6px; height: 6px; border-radius: 50%; background: #24a148; flex-shrink: 0; }
+ .card-id { font-size: 0.72rem; color: #6f6f6f; font-family: monospace, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+ .card-desc { font-size: 0.8rem; color: #525252; line-height: 1.4; }
+ .card-protos, .card-trust, .card-onchain, .card-owner { display: flex; flex-wrap: wrap; gap: 0.3rem; font-size: 0.7rem; }
+ .proto-badge { padding: 0.15rem 0.4rem; background: transparent; border: 1px solid #e0e0e0; color: #525252; font-weight: 500; }
+ .trust-pill { padding: 0.15rem 0.4rem; background: transparent; border: 1px solid #24a148; color: #198038; font-weight: 500; }
+ .owner-addr { font-family: monospace, monospace; color: #6f6f6f; cursor: pointer; }
+ .owner-copy { background: none; border: none; color: #6f6f6f; cursor: pointer; font-size: 0.9em; padding: 0 0.2rem; }
+ .owner-copy.copied { color: #24a148; }
+ .card-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: auto; padding-top: 0.2rem; }
+ .card-see3d {
+ display: inline-flex; align-items: center; gap: 0.3rem;
+ padding: 0.3rem 0.6rem; font-size: 0.74rem; font-weight: 600;
+ color: #0f62fe; background: transparent; border: 1px solid #0f62fe;
+ text-decoration: none; transition: background 0.15s;
+ }
+ .card-see3d:hover { background: rgba(15,98,254,0.06); }
+
+ .agents-loading { text-align: center; padding: 3rem 2rem; color: #525252; display: flex; align-items: center; justify-content: center; gap: 0.75rem; }
+ .agents-loading::after { content: ''; display: inline-block; width: 1rem; height: 1rem; border: 2px solid rgba(15,98,254,0.2); border-top-color: #0f62fe; border-radius: 50%; animation: spin 0.8s linear infinite; }
+ @keyframes spin { to { transform: rotate(360deg); } }
+
+ .agents-empty { text-align: center; padding: 4rem 2rem; background: transparent; }
+ .agents-empty h2 { font-size: 1.25rem; font-weight: 600; color: #161616; margin-bottom: 0.5rem; }
+ .agents-empty p { font-size: 0.9rem; color: #525252; margin-bottom: 1.5rem; max-width: 440px; margin-inline: auto; }
+ .agents-empty-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
+ .btn-primary { padding: 0.6rem 1.25rem; background: #0f62fe; border: none; color: #fff; font-weight: 600; font-size: 0.88rem; cursor: pointer; text-decoration: none; display: inline-block; transition: background 0.15s; }
+ .btn-primary:hover { background: #0353e9; }
+ .btn-ghost { padding: 0.6rem 1.25rem; background: transparent; border: 1px solid #e0e0e0; color: #161616; font-weight: 500; font-size: 0.88rem; cursor: pointer; text-decoration: none; display: inline-block; transition: border-color 0.15s; }
+ .btn-ghost:hover { border-color: #161616; }
+
+ .agents-pagination { display: flex; justify-content: center; align-items: center; gap: 1rem; padding: 2rem 0; flex-wrap: wrap; }
+ .pag-btn { padding: 0.45rem 0.9rem; background: transparent; border: 1px solid #e0e0e0; color: #161616; cursor: pointer; font-size: 0.85rem; font-family: inherit; transition: border-color 0.15s, color 0.15s; }
+ .pag-btn:hover:not(:disabled) { border-color: #0f62fe; color: #0f62fe; }
+ .pag-btn:disabled { opacity: 0.3; cursor: not-allowed; }
+ .pag-info { font-size: 0.85rem; color: #525252; }
+
+ @media (max-width: 640px) {
+ .agents-controls { flex-direction: column; align-items: stretch; }
+ .agent-grid { grid-template-columns: 1fr; gap: 0; }
+ }
+ </style>
+</head>
+<body style="background:transparent">
+ <main>
+ <section class="agents-hero">
+ <p class="agents-eyebrow">ERC-8004 · three.ws</p>
+ <h1>Agent Directory</h1>
+ <p>Discover registered 3D AI agents across the ecosystem</p>
+ </section>
+
+ <div class="agents-controls">
+ <div class="agents-search">
+ <input type="text" id="search" placeholder="Search by name, ID, or description…" aria-label="Search agents">
+ </div>
+ <div class="agents-filter-group">
+ <span class="agents-filter-label">Chain:</span>
+ <button class="filter-chip active" data-filter="all">All</button>
+ <button class="filter-chip" data-filter="8453">Base</button>
+ <button class="filter-chip" data-filter="84532">Base Sepolia</button>
+ <button class="filter-chip" data-filter="10">Optimism</button>
+ <button class="filter-chip" data-filter="137">Polygon</button>
+ </div>
+ <select id="sort" class="agents-sort" aria-label="Sort agents">
+ <option value="newest">Newest First</option>
+ <option value="oldest">Oldest First</option>
+ <option value="name">Alphabetical</option>
+ </select>
+ </div>
+
+ <div class="agents-wrap">
+ <div id="loading" class="agents-loading" style="display:none">Loading agents</div>
+ <div id="agents" class="agent-grid"></div>
+ <div id="empty-state" class="agents-empty" style="display:none">
+ <h2>No agents found</h2>
+ <p>Be the first to register your agent on-chain — generate its 3D body from a text prompt, then give it a brain.</p>
+ <div class="agents-empty-actions">
+ <a href="https://three.ws/create" target="_blank" class="btn-primary">Create Agent</a>
+ <a href="https://three.ws/forge" target="_blank" class="btn-ghost">Generate 3D from text</a>
+ </div>
+ </div>
+ <div id="pagination" class="agents-pagination" style="display:none">
+ <button id="prev-btn" class="pag-btn">← Previous</button>
+ <span id="page-info" class="pag-info"></span>
+ <button id="next-btn" class="pag-btn">Next →</button>
+ </div>
+ </div>
+ </main>
+
+ <script type="module" src="/agents/boot.js"></script>
+</body>
+</html>
diff --git a/public/demos-embed/forge.html b/public/demos-embed/forge.html
new file mode 100644
index 000000000..9a28795e5
--- /dev/null
+++ b/public/demos-embed/forge.html
@@ -0,0 +1,193 @@
+<!doctype html>
+<html lang="en" style="background:transparent">
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width,initial-scale=1">
+ <title>Forge · three.ws</title>
+ <meta name="robots" content="noindex">
+ <script type="module" src="https://three.ws/dist-lib/agent-3d.js"></script>
+ <style>
+ html, body {
+ background: transparent !important;
+ margin: 0; padding: 0;
+ font-family: 'Helvetica Neue', 'Helvetica Neue', Arial, sans-serif;
+ color: #161616;
+ }
+ .forge-wrap {
+ background: transparent;
+ padding: 32px 24px;
+ }
+ .forge-header {
+ display: flex;
+ align-items: flex-start;
+ justify-content: space-between;
+ margin-bottom: 28px;
+ flex-wrap: wrap;
+ gap: 16px;
+ }
+ .forge-eyebrow {
+ font-size: 11px;
+ font-weight: 600;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ color: #0f62fe;
+ margin-bottom: 6px;
+ }
+ .forge-title {
+ font-size: clamp(22px, 3vw, 30px);
+ font-weight: 300;
+ color: #161616;
+ margin: 0 0 8px;
+ }
+ .forge-title strong { font-weight: 600; }
+ .forge-sub { font-size: 14px; color: #525252; line-height: 1.5; max-width: 480px; }
+ .forge-cta {
+ display: inline-flex;
+ align-items: center;
+ gap: 8px;
+ background: #0f62fe;
+ color: #fff;
+ border: none;
+ padding: 12px 20px;
+ font-size: 13px;
+ font-weight: 500;
+ font-family: inherit;
+ cursor: pointer;
+ text-decoration: none;
+ white-space: nowrap;
+ transition: background 0.12s;
+ }
+ .forge-cta:hover { background: #0353e9; color: #fff; text-decoration: none; }
+ /* 3D model grid */
+ .model-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
+ gap: 1px;
+ background: #e0e0e0;
+ margin-bottom: 28px;
+ }
+ .model-cell {
+ background: transparent;
+ position: relative;
+ aspect-ratio: 1;
+ overflow: hidden;
+ }
+ agent-3d {
+ width: 100%;
+ height: 100%;
+ display: block;
+ background: transparent;
+ --agent-bg: transparent;
+ }
+ .model-label {
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ padding: 6px 10px;
+ font-size: 11px;
+ color: #525252;
+ background: rgba(255,255,255,0.85);
+ border-top: 1px solid #e0e0e0;
+ }
+ /* Prompt demo */
+ .prompt-demo {
+ border: 1px solid #e0e0e0;
+ padding: 20px 24px;
+ background: transparent;
+ }
+ .prompt-label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: #525252; margin-bottom: 10px; }
+ .prompt-row { display: flex; gap: 0; }
+ .prompt-input {
+ flex: 1;
+ padding: 10px 14px;
+ border: 1px solid #e0e0e0;
+ border-right: none;
+ font-size: 14px;
+ font-family: inherit;
+ color: #161616;
+ background: transparent;
+ }
+ .prompt-input:focus { outline: none; border-color: #0f62fe; }
+ .prompt-input::placeholder { color: #a8a8a8; }
+ .prompt-btn {
+ padding: 10px 20px;
+ background: #0f62fe;
+ border: none;
+ color: #fff;
+ font-size: 13px;
+ font-weight: 600;
+ font-family: inherit;
+ cursor: pointer;
+ white-space: nowrap;
+ transition: background 0.12s;
+ }
+ .prompt-btn:hover { background: #0353e9; }
+ .prompt-note { font-size: 12px; color: #6f6f6f; margin-top: 8px; }
+ .prompt-note a { color: #0f62fe; }
+ </style>
+</head>
+<body style="background:transparent">
+ <div class="forge-wrap">
+ <div class="forge-header">
+ <div>
+ <div class="forge-eyebrow">three.ws · Forge</div>
+ <h1 class="forge-title">Text → <strong>3D model</strong></h1>
+ <p class="forge-sub">Type a description. Get a textured, interactive 3D model. Download the GLB or embed it anywhere.</p>
+ </div>
+ <a href="https://three.ws/forge" target="_blank" class="forge-cta">Open Forge →</a>
+ </div>
+
+ <!-- Live 3D models generated on three.ws -->
+ <div class="model-grid">
+ <div class="model-cell">
+ <agent-3d src="https://three.ws/avatars/cesium-man.glb"></agent-3d>
+ <div class="model-label">3D AI Agent</div>
+ </div>
+ <div class="model-cell">
+ <agent-3d src="https://three.ws/avatars/michelle.glb"></agent-3d>
+ <div class="model-label">Humanoid Agent</div>
+ </div>
+ <div class="model-cell">
+ <agent-3d src="https://three.ws/avatars/fox.glb"></agent-3d>
+ <div class="model-label">Character Agent</div>
+ </div>
+ <div class="model-cell">
+ <agent-3d src="https://three.ws/avatars/default.glb"></agent-3d>
+ <div class="model-label">Default Avatar</div>
+ </div>
+ </div>
+
+ <!-- Prompt demo pointing to real forge -->
+ <div class="prompt-demo">
+ <div class="prompt-label">Try a prompt — opens Forge on three.ws</div>
+ <div class="prompt-row">
+ <input
+ type="text"
+ class="prompt-input"
+ id="prompt-input"
+ placeholder="e.g. e.g. a futuristic robot with glowing blue eyes…"
+ value=""
+ >
+ <button class="prompt-btn" onclick="openForge()">Generate →</button>
+ </div>
+ <p class="prompt-note">
+ Generation happens on <a href="https://three.ws/forge" target="_blank">three.ws/forge</a> — real Meshy API, real GLB output.
+ </p>
+ </div>
+ </div>
+
+ <script>
+ function openForge() {
+ const prompt = document.getElementById('prompt-input').value.trim();
+ const url = prompt
+ ? 'https://three.ws/forge?prompt=' + encodeURIComponent(prompt)
+ : 'https://three.ws/forge';
+ window.open(url, '_blank');
+ }
+ document.getElementById('prompt-input').addEventListener('keydown', function(e) {
+ if (e.key === 'Enter') openForge();
+ });
+ </script>
+</body>
+</html>
diff --git a/public/demos-embed/gallery.html b/public/demos-embed/gallery.html
new file mode 100644
index 000000000..9d50971ad
--- /dev/null
+++ b/public/demos-embed/gallery.html
@@ -0,0 +1,248 @@
+<!doctype html>
+<html lang="en" style="background:transparent">
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width,initial-scale=1">
+ <title>Avatar Gallery · three.ws</title>
+ <meta name="robots" content="noindex">
+ <script type="module" src="https://ajax.googleapis.com/ajax/libs/model-viewer/4.0.0/model-viewer.min.js" integrity="sha384-sr9b4Ux0WhAUGclJ0ym0FSY2zSOMmNSn0bP/SA0e6bNCrpn/5W3QL8mm+LdlQMKw" crossorigin="anonymous"></script>
+ <link rel="stylesheet" href="/style.css">
+ <link rel="stylesheet" href="/gallery/gallery.css">
+ <link rel="stylesheet" href="/fonts/fonts.css">
+ <!-- Light theme override — every background transparent -->
+ <style>
+ html, body {
+ background: transparent !important;
+ color: #161616 !important;
+ font-family: 'Helvetica Neue', 'Helvetica Neue', Arial, sans-serif !important;
+ }
+ /* Force light mode CSS variables */
+ :root {
+ color-scheme: light !important;
+ --bg: transparent !important;
+ --bg-1: transparent !important;
+ --bg-2: transparent !important;
+ --surface-1: rgba(0,0,0,0.03) !important;
+ --surface-2: rgba(0,0,0,0.05) !important;
+ --ink: #161616 !important;
+ --ink-dim: #525252 !important;
+ --ink-subtle: #6f6f6f !important;
+ --border: #e0e0e0 !important;
+ --accent: #0f62fe !important;
+ }
+ /* Strip all dark backgrounds */
+ *, *::before, *::after {
+ box-shadow: none !important;
+ }
+ body.gallery-page {
+ background: transparent !important;
+ color: #161616 !important;
+ display: block !important;
+ }
+ html:has(body.gallery-page) {
+ background: transparent !important;
+ overflow: auto !important;
+ }
+ /* Hero */
+ .gallery-hero {
+ background: transparent !important;
+ padding: 32px 0 24px !important;
+ }
+ .gallery-title {
+ background: none !important;
+ -webkit-background-clip: unset !important;
+ background-clip: unset !important;
+ -webkit-text-fill-color: #161616 !important;
+ color: #161616 !important;
+ font-size: clamp(24px,4vw,36px) !important;
+ font-weight: 300 !important;
+ }
+ .gallery-sub { color: #525252 !important; }
+ .gallery-stat-value { color: #161616 !important; }
+ .gallery-stat-label { color: #525252 !important; }
+ /* Hero chips */
+ .gallery-hero-chip {
+ background: transparent !important;
+ border: 1px solid #e0e0e0 !important;
+ color: #525252 !important;
+ }
+ .gallery-hero-chip--link { color: #0f62fe !important; }
+ /* Buttons */
+ .gallery-hero-btn {
+ background: transparent !important;
+ border: 1px solid #e0e0e0 !important;
+ color: #161616 !important;
+ }
+ .gallery-hero-btn--primary {
+ background: #0f62fe !important;
+ border-color: #0f62fe !important;
+ color: #fff !important;
+ }
+ .gallery-hero-btn:hover { border-color: #161616 !important; }
+ .gallery-hero-btn--primary:hover { background: #0353e9 !important; }
+ /* Controls */
+ .gallery-controls { background: transparent !important; }
+ .gallery-search { background: transparent !important; }
+ .gallery-search input {
+ background: transparent !important;
+ border: 1px solid #e0e0e0 !important;
+ color: #161616 !important;
+ }
+ .gallery-search input::placeholder { color: #a8a8a8 !important; }
+ .gallery-search input:focus { border-color: #0f62fe !important; }
+ .gallery-search-icon { color: #6f6f6f !important; }
+ .gallery-sort-select select,
+ .gallery-sort-select label {
+ background: transparent !important;
+ color: #161616 !important;
+ border-color: #e0e0e0 !important;
+ }
+ .gallery-tag-label { color: #525252 !important; }
+ /* Cards */
+ .gallery-card {
+ background: transparent !important;
+ border: 1px solid #e0e0e0 !important;
+ color: #161616 !important;
+ }
+ .gallery-card:hover {
+ border-color: #0f62fe !important;
+ background: rgba(15,98,254,0.03) !important;
+ }
+ .gallery-card-name { color: #161616 !important; }
+ .gallery-card-meta { color: #525252 !important; }
+ .gallery-card-footer { background: transparent !important; border-top-color: #e0e0e0 !important; }
+ /* Forge section */
+ .gallery-forge-section { background: transparent !important; }
+ .gallery-forge-title { color: #161616 !important; }
+ .gallery-forge-sub { color: #525252 !important; }
+ .gallery-forge-card {
+ background: transparent !important;
+ border: 1px solid #e0e0e0 !important;
+ }
+ .gallery-forge-card:hover { border-color: #0f62fe !important; }
+ .gallery-forge-cta {
+ background: transparent !important;
+ color: #0f62fe !important;
+ border: 1px solid #0f62fe !important;
+ }
+ /* Status / empty */
+ .gallery-status, .gallery-empty { color: #525252 !important; }
+ .gallery-load-more {
+ background: transparent !important;
+ border: 1px solid #e0e0e0 !important;
+ color: #161616 !important;
+ }
+ .gallery-load-more:hover { border-color: #0f62fe !important; color: #0f62fe !important; }
+ /* Tags */
+ .gallery-tag {
+ background: transparent !important;
+ border: 1px solid #e0e0e0 !important;
+ color: #525252 !important;
+ }
+ .gallery-tag.active {
+ background: #0f62fe !important;
+ border-color: #0f62fe !important;
+ color: #fff !important;
+ }
+ /* Modal overlay */
+ .gallery-modal-overlay { background: rgba(0,0,0,0.5) !important; }
+ .gallery-modal {
+ background: #fff !important;
+ color: #161616 !important;
+ }
+ /* No nav/footer */
+ header, footer, #nav-container, #footer-container { display: none !important; }
+ /* Remove any radial gradient backgrounds */
+ body.gallery-page::before,
+ body.gallery-page::after { display: none !important; background: transparent !important; }
+ .gallery-grid-wrap { background: transparent !important; }
+ .gallery-main { background: transparent !important; padding-top: 0 !important; }
+ </style>
+</head>
+<body class="gallery-page" style="background:transparent">
+ <main class="gallery-main">
+ <section class="gallery-hero">
+ <div class="gallery-hero-inner">
+ <div class="gallery-hero-chips">
+ <div class="gallery-hero-chip">
+ <span class="gallery-hero-dot"></span>
+ <span>three.ws · Avatar Gallery</span>
+ </div>
+ </div>
+ <h1 class="gallery-title">Every avatar, ever made.</h1>
+ <p class="gallery-sub">Community-made 3D avatars on three.ws. Click any card to preview, then embed or remix.</p>
+ <div class="gallery-stats">
+ <div class="gallery-stat">
+ <div class="gallery-stat-value" data-role="stat-count">—</div>
+ <div class="gallery-stat-label">Avatars</div>
+ </div>
+ <div class="gallery-stat">
+ <div class="gallery-stat-value" data-role="stat-views">—</div>
+ <div class="gallery-stat-label">Total views</div>
+ </div>
+ </div>
+ <div class="gallery-hero-ctas">
+ <a class="gallery-hero-btn gallery-hero-btn--primary" href="https://three.ws/create/prompt" target="_blank">Create from a prompt</a>
+ <a class="gallery-hero-btn" href="https://three.ws/create/selfie" target="_blank">Create from selfie</a>
+ <a class="gallery-hero-btn" href="https://three.ws/forge" target="_blank">Open Forge</a>
+ </div>
+ </div>
+ </section>
+
+ <section class="gallery-controls">
+ <div class="gallery-controls-top">
+ <div class="gallery-search">
+ <svg class="gallery-search-icon" viewBox="0 0 20 20" fill="none" aria-hidden="true">
+ <circle cx="9" cy="9" r="6" stroke="currentColor" stroke-width="1.6"/>
+ <path d="m14 14 4 4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/>
+ </svg>
+ <input type="search" placeholder="Search by name or description…" data-role="search" aria-label="Search avatars" autocomplete="off" spellcheck="false">
+ <button type="button" class="gallery-search-clear" data-role="search-clear" aria-label="Clear search" hidden>×</button>
+ </div>
+ <div class="gallery-sort-select">
+ <label for="gallery-sort-embed">Sort:</label>
+ <select id="gallery-sort-embed" data-role="sort">
+ <option value="newest">Newest</option>
+ <option value="popular">Most viewed</option>
+ <option value="alpha">A → Z</option>
+ </select>
+ </div>
+ </div>
+ <div class="gallery-tag-wrap" data-role="tag-wrap" hidden>
+ <div class="gallery-tag-label">Tags</div>
+ <div class="gallery-tags" data-role="tags"></div>
+ </div>
+ </section>
+
+ <section class="gallery-grid-wrap">
+ <div class="gallery-grid" data-role="grid"></div>
+ <div class="gallery-status" data-role="status"></div>
+ <div class="gallery-sentinel" data-role="sentinel" aria-hidden="true"></div>
+ <div class="gallery-load-more-wrap">
+ <button class="gallery-load-more" data-role="load-more" hidden>Load more</button>
+ </div>
+ </section>
+
+ <section class="gallery-forge-section" id="forge-section" hidden>
+ <div class="gallery-forge-head">
+ <div>
+ <div class="gallery-forge-title-row">
+ <svg class="gallery-forge-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
+ <path d="M12 2 3 7v10l9 5 9-5V7l-9-5Z"/><path d="m3 7 9 5 9-5"/><line x1="12" y1="12" x2="12" y2="22"/>
+ </svg>
+ <h2 class="gallery-forge-title">From the Forge</h2>
+ <span class="gallery-forge-count" id="forge-count"></span>
+ </div>
+ <p class="gallery-forge-sub">3D models auto-saved as the community generates them.</p>
+ </div>
+ <a href="https://three.ws/forge" target="_blank" class="gallery-forge-cta">Generate your own →</a>
+ </div>
+ <div class="gallery-forge-grid" id="forge-grid"></div>
+ </section>
+ </main>
+
+ <script type="module">import '/src/shared/onchain-badge.js';</script>
+ <script type="module">import '/src/shared/template-picker.js';</script>
+ <script type="module" src="/gallery/gallery.js"></script>
+</body>
+</html>
diff --git a/public/demos-embed/selfie.html b/public/demos-embed/selfie.html
new file mode 100644
index 000000000..739961a0f
--- /dev/null
+++ b/public/demos-embed/selfie.html
@@ -0,0 +1,98 @@
+<!doctype html>
+<html lang="en" style="background:transparent">
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width,initial-scale=1">
+ <title>Selfie to Avatar · three.ws</title>
+ <meta name="robots" content="noindex">
+ <script type="module" src="https://three.ws/dist-lib/agent-3d.js"></script>
+ <style>
+ html, body {
+ background: transparent !important;
+ margin: 0; padding: 0;
+ font-family: 'Helvetica Neue', 'Helvetica Neue', Arial, sans-serif;
+ color: #161616;
+ }
+ .wrap { background: transparent; padding: 32px 24px; }
+ .eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: #0f62fe; margin-bottom: 6px; }
+ .title { font-size: clamp(22px,3vw,30px); font-weight: 300; color: #161616; margin: 0 0 8px; }
+ .title strong { font-weight: 600; }
+ .sub { font-size: 14px; color: #525252; line-height: 1.5; max-width: 520px; margin-bottom: 28px; }
+
+ /* Steps */
+ .steps { display: grid; grid-template-columns: repeat(3,1fr); gap: 1px; background: #e0e0e0; margin-bottom: 32px; }
+ .step { background: transparent; padding: 20px; }
+ .step-num { font-size: 28px; font-weight: 300; color: #0f62fe; line-height: 1; margin-bottom: 8px; }
+ .step-head { font-size: 14px; font-weight: 600; color: #161616; margin-bottom: 4px; }
+ .step-desc { font-size: 13px; color: #525252; line-height: 1.4; }
+
+ /* Avatar showcase */
+ .avatars { display: grid; grid-template-columns: repeat(auto-fill,minmax(160px,1fr)); gap: 1px; background: #e0e0e0; margin-bottom: 28px; }
+ .av-cell { background: transparent; position: relative; aspect-ratio: 3/4; overflow: hidden; }
+ agent-3d { width: 100%; height: 100%; display: block; background: transparent; --agent-bg: transparent; }
+ .av-label { position: absolute; bottom: 0; left: 0; right: 0; padding: 5px 8px; font-size: 10px; color: #525252; background: rgba(255,255,255,0.85); border-top: 1px solid #e0e0e0; text-align: center; }
+
+ /* CTA */
+ .cta-row { display: flex; gap: 12px; flex-wrap: wrap; }
+ .btn-primary { display: inline-flex; align-items: center; gap: 8px; background: #0f62fe; color: #fff; border: none; padding: 12px 20px; font-size: 13px; font-weight: 500; font-family: inherit; cursor: pointer; text-decoration: none; transition: background 0.12s; }
+ .btn-primary:hover { background: #0353e9; color: #fff; text-decoration: none; }
+ .btn-ghost { display: inline-flex; align-items: center; gap: 8px; background: transparent; color: #0f62fe; border: 1px solid #0f62fe; padding: 12px 20px; font-size: 13px; font-weight: 500; font-family: inherit; cursor: pointer; text-decoration: none; transition: background 0.12s; }
+ .btn-ghost:hover { background: #0f62fe; color: #fff; text-decoration: none; }
+
+ @media (max-width: 600px) {
+ .steps { grid-template-columns: 1fr; }
+ .avatars { grid-template-columns: repeat(2,1fr); }
+ }
+ </style>
+</head>
+<body style="background:transparent">
+ <div class="wrap">
+ <div class="eyebrow">three.ws · Selfie → Avatar</div>
+ <h1 class="title">One photo.<br><strong>Full 3D avatar.</strong></h1>
+ <p class="sub">Upload a selfie and get a fully rigged, animated 3D avatar in seconds. No 3D skills required. Use it as your agent identity on three.ws.</p>
+
+ <div class="steps">
+ <div class="step">
+ <div class="step-num">01</div>
+ <div class="step-head">Upload a selfie</div>
+ <div class="step-desc">Any front-facing photo works. The AI reconstructs your face and body in 3D.</div>
+ </div>
+ <div class="step">
+ <div class="step-num">02</div>
+ <div class="step-head">Get a rigged GLB</div>
+ <div class="step-desc">Fully animated. Compatible with three.ws, Unity, Unreal Engine, and the web.</div>
+ </div>
+ <div class="step">
+ <div class="step-num">03</div>
+ <div class="step-head">Deploy as your agent</div>
+ <div class="step-desc">Attach your avatar to an ERC-8004 on-chain identity. Your agent is live.</div>
+ </div>
+ </div>
+
+ <!-- Live avatar examples -->
+ <div class="avatars">
+ <div class="av-cell">
+ <agent-3d src="https://three.ws/avatars/realistic-female.glb"></agent-3d>
+ <div class="av-label">Realistic Female</div>
+ </div>
+ <div class="av-cell">
+ <agent-3d src="https://three.ws/avatars/readyplayerme.glb"></agent-3d>
+ <div class="av-label">Ready Player Me</div>
+ </div>
+ <div class="av-cell">
+ <agent-3d src="https://three.ws/avatars/michelle.glb"></agent-3d>
+ <div class="av-label">Michelle</div>
+ </div>
+ <div class="av-cell">
+ <agent-3d src="https://three.ws/avatars/cesium-man.glb"></agent-3d>
+ <div class="av-label">Cesium Man</div>
+ </div>
+ </div>
+
+ <div class="cta-row">
+ <a href="https://three.ws/create/selfie" target="_blank" class="btn-primary">Create from selfie →</a>
+ <a href="https://three.ws/gallery" target="_blank" class="btn-ghost">Browse gallery</a>
+ </div>
+ </div>
+</body>
+</html>
diff --git a/public/demos-embed/walk.html b/public/demos-embed/walk.html
new file mode 100644
index 000000000..af1c2a1c5
--- /dev/null
+++ b/public/demos-embed/walk.html
@@ -0,0 +1,92 @@
+<!doctype html>
+<html lang="en" style="background:transparent">
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width,initial-scale=1">
+ <title>Walk Mode · three.ws</title>
+ <meta name="robots" content="noindex">
+ <style>
+ html, body {
+ background: transparent !important;
+ margin: 0; padding: 0;
+ font-family: 'Helvetica Neue', 'Helvetica Neue', Arial, sans-serif;
+ color: #161616;
+ }
+ .wrap { background: transparent; padding: 32px 24px; }
+ .eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: #0f62fe; margin-bottom: 6px; }
+ .title { font-size: clamp(22px,3vw,30px); font-weight: 300; color: #161616; margin: 0 0 8px; }
+ .title strong { font-weight: 600; }
+ .sub { font-size: 14px; color: #525252; line-height: 1.5; max-width: 520px; margin-bottom: 24px; }
+
+ /* Walk embed container */
+ .walk-frame {
+ border: 1px solid #e0e0e0;
+ position: relative;
+ overflow: hidden;
+ margin-bottom: 24px;
+ height: 380px;
+ background: transparent;
+ }
+ .walk-frame iframe {
+ width: 100%;
+ height: 100%;
+ border: none;
+ display: block;
+ background: transparent;
+ }
+
+ /* Feature grid */
+ .features { display: grid; grid-template-columns: repeat(3,1fr); gap: 1px; background: #e0e0e0; margin-bottom: 24px; }
+ .feat { background: transparent; padding: 16px 18px; }
+ .feat-head { font-size: 13px; font-weight: 600; color: #161616; margin-bottom: 4px; }
+ .feat-desc { font-size: 12px; color: #525252; line-height: 1.4; }
+
+ .cta-row { display: flex; gap: 12px; flex-wrap: wrap; }
+ .btn-primary { display: inline-flex; align-items: center; gap: 8px; background: #0f62fe; color: #fff; border: none; padding: 12px 20px; font-size: 13px; font-weight: 500; font-family: inherit; cursor: pointer; text-decoration: none; transition: background 0.12s; }
+ .btn-primary:hover { background: #0353e9; color: #fff; text-decoration: none; }
+ .btn-ghost { display: inline-flex; align-items: center; gap: 8px; background: transparent; color: #0f62fe; border: 1px solid #0f62fe; padding: 12px 20px; font-size: 13px; font-weight: 500; font-family: inherit; cursor: pointer; text-decoration: none; transition: background 0.12s; }
+ .btn-ghost:hover { background: #0f62fe; color: #fff; text-decoration: none; }
+
+ @media (max-width: 600px) {
+ .features { grid-template-columns: 1fr; }
+ }
+ </style>
+</head>
+<body style="background:transparent">
+ <div class="wrap">
+ <div class="eyebrow">three.ws · Walk Mode</div>
+ <h1 class="title">Your agent,<br><strong>walking on any page.</strong></h1>
+ <p class="sub">Drop a walking 3D avatar on any website with one script tag. Powered by the three.ws Walk Embed SDK.</p>
+
+ <!-- Live walk embed from three.ws -->
+ <div class="walk-frame">
+ <iframe
+ src="https://three.ws/walk-embed?avatar=default&env=studio&controls=false"
+ allowtransparency="true"
+ allow="autoplay"
+ title="three.ws Walk Mode"
+ ></iframe>
+ </div>
+
+ <div class="features">
+ <div class="feat">
+ <div class="feat-head">One script tag</div>
+ <div class="feat-desc">Paste a single &lt;script&gt; tag onto any website. The walking avatar appears immediately.</div>
+ </div>
+ <div class="feat">
+ <div class="feat-head">Any avatar</div>
+ <div class="feat-desc">Pass any three.ws avatar UUID. Use a selfie-generated avatar as your agent's presence.</div>
+ </div>
+ <div class="feat">
+ <div class="feat-head">Fully animated</div>
+ <div class="feat-desc">Idle, walk, and gesture animations driven by real-time Three.js. 60fps on any modern browser.</div>
+ </div>
+ </div>
+
+ <div class="cta-row">
+ <a href="https://three.ws/walk" target="_blank" class="btn-primary">Open Walk Mode →</a>
+ <a href="https://three.ws/docs/embed" target="_blank" class="btn-ghost">Embed docs</a>
+ </div>
+ </div>
+</body>
+</html>
diff --git a/public/features.json b/public/features.json
index e7867f406..24483015c 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-13T10:02:14.397Z",
+ "generated_at": "2026-06-13T14:19:18.098Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
@@ -55,6 +55,16 @@
"tags": [],
"showcase": false
},
+ {
+ "path": "/irl",
+ "title": "IRL",
+ "description": "Place a 3D avatar in your real environment. Camera AR passthrough, joystick movement, and tap-to-place 3D objects on your floor.",
+ "added": "2026-06-13",
+ "auth": null,
+ "indexable": true,
+ "tags": [],
+ "showcase": false
+ },
{
"path": "/marketplace",
"title": "Marketplace",
diff --git a/public/llms-full.txt b/public/llms-full.txt
index 69a29a446..9932dce47 100644
--- a/public/llms-full.txt
+++ b/public/llms-full.txt
@@ -37,6 +37,12 @@ URL: https://three.ws/walk
Drive a 3D avatar around with a joystick or WASD — toggle the back camera for AR-style passthrough.
+### IRL
+
+URL: https://three.ws/irl
+
+Place a 3D avatar in your real environment. Camera AR passthrough, joystick movement, and tap-to-place 3D objects on your floor.
+
### Marketplace
URL: https://three.ws/marketplace
diff --git a/public/llms.txt b/public/llms.txt
index d63553957..edb9d070e 100644
--- a/public/llms.txt
+++ b/public/llms.txt
@@ -15,6 +15,7 @@ Entry points into the product.
- [Discover](https://three.ws/discover): On-chain agent directory (ERC-8004 + Solana). Browse, search, and inspect every registered agent.
- [Avatar Gallery](https://three.ws/gallery): Every public 3D avatar in the system, browsable as a grid.
- [Walk](https://three.ws/walk): Drive a 3D avatar around with a joystick or WASD — toggle the back camera for AR-style passthrough.
+- [IRL](https://three.ws/irl): Place a 3D avatar in your real environment. Camera AR passthrough, joystick movement, and tap-to-place 3D objects on your floor.
- [Marketplace](https://three.ws/marketplace): Buy access to agents, skills, and avatars from other creators.
- [Skills Marketplace](https://three.ws/skills): Browse, search, and install agent skills — tool packs, knowledge bases, and capabilities that make AI agents smarter.
- [Community](https://three.ws/community): Featured creators, builds, and conversations from the three.ws community.
diff --git a/public/nav-data.js b/public/nav-data.js
index 8a42272b2..e8dfbfb19 100644
--- a/public/nav-data.js
+++ b/public/nav-data.js
@@ -233,6 +233,7 @@ export const NAV_GROUPS = [
{ title: 'Mocap Studio', href: '/mocap-studio', desc: 'Record face → save clip → replay' },
{ title: 'OBS Overlay', href: '/overlay-control', desc: 'Stream deck — emote hotkeys, mic' },
{ title: 'Walk', href: '/walk', desc: 'Walk your avatar — multiplayer + AR' },
+ { title: 'IRL', href: '/irl', desc: 'AR camera + joystick + tap-to-place objects' },
{ title: 'XR', href: '/xr', desc: 'Place your avatar in the real world' },
],
},
diff --git a/public/sitemap/index.html b/public/sitemap/index.html
index e3e38946b..92c129764 100644
--- a/public/sitemap/index.html
+++ b/public/sitemap/index.html
@@ -65,7 +65,7 @@
<main class="sm-wrap">
<div class="sm-hero">
<h1>Sitemap</h1>
- <p>All 266 pages on three.ws, grouped by purpose. Looking for the machine-readable versions?</p>
+ <p>All 267 pages on three.ws, grouped by purpose. Looking for the machine-readable versions?</p>
<div class="sm-formats">
<a href="/sitemap.xml"><code>sitemap.xml</code> · for search engines</a>
<a href="/llms.txt"><code>llms.txt</code> · for AI agents</a>
@@ -77,7 +77,7 @@
</div>
<div class="sm-filter">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m21 21-4.3-4.3"/></svg>
- <input id="sm-filter-input" type="search" placeholder="Filter 266 pages by name, path, or description…" aria-label="Filter pages" autocomplete="off" spellcheck="false" />
+ <input id="sm-filter-input" type="search" placeholder="Filter 267 pages by name, path, or description…" aria-label="Filter pages" autocomplete="off" spellcheck="false" />
<kbd aria-hidden="true">/</kbd>
</div>
<p class="sm-filter-count" id="sm-filter-count" role="status" aria-live="polite"></p>
@@ -97,7 +97,7 @@
</nav>
<section class="sm-section" id="main">
<header>
- <h2>Main<span class="sm-count" data-count>10</span></h2>
+ <h2>Main<span class="sm-count" data-count>11</span></h2>
<p class="sm-section-desc">Entry points into the product.</p>
</header>
<ul class="sm-list">
@@ -129,6 +129,13 @@
<span class="sm-desc">Drive a 3D avatar around with a joystick or WASD — toggle the back camera for AR-style passthrough.</span>
</a>
</li>
+ <li>
+ <a href="/irl">
+ <span class="sm-title">IRL</span>
+ <span class="sm-path">/irl</span>
+ <span class="sm-desc">Place a 3D avatar in your real environment. Camera AR passthrough, joystick movement, and tap-to-place 3D objects on your floor.</span>
+ </a>
+ </li>
<li>
<a href="/marketplace">
<span class="sm-title">Marketplace</span>
diff --git a/scripts/pose-scene-handoff-smoke.mjs b/scripts/pose-scene-handoff-smoke.mjs
new file mode 100644
index 000000000..b7c94f5c6
--- /dev/null
+++ b/scripts/pose-scene-handoff-smoke.mjs
@@ -0,0 +1,76 @@
+// Smoke test: /pose "Record in Scene →" hands a baked animation to /scene,
+// which loads it as a recordable object with a play script. Run against a dev
+// server: node scripts/pose-scene-handoff-smoke.mjs [baseUrl]
+import { chromium } from 'playwright';
+
+const BASE = process.argv[2] || 'http://localhost:3199';
+const errors = [];
+let exitCode = 0;
+const fail = (m) => { errors.push(m); exitCode = 1; console.error('✗', m); };
+const ok = (m) => console.log('✓', m);
+
+const browser = await chromium.launch();
+const ctx = await browser.newContext();
+const page = await ctx.newPage();
+page.on('console', (m) => { if (m.type() === 'error') errors.push('console: ' + m.text()); });
+page.on('pageerror', (e) => fail('pageerror: ' + e.message));
+
+try {
+ await page.goto(`${BASE}/pose`, { waitUntil: 'networkidle' });
+
+ const btn = page.locator('#tl-open-scene');
+ await btn.waitFor({ state: 'attached', timeout: 15000 });
+ await page.waitForTimeout(1500); // let the studio boot + wire handlers
+
+ if (await btn.isDisabled()) ok('button disabled with no keyframes');
+ else fail('button should be disabled before any keyframe');
+
+ // Drop two keyframes at different times so the clip actually moves.
+ await page.locator('#tl-add-key').click();
+ await page.locator('#tl-end').click(); // jump playhead to the end
+ // Nudge a bone so the end pose differs, then key it.
+ await page.locator('#tl-add-key').click();
+
+ if (await btn.isEnabled()) ok('button enabled after keyframes');
+ else fail('button still disabled after adding keyframes');
+
+ // Click → should bake, stash the handoff, and navigate to /scene?handoff=1.
+ await Promise.all([
+ page.waitForURL(/\/scene/, { timeout: 30000 }),
+ btn.click(),
+ ]);
+ ok('navigated to /scene after handoff');
+
+ // Scene Studio boots and consumes the handoff: an object appears in the
+ // outliner and the animation panel reveals its track.
+ await page.waitForSelector('#studio-app', { timeout: 20000 });
+ await page.waitForFunction(() => {
+ const ed = window.editor;
+ if (!ed || !ed.scene) return false;
+ const obj = ed.scene.children.find((c) => c.animations && c.animations.length > 0);
+ return !!obj;
+ }, { timeout: 25000 });
+ ok('scene loaded an object carrying an animation clip');
+
+ const scriptAttached = await page.evaluate(() => {
+ const ed = window.editor;
+ const obj = ed.scene.children.find((c) => c.animations && c.animations.length > 0);
+ const scripts = ed.scripts[obj.uuid] || [];
+ return scripts.some((s) => /AnimationMixer/.test(s.source));
+ });
+ if (scriptAttached) ok('play script attached (recording will animate)');
+ else fail('no play script attached — Render ▸ Video would record a static frame');
+
+ // URL query was stripped so a reload does not re-import.
+ const url = page.url();
+ if (!/handoff=1/.test(url)) ok('handoff query stripped from URL');
+ else fail('handoff query left in URL');
+} catch (e) {
+ fail('exception: ' + e.message);
+} finally {
+ const realErrors = errors.filter((e) => e.startsWith('console:') || e.startsWith('pageerror:'));
+ if (realErrors.length) { console.error('\nPage errors:'); realErrors.forEach((e) => console.error(' ' + e)); }
+ await browser.close();
+ console.log(exitCode === 0 ? '\nPASS' : '\nFAIL');
+ process.exit(exitCode);
+}
diff --git a/src/forge-refine.js b/src/forge-refine.js
new file mode 100644
index 000000000..fab42c20a
--- /dev/null
+++ b/src/forge-refine.js
@@ -0,0 +1,419 @@
+// Refine — local, instant mesh refinement layered onto the forge result viewer.
+//
+// Unlike Stylize (/api/forge-stylize) and Optimize (/api/forge-remesh), which
+// dispatch jobs to GPU workers, Refine runs entirely in the browser: it parses
+// the current GLB with three's GLTFLoader, runs deterministic geometry passes
+// (weld / smooth normals / Laplacian relax / decimate / subdivide) from
+// shared/mesh-refine.js, re-exports with GLTFExporter, and swaps the live
+// <model-viewer> to the result. No worker, no API call, no rate limit — so it
+// works on every deployment and never 429s, which makes it the dependable
+// "improve this model" path when the paid generation lane is throttled.
+//
+// Non-destructive: the original GLB bytes are kept and every preset re-parses
+// from them, so applying a different preset (or reverting) is always clean.
+// Nothing fakes progress — the only timer is an honest elapsed counter, and the
+// geometry work is real synchronous compute behind a busy indicator.
+
+import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
+import { GLTFExporter } from 'three/addons/exporters/GLTFExporter.js';
+import { refineScene, REFINE_PRESETS, REFINE_PRESET_BY_KEY, specForPreset } from './shared/mesh-refine.js';
+
+const resultPanel = document.getElementById('state-result');
+const viewer = document.getElementById('viewer');
+
+if (resultPanel && viewer) {
+ // Reuse the forge anonymous client id (set by forge.js) for the source fetch,
+ // so a refine on a first-party CDN URL is attributed consistently. Harmless
+ // if absent; blob: sources ignore it entirely.
+ const CLIENT_HEADERS = (() => {
+ try {
+ const id = localStorage.getItem('forge:cid');
+ return id ? { 'x-forge-client': id } : {};
+ } catch {
+ return {};
+ }
+ })();
+
+ injectStyles();
+ const { panel, gallery, controls, slider, sliderLabel, sliderVal, applyBtn, downloadBtn, revertBtn, stats, status } =
+ injectPanel();
+
+ const loader = new GLTFLoader();
+ const exporter = new GLTFExporter();
+
+ let sourceUrl = ''; // the GLB this panel is refining (the forge result)
+ let sourceBytes = null; // ArrayBuffer of the original, kept for non-destructive re-runs
+ let lastRefinedUrl = ''; // object URL we swapped in; lets the src observer skip our own swap
+ let baseLabel = '';
+ let activeKey = '';
+ let runToken = 0; // bumped per apply/revert/new-source to abort stale work
+ let elapsedTimer = null;
+ let loadingBytes = false;
+
+ const nextFrame = () => new Promise((r) => requestAnimationFrame(() => r()));
+
+ function setStatus(text, kind = '') {
+ status.textContent = text || '';
+ status.dataset.kind = kind;
+ }
+
+ function stopElapsed() {
+ if (elapsedTimer) {
+ clearInterval(elapsedTimer);
+ elapsedTimer = null;
+ }
+ }
+
+ function startElapsed(label) {
+ stopElapsed();
+ const t0 = performance.now();
+ const tick = () => setStatus(`${label} — ${Math.floor((performance.now() - t0) / 1000)}s`, 'busy');
+ tick();
+ elapsedTimer = setInterval(tick, 1000);
+ }
+
+ function setBusy(busy) {
+ for (const card of gallery.querySelectorAll('.refine-card')) card.disabled = busy;
+ applyBtn.disabled = busy;
+ slider.disabled = busy;
+ revertBtn.disabled = busy;
+ panel.dataset.busy = busy ? 'true' : 'false';
+ }
+
+ function buildGallery() {
+ gallery.innerHTML = '';
+ for (const p of REFINE_PRESETS) {
+ const card = document.createElement('button');
+ card.type = 'button';
+ card.className = 'refine-card';
+ card.dataset.preset = p.key;
+ card.setAttribute('aria-pressed', 'false');
+ card.title = p.blurb;
+ card.innerHTML =
+ `<span class="refine-thumb" aria-hidden="true">${p.icon}</span>` +
+ `<span class="refine-name">${p.name}</span>` +
+ `<span class="refine-blurb">${p.blurb}</span>`;
+ card.addEventListener('click', () => selectPreset(p.key, { apply: true }));
+ gallery.appendChild(card);
+ }
+ }
+
+ function markActive(key) {
+ activeKey = key;
+ for (const card of gallery.querySelectorAll('.refine-card')) {
+ card.setAttribute('aria-pressed', String(card.dataset.preset === key));
+ }
+ }
+
+ function syncSlider(key) {
+ const spec = REFINE_PRESET_BY_KEY[key]?.slider;
+ if (!spec) {
+ controls.classList.add('no-slider');
+ slider.disabled = true;
+ sliderLabel.textContent = '';
+ sliderVal.textContent = '';
+ return;
+ }
+ controls.classList.remove('no-slider');
+ slider.disabled = false;
+ slider.min = String(spec.min);
+ slider.max = String(spec.max);
+ slider.step = '1';
+ slider.value = String(spec.def);
+ sliderLabel.textContent = spec.label;
+ sliderVal.textContent = `${spec.def}${spec.unit || ''}`;
+ }
+
+ function selectPreset(key, { apply }) {
+ if (!REFINE_PRESET_BY_KEY[key]) return;
+ markActive(key);
+ syncSlider(key);
+ controls.classList.remove('is-hidden');
+ if (apply) runRefine(key, Number(slider.value));
+ }
+
+ // Parse → refine → export, fully client-side. token guards against a newer
+ // run (or a new source model) superseding this one mid-flight.
+ async function runRefine(key, sliderValue) {
+ if (!sourceUrl) return;
+ const token = ++runToken;
+ const preset = REFINE_PRESET_BY_KEY[key];
+ const spec = specForPreset(key, sliderValue);
+ setBusy(true);
+ startElapsed(`Refining — ${preset.name}`);
+ try {
+ const bytes = await ensureSourceBytes();
+ if (token !== runToken) return;
+ if (!bytes) throw new Error('Could not read the model to refine.');
+
+ await nextFrame(); // let the busy indicator paint before the sync work
+ const gltf = await parseGlb(bytes);
+ if (token !== runToken) return;
+
+ await nextFrame();
+ const { before, after } = refineScene(gltf.scene, spec);
+
+ const glb = await exportGlb(gltf.scene);
+ if (token !== runToken) return;
+
+ const blob = new Blob([glb], { type: 'model/gltf-binary' });
+ const url = URL.createObjectURL(blob);
+ swapViewer(url, `${baseLabel} — ${preset.name} refine`);
+
+ downloadBtn.href = url;
+ downloadBtn.setAttribute('download', `${slugLabel()}-${key}.glb`);
+ downloadBtn.hidden = false;
+ revertBtn.hidden = false;
+
+ stopElapsed();
+ renderStats(before, after, blob.size);
+ setStatus(`${preset.name} applied — instant, on-device. Adjust and re-apply, or revert.`, 'done');
+ } catch (err) {
+ if (token !== runToken) return;
+ stopElapsed();
+ setBusy(false);
+ setStatus(err?.message || 'Refinement failed. Try a different preset.', 'error');
+ return;
+ }
+ if (token === runToken) setBusy(false);
+ }
+
+ function renderStats(before, after, byteSize) {
+ const dTri = after.triangles - before.triangles;
+ const pct = before.triangles > 0 ? Math.round((dTri / before.triangles) * 100) : 0;
+ const arrow = dTri === 0 ? '·' : dTri > 0 ? '▲' : '▼';
+ const triLine = `${fmt(before.triangles)} → ${fmt(after.triangles)} tris ${arrow}${pct ? ` ${Math.abs(pct)}%` : ''}`;
+ stats.innerHTML =
+ `<span class="refine-stat">${triLine}</span>` +
+ `<span class="refine-stat">${fmt(after.vertices)} verts</span>` +
+ `<span class="refine-stat">${fmtBytes(byteSize)}</span>`;
+ stats.hidden = false;
+ }
+
+ function swapViewer(url, alt) {
+ if (lastRefinedUrl && lastRefinedUrl !== sourceUrl) URL.revokeObjectURL(lastRefinedUrl);
+ lastRefinedUrl = url;
+ viewer.setAttribute('src', url);
+ viewer.setAttribute('alt', alt);
+ }
+
+ function revert() {
+ runToken++; // abort any in-flight refine
+ stopElapsed();
+ setBusy(false);
+ if (lastRefinedUrl && lastRefinedUrl !== sourceUrl) {
+ URL.revokeObjectURL(lastRefinedUrl);
+ lastRefinedUrl = '';
+ }
+ viewer.setAttribute('src', sourceUrl);
+ viewer.setAttribute('alt', baseLabel || '3D model');
+ downloadBtn.hidden = true;
+ revertBtn.hidden = true;
+ stats.hidden = true;
+ markActive('');
+ setStatus('Showing the original model.', '');
+ }
+
+ // Fetch the source bytes once and cache them, so re-applying a preset or
+ // switching presets never re-downloads. Both first-party URLs and blob: URLs
+ // (a chained result from Stylize/Optimize) are fetchable here.
+ async function ensureSourceBytes() {
+ if (sourceBytes) return sourceBytes;
+ if (loadingBytes) {
+ // A concurrent call is already fetching — wait for it.
+ while (loadingBytes) await new Promise((r) => setTimeout(r, 30));
+ return sourceBytes;
+ }
+ loadingBytes = true;
+ try {
+ const res = await fetch(sourceUrl, { headers: CLIENT_HEADERS });
+ if (!res.ok) throw new Error(`Couldn't load the model (${res.status}).`);
+ sourceBytes = await res.arrayBuffer();
+ return sourceBytes;
+ } finally {
+ loadingBytes = false;
+ }
+ }
+
+ function parseGlb(arrayBuffer) {
+ // Parse a *copy* of the buffer: GLTFLoader.parse can detach/consume the
+ // ArrayBuffer, and we keep the original for every subsequent re-run.
+ const copy = arrayBuffer.slice(0);
+ return new Promise((resolve, reject) => {
+ loader.parse(copy, '', resolve, reject);
+ });
+ }
+
+ function exportGlb(scene) {
+ return new Promise((resolve, reject) => {
+ exporter.parse(scene, resolve, reject, { binary: true });
+ });
+ }
+
+ function slugLabel() {
+ return (baseLabel || 'forge').replace(/[^a-z0-9]+/gi, '-').slice(0, 40).replace(/^-|-$/g, '') || 'forge';
+ }
+
+ // A new source model became available — reset to the idle gallery for it.
+ // Idempotent: re-firing with the current source (or our own refined swap) is
+ // a no-op so the event and the src observer can both call it safely.
+ function onNewSource(url, label) {
+ if (!url || url === sourceUrl || url === lastRefinedUrl) return;
+ runToken++;
+ stopElapsed();
+ sourceUrl = url;
+ sourceBytes = null;
+ lastRefinedUrl = '';
+ baseLabel = label || '';
+ markActive('');
+ controls.classList.add('is-hidden');
+ downloadBtn.hidden = true;
+ revertBtn.hidden = true;
+ stats.hidden = true;
+ setBusy(false);
+ setStatus('Pick a refinement to perfect this model — instant, on-device, unlimited.', '');
+ panel.hidden = false;
+ }
+
+ // Wiring -------------------------------------------------------------------
+ slider.addEventListener('input', () => {
+ const spec = REFINE_PRESET_BY_KEY[activeKey]?.slider;
+ sliderVal.textContent = `${slider.value}${spec?.unit || ''}`;
+ });
+ // Re-apply only when the user releases the slider, so dragging doesn't fire a
+ // parse+export on every integer step.
+ slider.addEventListener('change', () => {
+ if (activeKey) runRefine(activeKey, Number(slider.value));
+ });
+ applyBtn.addEventListener('click', () => {
+ if (activeKey) runRefine(activeKey, Number(slider.value));
+ });
+ revertBtn.addEventListener('click', revert);
+
+ document.addEventListener('forge:model-ready', (e) => {
+ onNewSource(e.detail?.glbUrl, e.detail?.label);
+ });
+
+ // External request (e.g. the rate-limit error CTA in forge.js) to surface and
+ // focus this panel so the user can refine locally instead of waiting.
+ document.addEventListener('forge:refine-here', () => {
+ if (!sourceUrl) return;
+ panel.hidden = false;
+ panel.scrollIntoView({ behavior: 'smooth', block: 'center' });
+ gallery.querySelector('.refine-card')?.focus();
+ });
+
+ // Resilient fallback: watch the viewer src so the panel reveals on any model
+ // load, even without the explicit event. Our own swaps are ignored.
+ const srcObserver = new MutationObserver(() => {
+ const url = viewer.getAttribute('src');
+ if (!url || url === sourceUrl || url === lastRefinedUrl) return;
+ onNewSource(url, document.getElementById('result-label')?.textContent?.trim() || '');
+ });
+ srcObserver.observe(viewer, { attributes: true, attributeFilter: ['src'] });
+
+ if (viewer.getAttribute('src')) {
+ onNewSource(viewer.getAttribute('src'), document.getElementById('result-label')?.textContent?.trim() || '');
+ }
+
+ buildGallery();
+
+ // ── markup + styles (self-contained so the panel survives template edits) ──
+
+ function injectPanel() {
+ const el = document.createElement('div');
+ el.className = 'refine-panel';
+ el.id = 'refine-panel';
+ el.dataset.busy = 'false';
+ el.hidden = true;
+ el.innerHTML = `
+ <div class="refine-head">
+ <h3>Refine <span class="refine-badge">Instant · on-device · free</span></h3>
+ <p class="refine-sub">
+ Perfect the model you already have — no re-generation, no waiting, no limits.
+ Every preset runs in your browser on the live mesh.
+ </p>
+ </div>
+ <div class="refine-gallery" id="refine-gallery" role="group" aria-label="Refinement presets"></div>
+ <div class="refine-controls is-hidden" id="refine-controls">
+ <div class="refine-slider">
+ <label id="refine-slider-label" for="refine-slider"></label>
+ <input type="range" id="refine-slider" min="1" max="8" value="3" />
+ <output id="refine-slider-val" for="refine-slider"></output>
+ </div>
+ <div class="refine-actions">
+ <button class="btn btn-ghost" type="button" id="refine-apply">Re-apply</button>
+ <a class="btn btn-ghost" id="refine-download" download hidden>Download refined GLB</a>
+ <button class="btn btn-ghost" type="button" id="refine-revert" hidden>Revert to original</button>
+ </div>
+ </div>
+ <div class="refine-stats" id="refine-stats" hidden></div>
+ <div class="refine-status" id="refine-status" role="status" aria-live="polite"></div>
+ `;
+ // Place directly after the Stylize panel when present, else at panel end,
+ // so the three "improve this model" surfaces sit together.
+ const anchor = document.getElementById('stylize-panel');
+ if (anchor && anchor.parentElement === resultPanel) anchor.after(el);
+ else resultPanel.appendChild(el);
+ return {
+ panel: el,
+ gallery: el.querySelector('#refine-gallery'),
+ controls: el.querySelector('#refine-controls'),
+ slider: el.querySelector('#refine-slider'),
+ sliderLabel: el.querySelector('#refine-slider-label'),
+ sliderVal: el.querySelector('#refine-slider-val'),
+ applyBtn: el.querySelector('#refine-apply'),
+ downloadBtn: el.querySelector('#refine-download'),
+ revertBtn: el.querySelector('#refine-revert'),
+ stats: el.querySelector('#refine-stats'),
+ status: el.querySelector('#refine-status'),
+ };
+ }
+
+ function injectStyles() {
+ if (document.getElementById('refine-panel-styles')) return;
+ const style = document.createElement('style');
+ style.id = 'refine-panel-styles';
+ style.textContent = `
+ .refine-panel { margin-top: var(--space-lg, 24px); padding-top: var(--space-md, 16px); border-top: 1px solid var(--stroke, rgba(255,255,255,.08)); }
+ .refine-head h3 { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin:0 0 4px; font-family: var(--font-display, inherit); font-size: var(--text-lg, 1.1rem); color: var(--ink, #fff); }
+ .refine-badge { font-family: var(--font-mono, monospace); font-size: 10px; letter-spacing:.04em; text-transform:uppercase; color: var(--accent, #7c9cff); background: var(--accent-soft, rgba(124,156,255,.12)); border:1px solid var(--stroke, rgba(255,255,255,.1)); border-radius: 999px; padding: 2px 8px; }
+ .refine-sub { margin:0 0 var(--space-md,16px); font-size: var(--text-sm, .85rem); color: var(--ink-dim, #9aa); line-height: var(--leading-normal, 1.5); max-width: 56ch; }
+ .refine-gallery { display:grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-sm, 10px); }
+ .refine-card { display:flex; flex-direction:column; align-items:flex-start; gap:4px; text-align:left; padding: var(--space-sm,10px) var(--space-md,14px); background: var(--surface-1, rgba(255,255,255,.03)); border:1px solid var(--stroke, rgba(255,255,255,.1)); border-radius: var(--radius-md, 10px); color: var(--ink, #fff); cursor:pointer; transition: border-color .15s, background .15s, transform .1s; }
+ .refine-card:hover { border-color: var(--stroke-strong, rgba(255,255,255,.25)); background: var(--surface-2, rgba(255,255,255,.05)); }
+ .refine-card:active { transform: translateY(1px); }
+ .refine-card:focus-visible { outline: 2px solid var(--accent, #7c9cff); outline-offset: 2px; }
+ .refine-card[aria-pressed="true"] { border-color: var(--accent, #7c9cff); background: var(--accent-soft, rgba(124,156,255,.12)); }
+ .refine-card:disabled { opacity:.5; cursor: progress; }
+ .refine-thumb { font-size: 18px; line-height:1; color: var(--accent, #7c9cff); }
+ .refine-name { font-weight:600; font-size: var(--text-sm, .9rem); }
+ .refine-blurb { font-size: var(--text-xs, .72rem); color: var(--ink-dim, #9aa); line-height:1.4; }
+ .refine-controls { margin-top: var(--space-md,16px); display:flex; flex-direction:column; gap: var(--space-sm,10px); }
+ .refine-controls.no-slider .refine-slider { display:none; }
+ .refine-slider { display:flex; align-items:center; gap: var(--space-sm,10px); }
+ .refine-slider label { font-size: var(--text-xs,.72rem); color: var(--ink-dim,#9aa); min-width: 110px; }
+ .refine-slider input[type=range] { flex:1; accent-color: var(--accent, #7c9cff); }
+ .refine-slider output { font-family: var(--font-mono, monospace); font-size: var(--text-xs,.72rem); color: var(--ink,#fff); min-width: 40px; text-align:right; }
+ .refine-actions { display:flex; flex-wrap:wrap; gap: var(--space-sm,8px); }
+ .refine-stats { display:flex; flex-wrap:wrap; gap: var(--space-sm,10px); margin-top: var(--space-sm,10px); }
+ .refine-stat { font-family: var(--font-mono, monospace); font-size: var(--text-xs,.72rem); color: var(--ink-dim,#9aa); background: var(--surface-1, rgba(255,255,255,.03)); border:1px solid var(--stroke, rgba(255,255,255,.08)); border-radius: var(--radius-sm,6px); padding: 3px 8px; }
+ .refine-status { margin-top: var(--space-sm,10px); font-size: var(--text-xs,.72rem); min-height: 1.2em; color: var(--ink-dim,#9aa); }
+ .refine-status[data-kind="busy"] { color: var(--accent, #7c9cff); }
+ .refine-status[data-kind="done"] { color: var(--success, #5fd38a); }
+ .refine-status[data-kind="error"] { color: var(--danger, #ff6b6b); }
+ @media (prefers-reduced-motion: reduce) { .refine-card { transition: none; } }
+ `;
+ document.head.appendChild(style);
+ }
+
+ function fmt(n) {
+ return Number(n || 0).toLocaleString();
+ }
+ function fmtBytes(b) {
+ if (!b) return '—';
+ if (b < 1024) return `${b} B`;
+ if (b < 1024 * 1024) return `${(b / 1024).toFixed(1)} KB`;
+ return `${(b / (1024 * 1024)).toFixed(2)} MB`;
+ }
+}
diff --git a/src/forge.js b/src/forge.js
index 0eb91a4a1..2ba264bfe 100644
--- a/src/forge.js
+++ b/src/forge.js
@@ -77,6 +77,7 @@ const els = {
viewsPips: document.getElementById('views-pips'),
sketchReqTag: document.getElementById('sketch-req-tag'),
generateAnyway: document.getElementById('generate-anyway'),
+ refineLocally: document.getElementById('refine-locally'),
errorMessage: document.getElementById('error-message'),
forgeShareBtn: document.getElementById('forge-share-btn'),
segmentBtn: document.getElementById('forge-segment-btn'),
@@ -105,6 +106,9 @@ let currentCreationId = null;
// The quality tier the on-screen result was produced at — drives the "Refine"
// affordance, which re-runs the same job exactly one tier higher.
let currentResultTier = null;
+// The GLB currently shown in the viewer (set on every result). Lets the
+// rate-limit state know a model exists to refine locally as a fallback.
+let lastShownGlb = '';
// Quality tiers, lowest → highest. Refine walks one step up this ladder.
const TIER_ORDER = ['draft', 'standard', 'high'];
@@ -1042,11 +1046,25 @@ async function startJob({ prompt, imageUrls, skipValidation }) {
throw e;
}
if (res.status === 429 || data.error === 'rate_limited') {
- const secs = Number(data.retry_after) > 0 ? Math.ceil(Number(data.retry_after)) : 10;
+ const headerReset = Number(res.headers.get('ratelimit-reset'));
+ const secs =
+ Number(data.retry_after) > 0
+ ? Math.ceil(Number(data.retry_after))
+ : headerReset > 0
+ ? Math.ceil(headerReset)
+ : 10;
+ // `rate_limiter_unavailable` means the distributed limiter (Redis) is down
+ // and the paid lane is failing closed — not that the user spent their quota.
+ const unavailable = data.reason === 'rate_limiter_unavailable';
const e = new Error(
- data.message || `The 3D generator is busy. Try again in about ${secs} seconds.`,
+ data.message ||
+ (unavailable
+ ? 'The generator is temporarily unavailable. Refine your current model locally, or try again shortly.'
+ : `You've hit the generation limit. It resets in about ${secs}s.`),
);
e.kind = 'rate_limited';
+ e.retryAfter = secs;
+ e.unavailable = unavailable;
throw e;
}
if (!res.ok) {
@@ -1260,6 +1278,7 @@ function showResult(glbUrl, label, meta, { autoSaved = false } = {}) {
els.viewerShell?.classList.remove('has-load-error');
els.viewer.setAttribute('src', glbUrl);
els.viewer.setAttribute('alt', `3D model: ${label}`);
+ lastShownGlb = glbUrl;
els.resultLabel.textContent = label;
// Hide the saved chip by default; caller re-shows it for fresh generations.
if (els.savedChip) els.savedChip.classList.add('is-hidden');
@@ -1480,13 +1499,68 @@ async function openSharedCreation(shareId) {
function showError(message, { allowOverride = false } = {}) {
stopElapsed();
+ stopRateLimitCountdown();
els.errorMessage.textContent = message;
// The "Generate anyway" affordance only exists for the vision pre-check
// rejection; every other error hides it so it can't leak across states.
if (els.generateAnyway) els.generateAnyway.classList.toggle('is-hidden', !allowOverride);
+ // The local-refine escape hatch belongs only to the rate-limit state.
+ if (els.refineLocally) els.refineLocally.classList.add('is-hidden');
+ if (els.retry) els.retry.disabled = false;
showState('error');
}
+// Rate-limit state: a designed, recoverable treatment for a 429. Instead of a
+// dead-end "busy, try again", we (1) show a live countdown to the reset and
+// re-enable Retry automatically when it elapses, and (2) — when a model is
+// already on screen — offer the local Refine path, which needs no API and never
+// throttles, so the user is never fully blocked. Distinguishes a genuine quota
+// hit from a temporarily-unavailable limiter (Redis degraded → fail-closed).
+let rateLimitTimer = null;
+function stopRateLimitCountdown() {
+ if (rateLimitTimer) {
+ clearInterval(rateLimitTimer);
+ rateLimitTimer = null;
+ }
+}
+
+function showRateLimited({ retryAfter = 10, unavailable = false }) {
+ stopElapsed();
+ stopRateLimitCountdown();
+ if (els.generateAnyway) els.generateAnyway.classList.add('is-hidden');
+
+ // Offer local refinement whenever a model is already loaded — that's exactly
+ // the case after the Refine button 429s, and the one moment the user most
+ // wants to keep improving without waiting on the paid lane.
+ const canRefineLocally = Boolean(lastShownGlb && els.viewer.getAttribute('src'));
+ if (els.refineLocally) els.refineLocally.classList.toggle('is-hidden', !canRefineLocally);
+
+ let remaining = Math.max(1, Math.ceil(retryAfter));
+ const base = unavailable
+ ? 'The generator is temporarily unavailable.'
+ : 'You’ve hit the generation limit.';
+ const tail = canRefineLocally ? ' Or refine your current model now — instant and unlimited.' : '';
+
+ const render = () => {
+ els.errorMessage.textContent =
+ remaining > 0 ? `${base} Retrying is available in ${remaining}s.${tail}` : `${base} You can try again now.${tail}`;
+ };
+ // While counting down, Retry is disabled (it would just 429 again); it
+ // re-enables the moment the window resets.
+ if (els.retry) els.retry.disabled = remaining > 0;
+ render();
+ showState('error');
+
+ rateLimitTimer = setInterval(() => {
+ remaining -= 1;
+ if (remaining <= 0) {
+ stopRateLimitCountdown();
+ if (els.retry) els.retry.disabled = false;
+ }
+ render();
+ }, 1000);
+}
+
// Run a job (text or image/multi-view). `cfg` = { prompt, imageUrls }.
async function run(cfg) {
lastJob = cfg;
@@ -1626,6 +1700,12 @@ async function run(cfg) {
showError(err.message, { allowOverride: true });
return;
}
+ // Rate limited (or the limiter is temporarily unavailable). Designed,
+ // recoverable state with a live countdown + the local-refine escape hatch.
+ if (err.kind === 'rate_limited') {
+ showRateLimited({ retryAfter: err.retryAfter, unavailable: err.unavailable });
+ return;
+ }
showError(
err.message ||
'Something went wrong. Try a simpler, single-subject prompt or cleaner photos.',
@@ -1787,6 +1867,7 @@ els.cancel.addEventListener('click', () => {
});
els.again.addEventListener('click', () => {
+ stopRateLimitCountdown();
if (els.categoryPicker) els.categoryPicker.hidden = true;
showState('empty');
if (mode === 'text') {
@@ -1800,6 +1881,8 @@ els.again.addEventListener('click', () => {
});
els.retry.addEventListener('click', () => {
+ if (els.retry.disabled) return; // mid-countdown; Retry re-enables at reset
+ stopRateLimitCountdown();
if (els.categoryPicker) els.categoryPicker.hidden = true;
if (lastJob && (lastJob.prompt || (lastJob.imageUrls && lastJob.imageUrls.length))) {
run(lastJob);
@@ -1809,6 +1892,15 @@ els.retry.addEventListener('click', () => {
}
});
+// Rate-limit escape hatch: drop straight back to the loaded model and open the
+// local Refine panel — no API, no waiting on the throttled generation lane.
+els.refineLocally?.addEventListener('click', () => {
+ stopRateLimitCountdown();
+ showState('result');
+ els.stage?.scrollIntoView({ behavior: 'smooth', block: 'start' });
+ document.dispatchEvent(new CustomEvent('forge:refine-here'));
+});
+
// Refine — re-run the same prompt/views one quality tier higher. Bumping the
// tier syncs the selector (and the tier's default engine), then replays the
// stored job, so the higher-fidelity model lands in the same viewer.
diff --git a/src/irl.js b/src/irl.js
new file mode 100644
index 000000000..975b40e91
--- /dev/null
+++ b/src/irl.js
@@ -0,0 +1,652 @@
+// src/irl.js — IRL AR playground
+//
+// Full-screen walking avatar + camera AR passthrough + tap-to-place 3D objects.
+// Visual style mirrors /avatars/:id/ar (bottom panel, gradient bg, hero CTA).
+// Walking + joystick from walk-embed. Camera mode makes the real floor the stage.
+
+import {
+ AmbientLight,
+ Box3,
+ BoxGeometry,
+ CircleGeometry,
+ CylinderGeometry,
+ DirectionalLight,
+ Group,
+ HemisphereLight,
+ Mesh,
+ MeshPhysicalMaterial,
+ MeshStandardMaterial,
+ OctahedronGeometry,
+ PCFSoftShadowMap,
+ PerspectiveCamera,
+ PlaneGeometry,
+ PMREMGenerator,
+ Raycaster,
+ Scene,
+ ShadowMaterial,
+ SphereGeometry,
+ Timer,
+ TorusGeometry,
+ Vector2,
+ Vector3,
+ WebGLRenderer,
+} from 'three';
+import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
+import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js';
+import nipplejs from 'nipplejs';
+import { AnimationManager } from './animation-manager.js';
+import { log } from './shared/log.js';
+
+const AVATAR_URL_DEFAULT = '/avatars/default.glb';
+const ANIMATIONS_MANIFEST_URL = '/animations/manifest.json';
+const CLIP_IDLE = 'idle';
+const CLIP_WALK = 'av-walk-feminine';
+const CLIP_RUN = 'av-walk-feminine';
+
+const WALK_SPEED = 1.6;
+const RUN_SPEED = 4.0;
+const NATURAL_WALK_SPEED = 1.5;
+const NATURAL_RUN_SPEED = 3.4;
+const TURN_LERP = 0.18;
+const CAM_LERP = 0.12;
+const LEAN_WALK_RAD = 0.05;
+const LEAN_RUN_RAD = 0.13;
+const LEAN_LERP = 0.12;
+const GROUND_RADIUS = 16;
+const CAM_OFFSET = new Vector3(0, 1.85, 3.6);
+const CAM_LOOK_OFFSET = new Vector3(0, 1.1, 0);
+const SPAWN_DURATION = 0.38; // seconds for placed object scale-up
+const TAP_THRESHOLD = 10; // px — beyond this it's a drag, not a tap
+
+// ── URL params ────────────────────────────────────────────────────────────
+const params = new URLSearchParams(location.search);
+const avatarIdParam = params.get('avatar') || '';
+
+function resolveAvatarUrl(id) {
+ if (!id) return AVATAR_URL_DEFAULT;
+ if (/^https?:\/\//i.test(id) || id.startsWith('/')) return id;
+ return `/api/avatars/${encodeURIComponent(id)}/glb`;
+}
+
+// ── DOM refs ──────────────────────────────────────────────────────────────
+const $ = (id) => document.getElementById(id);
+const canvas = $('irl-canvas');
+const videoEl = $('irl-camera');
+const joystickEl = $('irl-joystick');
+const nameEl = $('irl-avatar-name');
+const subtitleEl = $('irl-subtitle');
+const statusEl = $('irl-status');
+const statusTxt = $('irl-status-text');
+const spinner = $('irl-spinner');
+const cameraBtn = $('irl-camera-btn');
+const cameraLabel = $('irl-camera-label');
+const placeBtn = $('irl-place-btn');
+const clearBtn = $('irl-clear-btn');
+const pickerEl = $('irl-picker');
+
+// ── Status helpers ────────────────────────────────────────────────────────
+function setStatus(msg, { error = false, loading = false, sticky = false } = {}) {
+ clearTimeout(setStatus._t);
+ if (!msg) { statusEl.classList.add('is-hidden'); return; }
+ statusTxt.textContent = msg;
+ statusEl.classList.remove('is-hidden');
+ statusEl.classList.toggle('is-error', error);
+ spinner.classList.toggle('hidden', !loading);
+ if (!sticky) setStatus._t = setTimeout(() => statusEl.classList.add('is-hidden'), 3000);
+}
+
+// ── Renderer / scene ──────────────────────────────────────────────────────
+const renderer = new WebGLRenderer({ canvas, antialias: true, alpha: true });
+renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
+renderer.setSize(window.innerWidth, window.innerHeight, false);
+renderer.setClearColor(0x000000, 0);
+renderer.shadowMap.enabled = true;
+renderer.shadowMap.type = PCFSoftShadowMap;
+
+const scene = new Scene();
+const pmrem = new PMREMGenerator(renderer);
+scene.environment = pmrem.fromScene(new RoomEnvironment(), 0.04).texture;
+
+const ambientLight = new AmbientLight(0xffffff, 0.55);
+scene.add(ambientLight);
+const hemi = new HemisphereLight(0xbcd6ff, 0x202830, 0.6);
+hemi.position.set(0, 5, 0);
+scene.add(hemi);
+const sun = new DirectionalLight(0xffffff, 1.4);
+sun.position.set(4, 8, 6);
+sun.castShadow = true;
+sun.shadow.mapSize.set(1024, 1024);
+sun.shadow.camera.near = 0.5;
+sun.shadow.camera.far = 32;
+sun.shadow.camera.left = -12;
+sun.shadow.camera.right = 12;
+sun.shadow.camera.top = 12;
+sun.shadow.camera.bottom = -12;
+sun.shadow.bias = -0.0005;
+scene.add(sun);
+
+// ── Ground ────────────────────────────────────────────────────────────────
+const groundOpaque = new Mesh(
+ new CircleGeometry(GROUND_RADIUS, 64),
+ new MeshStandardMaterial({ color: 0x121820, roughness: 0.95, metalness: 0.0 }),
+);
+groundOpaque.rotation.x = -Math.PI / 2;
+groundOpaque.receiveShadow = true;
+scene.add(groundOpaque);
+
+const groundShadow = new Mesh(
+ new CircleGeometry(GROUND_RADIUS, 64),
+ new ShadowMaterial({ opacity: 0.5 }),
+);
+groundShadow.rotation.x = -Math.PI / 2;
+groundShadow.receiveShadow = true;
+groundShadow.visible = false;
+scene.add(groundShadow);
+
+// Invisible plane at y=0 for raycasting tap-to-place targets
+const rayPlane = new Mesh(
+ new PlaneGeometry(60, 60),
+ new MeshStandardMaterial({ visible: false, side: 2 }),
+);
+rayPlane.rotation.x = -Math.PI / 2;
+rayPlane.position.y = 0.005;
+scene.add(rayPlane);
+
+// ── Camera ────────────────────────────────────────────────────────────────
+const camera = new PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.05, 200);
+const avatarRig = new Group();
+scene.add(avatarRig);
+
+const camDesired = new Vector3();
+const camLookTarget = new Vector3();
+const camLookCurrent = new Vector3();
+let cameraYaw = 0;
+let cameraPitch = 0.05;
+const PITCH_MIN = -0.5;
+const PITCH_MAX = 0.65;
+
+function applyCameraImmediate() {
+ const offset = CAM_OFFSET.clone();
+ offset.applyAxisAngle(new Vector3(1, 0, 0), -cameraPitch);
+ offset.applyAxisAngle(new Vector3(0, 1, 0), cameraYaw);
+ camDesired.copy(avatarRig.position).add(offset);
+ camera.position.copy(camDesired);
+ camLookTarget.copy(avatarRig.position).add(CAM_LOOK_OFFSET);
+ camLookCurrent.copy(camLookTarget);
+ camera.lookAt(camLookCurrent);
+}
+applyCameraImmediate();
+
+// ── AR passthrough ────────────────────────────────────────────────────────
+let arActive = false;
+let mediaStream = null;
+let arFrozenCamPos = null;
+let arFrozenCamLook = null;
+
+async function enableAR() {
+ if (!navigator.mediaDevices?.getUserMedia) {
+ setStatus('Camera API not available in this browser', { error: true, sticky: true });
+ return;
+ }
+ setStatus('Requesting camera…', { loading: true, sticky: true });
+ try {
+ mediaStream = await navigator.mediaDevices.getUserMedia({
+ video: { facingMode: { ideal: 'environment' } },
+ audio: false,
+ });
+ } catch (err) {
+ const msg = err?.name === 'NotAllowedError'
+ ? 'Camera permission denied — allow in browser settings'
+ : `Camera unavailable: ${err?.message ?? err}`;
+ setStatus(msg, { error: true, sticky: true });
+ return;
+ }
+
+ videoEl.srcObject = mediaStream;
+ try { await videoEl.play(); } catch {}
+
+ arActive = true;
+ document.body.classList.add('is-ar');
+ cameraBtn.classList.add('is-active');
+ cameraLabel.textContent = 'Camera On';
+ subtitleEl.textContent = 'Walk your avatar on the real floor';
+ groundOpaque.visible = false;
+ groundShadow.visible = true;
+ renderer.setClearColor(0x000000, 0);
+ scene.background = null;
+
+ // Match Three.js FOV to device rear camera so the avatar's scale agrees
+ // with real-world objects (typically 70–75° diagonal for rear cameras).
+ const track = mediaStream.getVideoTracks()[0];
+ const s = track?.getSettings?.() ?? {};
+ const vw = s.width ?? window.innerWidth;
+ const vh = s.height ?? window.innerHeight;
+ const diagFov = 72;
+ const diagPx = Math.hypot(vw, vh);
+ const hFovRad = 2 * Math.atan((vw / diagPx) * Math.tan((diagFov * Math.PI / 180) / 2));
+ const aspect = window.innerWidth / window.innerHeight;
+ const vFovDeg = (2 * Math.atan(Math.tan(hFovRad / 2) / aspect)) * (180 / Math.PI);
+ camera.fov = Math.max(50, Math.min(90, vFovDeg));
+ camera.updateProjectionMatrix();
+
+ // Freeze camera so the avatar walks through the real room instead of the
+ // follow-camera chasing it (which would shift the real-world background).
+ arFrozenCamPos = camera.position.clone();
+ arFrozenCamLook = camLookCurrent.clone();
+
+ setStatus('Camera on — walk your avatar on the real floor');
+}
+
+function disableAR() {
+ if (mediaStream) {
+ mediaStream.getTracks().forEach(t => { try { t.stop(); } catch {} });
+ mediaStream = null;
+ }
+ videoEl.srcObject = null;
+ arActive = false;
+ document.body.classList.remove('is-ar');
+ cameraBtn.classList.remove('is-active');
+ cameraLabel.textContent = 'Camera AR';
+ subtitleEl.textContent = 'Turn on camera to place in your space';
+ groundOpaque.visible = true;
+ groundShadow.visible = false;
+ camera.fov = 50;
+ camera.updateProjectionMatrix();
+ ambientLight.intensity = 0.55;
+ sun.intensity = 1.4;
+ arFrozenCamPos = null;
+ arFrozenCamLook = null;
+ setStatus('Camera off');
+}
+
+cameraBtn.addEventListener('click', () => {
+ if (arActive) disableAR();
+ else enableAR();
+});
+
+// Disable hero button if camera API is absent
+if (!navigator.mediaDevices?.getUserMedia) {
+ cameraBtn.disabled = true;
+ cameraBtn.setAttribute('aria-disabled', 'true');
+ cameraLabel.textContent = 'Camera unavailable';
+}
+
+// ── Placed objects ────────────────────────────────────────────────────────
+let placeModeActive = false;
+let selectedType = 'orb';
+const placedObjects = []; // { mesh, spawnT }
+
+const OBJ_DEFS = {
+ orb: {
+ create() {
+ const m = new Mesh(
+ new SphereGeometry(0.22, 32, 24),
+ new MeshPhysicalMaterial({
+ color: 0x88bbff,
+ emissive: 0x1a44aa,
+ emissiveIntensity: 0.55,
+ metalness: 0.15,
+ roughness: 0.04,
+ transmission: 0.45,
+ thickness: 0.3,
+ }),
+ );
+ m.castShadow = true;
+ m.position.y = 0.22;
+ return m;
+ },
+ },
+ crate: {
+ create() {
+ const m = new Mesh(
+ new BoxGeometry(0.4, 0.4, 0.4),
+ new MeshStandardMaterial({ color: 0xb07830, roughness: 0.85, metalness: 0.0 }),
+ );
+ m.castShadow = true;
+ m.position.y = 0.2;
+ return m;
+ },
+ },
+ crystal: {
+ create() {
+ const m = new Mesh(
+ new OctahedronGeometry(0.28, 0),
+ new MeshPhysicalMaterial({
+ color: 0xcc77ff,
+ emissive: 0x440066,
+ emissiveIntensity: 0.5,
+ metalness: 0.0,
+ roughness: 0.0,
+ transmission: 0.65,
+ thickness: 0.4,
+ }),
+ );
+ m.castShadow = true;
+ m.position.y = 0.28;
+ return m;
+ },
+ },
+ ring: {
+ create() {
+ const m = new Mesh(
+ new TorusGeometry(0.22, 0.065, 16, 48),
+ new MeshStandardMaterial({ color: 0xffd700, metalness: 0.95, roughness: 0.08 }),
+ );
+ m.castShadow = true;
+ m.rotation.x = Math.PI / 2;
+ m.position.y = 0.065;
+ return m;
+ },
+ },
+ pillar: {
+ create() {
+ const m = new Mesh(
+ new CylinderGeometry(0.1, 0.12, 0.9, 12),
+ new MeshStandardMaterial({ color: 0xd8d0c4, roughness: 0.72, metalness: 0.0 }),
+ );
+ m.castShadow = true;
+ m.position.y = 0.45;
+ return m;
+ },
+ },
+};
+
+// Object picker wiring
+document.querySelectorAll('.irl-obj-btn').forEach(btn => {
+ btn.addEventListener('click', () => {
+ selectedType = btn.dataset.type;
+ document.querySelectorAll('.irl-obj-btn').forEach(b => b.classList.remove('active'));
+ btn.classList.add('active');
+ });
+});
+document.querySelector('.irl-obj-btn[data-type="orb"]')?.classList.add('active');
+
+placeBtn.addEventListener('click', () => {
+ placeModeActive = !placeModeActive;
+ placeBtn.setAttribute('aria-pressed', String(placeModeActive));
+ placeBtn.classList.toggle('is-active', placeModeActive);
+ pickerEl.hidden = !placeModeActive;
+ if (placeModeActive) {
+ canvas.style.cursor = 'crosshair';
+ setStatus('Tap the floor to drop an object');
+ } else {
+ canvas.style.cursor = '';
+ setStatus(null);
+ }
+});
+
+clearBtn.addEventListener('click', () => {
+ for (const obj of placedObjects) scene.remove(obj.mesh);
+ placedObjects.length = 0;
+ clearBtn.hidden = true;
+ setStatus('Objects cleared');
+});
+
+// ── Tap-to-place raycasting ───────────────────────────────────────────────
+const raycaster = new Raycaster();
+const pointerNDC = new Vector2();
+let tapDownX = 0, tapDownY = 0;
+
+canvas.addEventListener('pointerdown', e => { tapDownX = e.clientX; tapDownY = e.clientY; });
+canvas.addEventListener('pointerup', e => {
+ if (!placeModeActive) return;
+ if (Math.hypot(e.clientX - tapDownX, e.clientY - tapDownY) > TAP_THRESHOLD) return;
+
+ pointerNDC.set(
+ (e.clientX / window.innerWidth) * 2 - 1,
+ -(e.clientY / window.innerHeight) * 2 + 1,
+ );
+ raycaster.setFromCamera(pointerNDC, camera);
+ const hits = raycaster.intersectObject(rayPlane);
+ if (!hits.length) return;
+
+ const def = OBJ_DEFS[selectedType];
+ if (!def) return;
+ const mesh = def.create();
+ mesh.position.x = hits[0].point.x;
+ mesh.position.z = hits[0].point.z;
+ mesh.scale.setScalar(0.001);
+ scene.add(mesh);
+ placedObjects.push({ mesh, spawnT: 0 });
+ clearBtn.hidden = false;
+});
+
+// ── Joystick ──────────────────────────────────────────────────────────────
+const input = {
+ joy: { x: 0, y: 0, active: false },
+ keys: { forward: 0, back: 0, left: 0, right: 0, run: false },
+};
+
+nipplejs.create({
+ zone: joystickEl, mode: 'static', position: { left: '50%', top: '50%' },
+ size: 110, color: 'rgba(255,255,255,0.85)', restOpacity: 0.6,
+}).on('move', evt => {
+ const v = evt?.data?.vector;
+ if (v) { input.joy.x = v.x; input.joy.y = v.y; input.joy.active = Math.hypot(v.x, v.y) > 0.05; }
+}).on('end', () => { input.joy.x = 0; input.joy.y = 0; input.joy.active = false; });
+
+window.addEventListener('keydown', e => {
+ switch (e.code) {
+ case 'KeyW': case 'ArrowUp': input.keys.forward = 1; break;
+ case 'KeyS': case 'ArrowDown': input.keys.back = 1; break;
+ case 'KeyA': case 'ArrowLeft': input.keys.left = 1; break;
+ case 'KeyD': case 'ArrowRight': input.keys.right = 1; break;
+ case 'ShiftLeft': case 'ShiftRight': input.keys.run = true; break;
+ }
+});
+window.addEventListener('keyup', e => {
+ switch (e.code) {
+ case 'KeyW': case 'ArrowUp': input.keys.forward = 0; break;
+ case 'KeyS': case 'ArrowDown': input.keys.back = 0; break;
+ case 'KeyA': case 'ArrowLeft': input.keys.left = 0; break;
+ case 'KeyD': case 'ArrowRight': input.keys.right = 0; break;
+ case 'ShiftLeft': case 'ShiftRight': input.keys.run = false; break;
+ }
+});
+
+// ── Drag-to-orbit (disabled in place mode so taps don't orbit) ───────────
+{
+ let dragging = false, lastX = 0, lastY = 0, downId = -1;
+ canvas.addEventListener('pointerdown', e => {
+ if (placeModeActive) return;
+ const r = joystickEl.getBoundingClientRect();
+ if (e.clientX >= r.left && e.clientX <= r.right && e.clientY >= r.top && e.clientY <= r.bottom) return;
+ dragging = true; downId = e.pointerId; lastX = e.clientX; lastY = e.clientY;
+ canvas.setPointerCapture?.(e.pointerId);
+ });
+ const onMove = e => {
+ if (!dragging || e.pointerId !== downId) return;
+ cameraYaw -= (e.clientX - lastX) * 0.005;
+ cameraPitch = Math.max(PITCH_MIN, Math.min(PITCH_MAX, cameraPitch - (e.clientY - lastY) * 0.0035));
+ lastX = e.clientX; lastY = e.clientY;
+ };
+ const onUp = e => {
+ if (e.pointerId !== downId) return;
+ dragging = false; downId = -1;
+ try { canvas.releasePointerCapture?.(e.pointerId); } catch {}
+ };
+ canvas.addEventListener('pointermove', onMove);
+ canvas.addEventListener('pointerup', onUp);
+ canvas.addEventListener('pointercancel', onUp);
+}
+
+// ── Avatar loading ────────────────────────────────────────────────────────
+const animMgr = new AnimationManager();
+let avatar = null, avatarYaw = 0, avatarLean = 0, currentMotion = 'idle';
+
+async function loadAvatar() {
+ // If we have an ID, fetch metadata first to get the name for the bottom panel.
+ let avatarName = 'Your Avatar';
+ let glbUrl = resolveAvatarUrl(avatarIdParam);
+
+ if (avatarIdParam && !/^https?:\/\//.test(avatarIdParam) && !avatarIdParam.startsWith('/')) {
+ try {
+ const res = await fetch(`/api/avatars/${encodeURIComponent(avatarIdParam)}`);
+ if (res.ok) {
+ const { avatar: meta } = await res.json();
+ if (meta?.name) avatarName = meta.name;
+ if (meta?.url) glbUrl = meta.url;
+ }
+ } catch {}
+ }
+
+ nameEl.textContent = avatarName;
+ document.title = `${avatarName} IRL · three.ws`;
+
+ setStatus('Loading avatar…', { loading: true, sticky: true });
+
+ const loader = new GLTFLoader();
+ const gltf = await loader.loadAsync(glbUrl);
+ avatar = gltf.scene;
+ avatar.traverse(n => {
+ if (n.isMesh) {
+ n.castShadow = true;
+ if (n.material?.envMapIntensity !== undefined) n.material.envMapIntensity = 0.85;
+ }
+ });
+ const box = new Box3().setFromObject(avatar);
+ avatar.position.y -= box.min.y;
+ avatarRig.add(avatar);
+
+ const height = Math.max(0.5, box.max.y - box.min.y);
+ CAM_OFFSET.set(0, height * 1.05, height * 1.95);
+ CAM_LOOK_OFFSET.set(0, height * 0.6, 0);
+ applyCameraImmediate();
+
+ animMgr.attach(avatar);
+ const manifest = await fetch(ANIMATIONS_MANIFEST_URL, { cache: 'force-cache' }).then(r => {
+ if (!r.ok) throw new Error(`HTTP ${r.status}`);
+ return r.json();
+ });
+ const needed = manifest.filter(d => [CLIP_IDLE, CLIP_WALK, CLIP_RUN].includes(d.name));
+ if (!needed.length) throw new Error('Animation manifest missing required clips');
+ animMgr.setAnimationDefs(needed);
+ await animMgr.loadAll();
+ await animMgr.crossfadeTo(CLIP_IDLE, 0.0);
+ currentMotion = 'idle';
+
+ // Unlock the camera hero button now that the avatar is ready
+ cameraBtn.disabled = false;
+ cameraBtn.removeAttribute('aria-busy');
+ setStatus(null);
+}
+
+// ── Resize ────────────────────────────────────────────────────────────────
+function resize() {
+ renderer.setSize(window.innerWidth, window.innerHeight, false);
+ camera.aspect = window.innerWidth / window.innerHeight;
+ camera.updateProjectionMatrix();
+}
+window.addEventListener('resize', resize);
+window.addEventListener('orientationchange', resize);
+
+// ── Main loop ─────────────────────────────────────────────────────────────
+const clock = new Timer();
+const moveWorld = new Vector3();
+const moveFwd = new Vector3();
+const moveRight = new Vector3();
+const upY = new Vector3(0, 1, 0);
+
+function lerpAngle(a, b, t) {
+ let diff = ((b - a + Math.PI) % (Math.PI * 2)) - Math.PI;
+ if (diff < -Math.PI) diff += Math.PI * 2;
+ return a + diff * t;
+}
+
+function tick() {
+ clock.update();
+ const dt = Math.min(clock.getDelta(), 0.05);
+ const ix = input.joy.active ? input.joy.x : (input.keys.right - input.keys.left);
+ const iy = input.joy.active ? input.joy.y : (input.keys.forward - input.keys.back);
+ const mag = Math.min(1, Math.hypot(ix, iy));
+ const wantRun = mag > 0.9 || input.keys.run;
+ const speed = mag * (wantRun ? RUN_SPEED : WALK_SPEED);
+
+ if (mag > 0.01 && avatar) {
+ moveFwd.copy(camLookCurrent).sub(camera.position);
+ moveFwd.y = 0;
+ if (moveFwd.lengthSq() < 1e-6) moveFwd.set(0, 0, -1); else moveFwd.normalize();
+ moveRight.crossVectors(moveFwd, upY).normalize();
+
+ moveWorld
+ .set(0, 0, 0)
+ .addScaledVector(moveFwd, iy / Math.max(mag, 1e-6))
+ .addScaledVector(moveRight, ix / Math.max(mag, 1e-6))
+ .normalize()
+ .multiplyScalar(speed * dt);
+
+ avatarRig.position.add(moveWorld);
+ const r = Math.hypot(avatarRig.position.x, avatarRig.position.z);
+ if (r > GROUND_RADIUS - 0.5) {
+ const k = (GROUND_RADIUS - 0.5) / r;
+ avatarRig.position.x *= k;
+ avatarRig.position.z *= k;
+ }
+
+ avatarYaw = lerpAngle(avatarYaw, Math.atan2(moveWorld.x, moveWorld.z), TURN_LERP);
+ avatarRig.quaternion.setFromAxisAngle(upY, avatarYaw);
+
+ const want = wantRun ? 'run' : 'walk';
+ if (currentMotion !== want) {
+ currentMotion = want;
+ animMgr.crossfadeTo(want === 'run' ? CLIP_RUN : CLIP_WALK, 0.18);
+ }
+ } else if (currentMotion !== 'idle' && avatar) {
+ currentMotion = 'idle';
+ animMgr.crossfadeTo(CLIP_IDLE, 0.25);
+ }
+
+ if (animMgr.mixer) {
+ let ts = 1.0;
+ if (currentMotion === 'walk') ts = Math.max(0.45, speed / NATURAL_WALK_SPEED);
+ else if (currentMotion === 'run') ts = Math.max(0.6, speed / NATURAL_RUN_SPEED);
+ animMgr.mixer.timeScale = ts;
+ }
+
+ const targetLean = currentMotion === 'run'
+ ? LEAN_RUN_RAD * mag
+ : currentMotion === 'walk' ? LEAN_WALK_RAD * mag : 0;
+ avatarLean += (targetLean - avatarLean) * LEAN_LERP;
+ if (avatar) avatar.rotation.x = avatarLean;
+
+ // Camera — frozen when AR is active so background stays anchored
+ if (arFrozenCamPos) {
+ camera.position.copy(arFrozenCamPos);
+ camera.lookAt(arFrozenCamLook);
+ } else {
+ const offset = CAM_OFFSET.clone();
+ offset.applyAxisAngle(new Vector3(1, 0, 0), -cameraPitch);
+ offset.applyAxisAngle(upY, cameraYaw);
+ camDesired.copy(avatarRig.position).add(offset);
+ camera.position.lerp(camDesired, CAM_LERP);
+ camLookTarget.copy(avatarRig.position).add(CAM_LOOK_OFFSET);
+ camLookCurrent.lerp(camLookTarget, CAM_LERP);
+ camera.lookAt(camLookCurrent);
+ }
+
+ animMgr.update(dt);
+
+ // Animate placed-object spawn (scale 0 → 1, cubic ease-out)
+ for (const obj of placedObjects) {
+ if (obj.spawnT < SPAWN_DURATION) {
+ obj.spawnT += dt;
+ const p = Math.min(1, obj.spawnT / SPAWN_DURATION);
+ obj.mesh.scale.setScalar(1 - Math.pow(1 - p, 3));
+ }
+ }
+
+ renderer.render(scene, camera);
+ requestAnimationFrame(tick);
+}
+
+// ── Boot ──────────────────────────────────────────────────────────────────
+loadAvatar()
+ .then(() => requestAnimationFrame(tick))
+ .catch(err => {
+ log.error('[irl] avatar load failed:', err);
+ nameEl.textContent = 'Avatar';
+ setStatus(`Couldn't load avatar: ${err?.message ?? err}`, { error: true, sticky: true });
+ cameraBtn.disabled = false;
+ cameraBtn.removeAttribute('aria-busy');
+ requestAnimationFrame(tick);
+ });
diff --git a/src/pose-studio.js b/src/pose-studio.js
index f3f15a830..5a329f4a7 100644
--- a/src/pose-studio.js
+++ b/src/pose-studio.js
@@ -60,6 +60,7 @@ import {
} from './pose-animation.js';
import { PoseLibrary } from './pose-library.js';
import { AnimationLibrary } from './animation-library.js';
+import { putSceneHandoff } from './shared/scene-handoff.js';
import { log } from './shared/log.js';
// ─── DOM helpers ────────────────────────────────────────────────────────
@@ -1095,6 +1096,7 @@ function boot() {
fps: $('#tl-fps'),
exportJson: $('#tl-export-json'),
exportGlb: $('#tl-export-glb'),
+ openScene: $('#tl-open-scene'),
};
if (!tl.track) return null; // page without the timeline markup — no-op
@@ -1199,6 +1201,7 @@ function boot() {
const has = doc.keyframes.length > 0;
tl.exportJson.disabled = !has;
tl.exportGlb.disabled = !has;
+ if (tl.openScene) tl.openScene.disabled = !has;
}
function updateSelectionUI() {
@@ -1396,16 +1399,16 @@ function boot() {
a.remove();
setTimeout(() => URL.revokeObjectURL(url), 1500);
}
- async function withBusy(btn, label, fn) {
+ async function withBusy(btn, label, fn, opts = {}) {
const original = btn.textContent;
btn.classList.remove('is-ok', 'is-err');
btn.classList.add('is-busy');
- btn.textContent = 'Working…';
+ btn.textContent = opts.busyText || 'Working…';
try {
await fn();
btn.classList.replace('is-busy', 'is-ok');
- btn.textContent = 'Saved ✓';
- setStatus(`${label} downloaded.`);
+ btn.textContent = opts.okText || 'Saved ✓';
+ setStatus(opts.doneStatus || `${label} downloaded.`);
} catch (err) {
btn.classList.replace('is-busy', 'is-err');
btn.textContent = 'Failed';
@@ -1429,24 +1432,58 @@ function boot() {
);
});
});
+ // Bake the keyframe document onto the live rig and serialize the rig
+ // (mesh + embedded clip) to a binary GLB. The clip's tracks bind to the
+ // rig's ACTUAL node names so the animation plays against this same model
+ // when re-imported anywhere (download, or the Scene Studio handoff).
+ async function bakeAnimatedGlb() {
+ const rig = state.rig;
+ const clip = bakeClip(doc, {
+ resolveBoneName: (k) => rig.getNode(k)?.name || null,
+ rootName: rig.root?.name || '',
+ });
+ const exporter = new GLTFExporter();
+ const buffer = await exporter.parseAsync(rig.root, {
+ binary: true,
+ animations: [clip],
+ embedImages: true,
+ });
+ return { buffer, clip };
+ }
+
tl.exportGlb.addEventListener('click', () => {
pause();
withBusy(tl.exportGlb, 'Animated GLB', async () => {
- const rig = state.rig;
- const clip = bakeClip(doc, {
- resolveBoneName: (k) => rig.getNode(k)?.name || null,
- rootName: rig.root?.name || '',
- });
- const exporter = new GLTFExporter();
- const buffer = await exporter.parseAsync(rig.root, {
- binary: true,
- animations: [clip],
- embedImages: true,
- });
+ const { buffer } = await bakeAnimatedGlb();
downloadBlob(buffer, `${safeName()}.glb`, 'model/gltf-binary');
});
});
+ // Hand the animation to /scene (the three.js editor) as a recordable
+ // timeline track. We stash the baked GLB in IndexedDB and navigate —
+ // navigating only after the write resolves, so the studio never opens to
+ // an empty handoff. Same-tab so a popup blocker can't swallow it.
+ tl.openScene?.addEventListener('click', () => {
+ pause();
+ withBusy(
+ tl.openScene,
+ 'Scene Studio',
+ async () => {
+ const { buffer, clip } = await bakeAnimatedGlb();
+ const label = (state.avatar?.name || doc.name || 'Animation')
+ .toString()
+ .slice(0, 64);
+ await putSceneHandoff({ glb: buffer, name: label, animationName: clip.name });
+ window.location.assign('/scene?handoff=1');
+ },
+ {
+ busyText: 'Opening…',
+ okText: 'Opening ↗',
+ doneStatus: 'Opening Scene Studio — use Render ▸ Video to record.',
+ },
+ );
+ });
+
// ── Keyboard (timeline) ──────────────────────────────────────────────────────
window.addEventListener('keydown', (ev) => {
if (ev.target.matches('input, textarea, select') || ev.target.closest('.tl-key'))
diff --git a/src/scene-studio/main.js b/src/scene-studio/main.js
index 9068be4b0..05bff2e93 100644
--- a/src/scene-studio/main.js
+++ b/src/scene-studio/main.js
@@ -14,6 +14,8 @@ import * as THREE from 'three';
import { Editor } from './vendor/js/Editor.js';
import { AddObjectCommand } from './vendor/js/commands/AddObjectCommand.js';
+import { AddScriptCommand } from './vendor/js/commands/AddScriptCommand.js';
+import { takeSceneHandoff } from '../shared/scene-handoff.js';
import { Viewport } from './vendor/js/Viewport.js';
import { Toolbar } from './vendor/js/Toolbar.js';
import { Script } from './vendor/js/Script.js';
@@ -101,6 +103,7 @@ editor.storage.init(function () {
}
importModelFromQuery();
+ importHandoffAnimation();
});
//
@@ -148,6 +151,38 @@ editor.storage.init(function () {
// intent: add this model to the scene. The query is then stripped from the
// address bar so a reload doesn't import a duplicate — autosave already
// persists the object.
+async function addGltfBufferToScene(contents, label) {
+ // Same decoder wiring as the vendored Loader's createGLTFLoader.
+ const [{ GLTFLoader }, { DRACOLoader }, { KTX2Loader }, { MeshoptDecoder }] = await Promise.all([
+ import('three/addons/loaders/GLTFLoader.js'),
+ import('three/addons/loaders/DRACOLoader.js'),
+ import('three/addons/loaders/KTX2Loader.js'),
+ import('three/addons/libs/meshopt_decoder.module.js'),
+ ]);
+ const dracoLoader = new DRACOLoader();
+ dracoLoader.setDecoderPath('/scene-studio/draco/gltf/');
+ const ktx2Loader = new KTX2Loader();
+ ktx2Loader.setTranscoderPath('/scene-studio/basis/');
+ editor.signals.rendererDetectKTX2Support.dispatch(ktx2Loader);
+ const loader = new GLTFLoader();
+ loader.setDRACOLoader(dracoLoader);
+ loader.setKTX2Loader(ktx2Loader);
+ loader.setMeshoptDecoder(MeshoptDecoder);
+
+ try {
+ const result = await loader.parseAsync(contents, '');
+ const object = result.scene;
+ if (label) object.name = label;
+ object.animations.push(...result.animations);
+ editor.execute(new AddObjectCommand(editor, object));
+ editor.selectByUuid(object.uuid);
+ return object;
+ } finally {
+ dracoLoader.dispose();
+ ktx2Loader.dispose();
+ }
+}
+
async function importModelFromQuery() {
const params = new URLSearchParams(window.location.search);
const modelUrl = params.get('model');
@@ -161,40 +196,60 @@ async function importModelFromQuery() {
if (!res.ok) throw new Error('HTTP ' + res.status);
const contents = await res.arrayBuffer();
- // Same decoder wiring as the vendored Loader's createGLTFLoader.
- const [{ GLTFLoader }, { DRACOLoader }, { KTX2Loader }, { MeshoptDecoder }] = await Promise.all([
- import('three/addons/loaders/GLTFLoader.js'),
- import('three/addons/loaders/DRACOLoader.js'),
- import('three/addons/loaders/KTX2Loader.js'),
- import('three/addons/libs/meshopt_decoder.module.js'),
- ]);
- const dracoLoader = new DRACOLoader();
- dracoLoader.setDecoderPath('/scene-studio/draco/gltf/');
- const ktx2Loader = new KTX2Loader();
- ktx2Loader.setTranscoderPath('/scene-studio/basis/');
- editor.signals.rendererDetectKTX2Support.dispatch(ktx2Loader);
- const loader = new GLTFLoader();
- loader.setDRACOLoader(dracoLoader);
- loader.setKTX2Loader(ktx2Loader);
- loader.setMeshoptDecoder(MeshoptDecoder);
-
- const result = await loader.parseAsync(contents, '');
const urlBase = decodeURIComponent(modelUrl.split('?')[0].split('/').pop() || '');
const label = (params.get('name') || urlBase.replace(/\.(glb|gltf)$/i, '') || 'Model')
.replace(/\s+/g, ' ').trim().slice(0, 64) || 'Model';
- const object = result.scene;
- object.name = label;
- object.animations.push(...result.animations);
- editor.execute(new AddObjectCommand(editor, object));
- editor.selectByUuid(object.uuid);
-
- dracoLoader.dispose();
- ktx2Loader.dispose();
+ await addGltfBufferToScene(contents, label);
} catch (error) {
alert('Could not load the handed-off model (' + error.message + '). You can drag the GLB file into the editor instead.');
}
}
+// Hand-off from the Animation Studio (/pose): a baked GLB (mesh + embedded clip)
+// stashed in IndexedDB. We load it as an object, then attach a player script
+// that drives an AnimationMixer — because the Render ▸ Video path runs through
+// APP.Player, which animates via object scripts, NOT bare clips. With the script
+// in place the clip plays in the live timeline AND records to video. The
+// canonical-name clip already binds to the GLB's own nodes, so no retargeting.
+const HANDOFF_PLAY_SCRIPT = {
+ name: 'Play Animation (three.ws)',
+ source: [
+ 'var mixer = new THREE.AnimationMixer( this );',
+ 'var clip = ( this.animations && this.animations[ 0 ] ) || null;',
+ 'if ( clip ) mixer.clipAction( clip ).play();',
+ '',
+ 'function update( event ) {',
+ '',
+ '\tif ( clip ) mixer.setTime( event.time / 1000 );',
+ '',
+ '}',
+ ].join('\n'),
+};
+
+async function importHandoffAnimation() {
+ const params = new URLSearchParams(window.location.search);
+ if (params.get('handoff') !== '1') return;
+
+ window.history.replaceState(null, '', window.location.pathname + window.location.hash);
+
+ let record;
+ try {
+ record = await takeSceneHandoff();
+ } catch {
+ return; // IndexedDB unavailable (private mode, etc.) — nothing to load.
+ }
+ if (!record) return;
+
+ try {
+ const object = await addGltfBufferToScene(record.glb, record.name || 'Animation');
+ if (object.animations.length > 0) {
+ editor.execute(new AddScriptCommand(editor, object, { ...HANDOFF_PLAY_SCRIPT }));
+ }
+ } catch (error) {
+ alert('Could not load the animation from the Animation Studio (' + error.message + '). Try Export GLB on /pose and drag the file in instead.');
+ }
+}
+
//
document.addEventListener('dragover', function (event) {
diff --git a/src/shared/mesh-refine.js b/src/shared/mesh-refine.js
new file mode 100644
index 000000000..8369022bf
--- /dev/null
+++ b/src/shared/mesh-refine.js
@@ -0,0 +1,303 @@
+// Local mesh refinement — deterministic geometry passes that run entirely in
+// the browser on an already-loaded GLB. No worker, no API, no rate limit.
+//
+// Generated meshes (TRELLIS / Meshy / Tripo drafts) ship with three recurring
+// flaws this module fixes without re-generating anything:
+// • duplicated vertices along seams → weld (merge by position)
+// • faceted shading from split normals → recompute smooth vertex normals
+// • surface noise / stair-stepping → Laplacian relaxation
+// Plus two density transforms for a target use-case:
+// • decimate (QEM) → a real-time triangle budget, UVs preserved
+// • subdivide → render-quality density before smoothing
+//
+// Every function is pure with respect to the DOM and runs headless (the test
+// suite exercises them under node), so the panel in forge-refine.js is a thin
+// wrapper over this library.
+
+import { mergeVertices } from 'three/addons/utils/BufferGeometryUtils.js';
+import { SimplifyModifier } from 'three/addons/modifiers/SimplifyModifier.js';
+import { TessellateModifier } from 'three/addons/modifiers/TessellateModifier.js';
+
+const clamp = (v, lo, hi) => Math.min(hi, Math.max(lo, v));
+
+/** Triangle + vertex counts for one geometry. */
+export function geometryStats(geometry) {
+ const pos = geometry.getAttribute?.('position');
+ const vertices = pos ? pos.count : 0;
+ const index = geometry.getIndex?.();
+ const triangles = index ? index.count / 3 : vertices / 3;
+ return { vertices, triangles: Math.round(triangles) };
+}
+
+/** Summed triangle + vertex counts across every mesh under a scene root. */
+export function sceneStats(root) {
+ let vertices = 0;
+ let triangles = 0;
+ root?.traverse?.((obj) => {
+ if (obj.isMesh && obj.geometry) {
+ const s = geometryStats(obj.geometry);
+ vertices += s.vertices;
+ triangles += s.triangles;
+ }
+ });
+ return { vertices, triangles };
+}
+
+// A geometry with per-face (multi-material) groups can't survive the
+// re-indexing that decimate/subdivide perform — the group ranges would point at
+// stale vertices. We still weld + re-shade those meshes, but skip the density
+// transforms rather than corrupt them.
+function hasMaterialGroups(geometry) {
+ return Array.isArray(geometry.groups) && geometry.groups.length > 1;
+}
+
+function ensureIndexed(geometry) {
+ return geometry.getIndex() ? geometry : mergeVertices(geometry);
+}
+
+/** Weld vertices that share a position (within tolerance). Returns indexed geometry. */
+export function weldGeometry(geometry, tolerance = 1e-4) {
+ try {
+ return mergeVertices(geometry, tolerance);
+ } catch {
+ // mergeVertices throws on geometries with interleaved/odd attributes;
+ // the original is always safe to return untouched.
+ return geometry;
+ }
+}
+
+/** Recompute smooth vertex normals in place (fixes faceted shading post-weld). */
+export function recomputeSmoothNormals(geometry) {
+ geometry.deleteAttribute('normal');
+ geometry.computeVertexNormals();
+ return geometry;
+}
+
+// Mean length of a sample of edges — used to scale subdivision so one pass
+// roughly doubles density regardless of the model's world scale. Sampled (not
+// exhaustive) so it stays O(1)-ish on large meshes.
+function meanEdgeLength(geometry) {
+ const pos = geometry.getAttribute('position');
+ const index = geometry.getIndex();
+ if (!pos || !index) return 0;
+ const idx = index.array;
+ const triCount = idx.length / 3;
+ const step = Math.max(1, Math.floor(triCount / 2000)); // cap at ~2k sampled tris
+ let total = 0;
+ let n = 0;
+ for (let t = 0; t < triCount; t += step) {
+ const a = idx[t * 3];
+ const b = idx[t * 3 + 1];
+ const c = idx[t * 3 + 2];
+ total += edgeLen(pos, a, b) + edgeLen(pos, b, c) + edgeLen(pos, c, a);
+ n += 3;
+ }
+ return n ? total / n : 0;
+}
+
+function edgeLen(pos, i, j) {
+ const dx = pos.getX(i) - pos.getX(j);
+ const dy = pos.getY(i) - pos.getY(j);
+ const dz = pos.getZ(i) - pos.getZ(j);
+ return Math.sqrt(dx * dx + dy * dy + dz * dz);
+}
+
+/**
+ * Laplacian smoothing: move each interior vertex a fraction (`lambda`) toward
+ * the centroid of its neighbours, `iterations` times. Boundary vertices (on an
+ * edge used by a single triangle) are pinned so open meshes don't shrink inward.
+ * Operates on a welded, indexed copy and recomputes smooth normals.
+ */
+export function laplacianSmooth(geometry, { iterations = 1, lambda = 0.5 } = {}) {
+ const geo = ensureIndexed(geometry);
+ const posAttr = geo.getAttribute('position');
+ const index = geo.getIndex().array;
+ const count = posAttr.count;
+ if (!count || iterations < 1) return recomputeSmoothNormals(geo);
+
+ const neighbors = Array.from({ length: count }, () => new Set());
+ const edgeUse = new Map();
+ for (let i = 0; i < index.length; i += 3) {
+ const tri = [index[i], index[i + 1], index[i + 2]];
+ for (let e = 0; e < 3; e++) {
+ const u = tri[e];
+ const v = tri[(e + 1) % 3];
+ neighbors[u].add(v);
+ neighbors[v].add(u);
+ const key = u < v ? u * count + v : v * count + u;
+ edgeUse.set(key, (edgeUse.get(key) || 0) + 1);
+ }
+ }
+ const boundary = new Uint8Array(count);
+ for (const [key, used] of edgeUse) {
+ if (used === 1) {
+ boundary[Math.floor(key / count)] = 1;
+ boundary[key % count] = 1;
+ }
+ }
+
+ let buf = Float32Array.from(posAttr.array);
+ const l = clamp(lambda, 0, 1);
+ for (let it = 0; it < iterations; it++) {
+ const next = Float32Array.from(buf);
+ for (let v = 0; v < count; v++) {
+ if (boundary[v]) continue;
+ const ns = neighbors[v];
+ if (ns.size === 0) continue;
+ let cx = 0;
+ let cy = 0;
+ let cz = 0;
+ for (const n of ns) {
+ cx += buf[n * 3];
+ cy += buf[n * 3 + 1];
+ cz += buf[n * 3 + 2];
+ }
+ const inv = 1 / ns.size;
+ next[v * 3] = buf[v * 3] + l * (cx * inv - buf[v * 3]);
+ next[v * 3 + 1] = buf[v * 3 + 1] + l * (cy * inv - buf[v * 3 + 1]);
+ next[v * 3 + 2] = buf[v * 3 + 2] + l * (cz * inv - buf[v * 3 + 2]);
+ }
+ buf = next;
+ }
+ posAttr.copyArray(buf);
+ posAttr.needsUpdate = true;
+ return recomputeSmoothNormals(geo);
+}
+
+/**
+ * Subdivide: split edges longer than half the mean edge length, up to
+ * `iterations` passes, then re-weld so the denser mesh shades smoothly.
+ */
+export function subdivideGeometry(geometry, { iterations = 1 } = {}) {
+ const geo = ensureIndexed(geometry);
+ const mean = meanEdgeLength(geo);
+ if (!(mean > 0)) return geo;
+ const passes = clamp(Math.round(iterations), 1, 3);
+ const mod = new TessellateModifier(mean * 0.5, passes * 2);
+ const tessellated = mod.modify(geo);
+ const welded = weldGeometry(tessellated);
+ return recomputeSmoothNormals(welded);
+}
+
+/**
+ * Decimate via quadric error metric (SimplifyModifier). `keep` is the fraction
+ * of vertices to retain (0..1). UVs/normals/colors are carried through.
+ */
+export function decimateGeometry(geometry, { keep = 0.5 } = {}) {
+ const pos = geometry.getAttribute('position');
+ if (!pos) return geometry;
+ const ratio = clamp(keep, 0.05, 0.95);
+ const remove = Math.floor(pos.count * (1 - ratio));
+ if (remove <= 0) return geometry;
+ try {
+ return new SimplifyModifier().modify(geometry, remove);
+ } catch {
+ // Degenerate topology can trip the simplifier; the un-decimated geometry
+ // is always a valid result, just denser than requested.
+ return geometry;
+ }
+}
+
+/**
+ * Apply a refinement spec to one geometry and return the refined geometry.
+ * Pipeline order is fixed and intentional: weld first (dedupe + enable the
+ * later passes), then the one density transform, then relaxation, then smooth
+ * normals last. `spec` keys: { weld, decimate, subdivide, smooth, lambda,
+ * normals }.
+ */
+export function refineGeometry(geometry, spec = {}) {
+ let geo = geometry;
+ const groups = hasMaterialGroups(geo);
+ if (spec.weld !== false) geo = weldGeometry(geo, spec.weldTolerance ?? 1e-4);
+ if (!groups && spec.decimate) geo = decimateGeometry(geo, { keep: spec.decimate });
+ if (!groups && spec.subdivide) geo = subdivideGeometry(geo, { iterations: spec.subdivide });
+ if (spec.smooth) geo = laplacianSmooth(geo, { iterations: spec.smooth, lambda: spec.lambda });
+ if (spec.normals !== false) recomputeSmoothNormals(geo);
+ return geo;
+}
+
+/**
+ * Refine every mesh under a scene root in place, swapping each mesh's geometry
+ * for its refined version. Returns { before, after } stat totals so the caller
+ * can show the user exactly what changed.
+ */
+export function refineScene(root, spec = {}) {
+ const before = sceneStats(root);
+ root.traverse((obj) => {
+ if (obj.isMesh && obj.geometry?.getAttribute?.('position')) {
+ const refined = refineGeometry(obj.geometry, spec);
+ if (refined !== obj.geometry) {
+ obj.geometry.dispose?.();
+ obj.geometry = refined;
+ }
+ }
+ });
+ return { before, after: sceneStats(root) };
+}
+
+// Intent-driven presets. Each carries the spec it applies plus an optional
+// slider descriptor whose `map(value)` returns spec overrides — so one slider
+// means "smoothing passes" under Smooth and "kept detail %" under Game-ready.
+export const REFINE_PRESETS = [
+ {
+ key: 'clean',
+ name: 'Clean',
+ icon: '✦',
+ blurb: 'Weld duplicate vertices and fix faceted shading. Smaller file, smoother look — geometry unchanged.',
+ spec: { weld: true, normals: true },
+ slider: null,
+ },
+ {
+ key: 'smooth',
+ name: 'Smooth',
+ icon: '◠',
+ blurb: 'Relax the surface noise and stair-stepping that generated meshes carry, without losing the shape.',
+ spec: { weld: true, smooth: 3, lambda: 0.5, normals: true },
+ slider: {
+ min: 1,
+ max: 8,
+ def: 3,
+ label: 'Smoothing passes',
+ map: (v) => ({ smooth: v }),
+ },
+ },
+ {
+ key: 'gameready',
+ name: 'Game-ready',
+ icon: '◆',
+ blurb: 'Decimate to a real-time triangle budget while preserving silhouette and UVs. Lower poly, clean shading.',
+ spec: { weld: true, decimate: 0.5, normals: true },
+ slider: {
+ min: 10,
+ max: 90,
+ def: 50,
+ label: 'Kept detail',
+ unit: '%',
+ map: (v) => ({ decimate: v / 100 }),
+ },
+ },
+ {
+ key: 'hero',
+ name: 'Hero',
+ icon: '❖',
+ blurb: 'Subdivide and relax for a high-density, render-quality surface. Best for close-up hero shots.',
+ spec: { weld: true, subdivide: 1, smooth: 2, lambda: 0.4, normals: true },
+ slider: {
+ min: 1,
+ max: 3,
+ def: 1,
+ label: 'Subdivision',
+ map: (v) => ({ subdivide: v }),
+ },
+ },
+];
+
+export const REFINE_PRESET_BY_KEY = Object.fromEntries(REFINE_PRESETS.map((p) => [p.key, p]));
+
+/** Resolve a preset + slider value into the concrete spec to run. */
+export function specForPreset(key, sliderValue) {
+ const preset = REFINE_PRESET_BY_KEY[key];
+ if (!preset) return null;
+ if (!preset.slider || sliderValue == null) return { ...preset.spec };
+ return { ...preset.spec, ...preset.slider.map(Number(sliderValue)) };
+}
diff --git a/src/shared/scene-handoff.js b/src/shared/scene-handoff.js
new file mode 100644
index 000000000..0fe0e1edf
--- /dev/null
+++ b/src/shared/scene-handoff.js
@@ -0,0 +1,73 @@
+// One-shot GLB handoff between three.ws pages and the Scene Studio (/scene).
+//
+// /pose bakes the posed keyframe animation into a GLB (mesh + embedded clip)
+// and stashes it here, then opens /scene?handoff=1, which takes the payload
+// exactly once and loads it as a recordable timeline track.
+//
+// IndexedDB — not a query string or localStorage — because the payload is a
+// binary GLB that can run to several MB. A URL can't carry it, and localStorage
+// only holds strings (base64 would inflate it ~33% and risk the ~5MB quota).
+// IndexedDB stores the ArrayBuffer directly and survives the page navigation.
+
+const DB_NAME = 'three-ws-scene-handoff';
+const STORE = 'handoff';
+const KEY = 'pending';
+
+// A handoff older than this is treated as stale and ignored — so a payload left
+// behind by an abandoned session never surprise-loads into a fresh /scene visit.
+const MAX_AGE_MS = 5 * 60 * 1000;
+
+function openDb() {
+ return new Promise((resolve, reject) => {
+ const req = indexedDB.open(DB_NAME, 1);
+ req.onupgradeneeded = () => {
+ const db = req.result;
+ if (!db.objectStoreNames.contains(STORE)) db.createObjectStore(STORE);
+ };
+ req.onsuccess = () => resolve(req.result);
+ req.onerror = () => reject(req.error || new Error('IndexedDB open failed'));
+ });
+}
+
+function run(db, mode, fn) {
+ return new Promise((resolve, reject) => {
+ const tx = db.transaction(STORE, mode);
+ const req = fn(tx.objectStore(STORE));
+ tx.oncomplete = () => resolve(req ? req.result : undefined);
+ tx.onabort = tx.onerror = () =>
+ reject(tx.error || new Error('IndexedDB transaction failed'));
+ });
+}
+
+/**
+ * Stash a one-shot handoff for /scene to consume.
+ * @param {{ glb: ArrayBuffer, name?: string, animationName?: string }} payload
+ */
+export async function putSceneHandoff(payload) {
+ const db = await openDb();
+ try {
+ await run(db, 'readwrite', (s) => s.put({ ...payload, createdAt: Date.now() }, KEY));
+ } finally {
+ db.close();
+ }
+}
+
+/**
+ * Read and delete the pending handoff (one-shot). Returns null when there is
+ * none, or when the stored payload is older than MAX_AGE_MS.
+ * @returns {Promise<{ glb: ArrayBuffer, name?: string, animationName?: string, createdAt: number } | null>}
+ */
+export async function takeSceneHandoff() {
+ const db = await openDb();
+ try {
+ const record = await run(db, 'readonly', (s) => s.get(KEY));
+ await run(db, 'readwrite', (s) => s.delete(KEY));
+ if (!record || !record.glb) return null;
+ if (typeof record.createdAt === 'number' && Date.now() - record.createdAt > MAX_AGE_MS) {
+ return null;
+ }
+ return record;
+ } finally {
+ db.close();
+ }
+}
diff --git a/tests/api/forge-gallery-community.test.js b/tests/api/forge-gallery-community.test.js
index def553788..d43886b1d 100644
--- a/tests/api/forge-gallery-community.test.js
+++ b/tests/api/forge-gallery-community.test.js
@@ -24,7 +24,10 @@ vi.mock('../../api/_lib/forge-store.js', () => ({
}));
vi.mock('../../api/_lib/rate-limit.js', () => ({
- limits: { mcp3dStatus: vi.fn(async () => ({ success: true })) },
+ limits: {
+ mcp3dStatus: vi.fn(async () => ({ success: true })),
+ publicIp: vi.fn(async () => ({ success: true })),
+ },
clientIp: vi.fn(() => '127.0.0.1'),
}));
diff --git a/tests/api/http-rate-limited.test.js b/tests/api/http-rate-limited.test.js
index b9d74194a..9a2a29cb4 100644
--- a/tests/api/http-rate-limited.test.js
+++ b/tests/api/http-rate-limited.test.js
@@ -107,4 +107,21 @@ describe('rateLimited', () => {
expect(res.body.scope).toBe('chat');
expect(res.body.retry_after).toBe(10);
});
+
+ it('surfaces the limiter reason so clients can tell quota from a degraded limiter', () => {
+ const res = mockRes();
+ rateLimited(res, {
+ limit: 30,
+ remaining: 0,
+ reset: Date.now() + 60_000,
+ reason: 'rate_limiter_unavailable',
+ });
+ expect(res.body.reason).toBe('rate_limiter_unavailable');
+ });
+
+ it('omits reason when the limiter does not provide one', () => {
+ const res = mockRes();
+ rateLimited(res, { limit: 30, remaining: 0, reset: Date.now() + 60_000 });
+ expect(res.body).not.toHaveProperty('reason');
+ });
});
diff --git a/tests/mesh-refine.test.js b/tests/mesh-refine.test.js
new file mode 100644
index 000000000..ecbc0b720
--- /dev/null
+++ b/tests/mesh-refine.test.js
@@ -0,0 +1,177 @@
+// Local mesh refinement library — deterministic geometry passes that run in the
+// browser (and headless here). These tests build synthetic geometry and assert
+// each pass does what it claims: weld dedupes, normals smooth, Laplacian moves
+// interior verts but pins boundaries, decimate reduces, subdivide increases.
+
+import { describe, it, expect } from 'vitest';
+import { BufferGeometry, BufferAttribute, PlaneGeometry, Mesh, Group } from 'three';
+import {
+ geometryStats,
+ sceneStats,
+ weldGeometry,
+ recomputeSmoothNormals,
+ laplacianSmooth,
+ subdivideGeometry,
+ decimateGeometry,
+ refineGeometry,
+ refineScene,
+ specForPreset,
+ REFINE_PRESETS,
+} from '../src/shared/mesh-refine.js';
+
+// Two triangles sharing an edge, but authored as 6 independent vertices (the
+// duplicated-seam shape generated meshes ship with). Welding should collapse
+// the 2 shared corners → 4 unique vertices.
+function duplicatedQuad() {
+ const g = new BufferGeometry();
+ // prettier-ignore
+ const positions = new Float32Array([
+ 0, 0, 0, 1, 0, 0, 0, 1, 0, // tri A
+ 1, 0, 0, 1, 1, 0, 0, 1, 0, // tri B (reuses (1,0,0) and (0,1,0))
+ ]);
+ g.setAttribute('position', new BufferAttribute(positions, 3));
+ return g;
+}
+
+describe('geometryStats / sceneStats', () => {
+ it('counts triangles for non-indexed geometry', () => {
+ expect(geometryStats(duplicatedQuad())).toEqual({ vertices: 6, triangles: 2 });
+ });
+
+ it('sums across every mesh in a scene', () => {
+ const root = new Group();
+ root.add(new Mesh(duplicatedQuad()));
+ root.add(new Mesh(duplicatedQuad()));
+ const s = sceneStats(root);
+ expect(s.triangles).toBe(4);
+ expect(s.vertices).toBe(12);
+ });
+});
+
+describe('weldGeometry', () => {
+ it('merges coincident vertices and indexes the result', () => {
+ const welded = weldGeometry(duplicatedQuad());
+ expect(welded.getIndex()).not.toBeNull();
+ expect(welded.getAttribute('position').count).toBe(4);
+ expect(welded.getIndex().count).toBe(6); // still 2 triangles
+ });
+});
+
+describe('recomputeSmoothNormals', () => {
+ it('produces one averaged normal per welded vertex', () => {
+ const welded = weldGeometry(duplicatedQuad());
+ recomputeSmoothNormals(welded);
+ const n = welded.getAttribute('normal');
+ expect(n.count).toBe(4);
+ // Flat quad in z=0 plane → all normals point along +z.
+ expect(Math.abs(n.getZ(0))).toBeCloseTo(1, 5);
+ });
+});
+
+describe('laplacianSmooth', () => {
+ it('moves an interior vertex toward its neighbours but pins the boundary', () => {
+ // A plane with interior vertices; displace the centre vertex and confirm
+ // smoothing pulls it back toward the neighbour average.
+ const plane = new PlaneGeometry(4, 4, 4, 4); // 5x5 grid, indexed
+ const pos = plane.getAttribute('position');
+ // Centre vertex of a 5x5 grid is index 12; spike it out of plane.
+ pos.setZ(12, 5);
+ pos.needsUpdate = true;
+ const cornerBefore = pos.getZ(0); // a boundary/corner vertex
+
+ laplacianSmooth(plane, { iterations: 4, lambda: 0.5 });
+
+ const after = plane.getAttribute('position');
+ expect(Math.abs(after.getZ(12))).toBeLessThan(5); // centre relaxed inward
+ expect(after.getZ(0)).toBeCloseTo(cornerBefore, 5); // boundary pinned
+ });
+
+ it('is a no-op-but-shades when iterations < 1', () => {
+ const g = weldGeometry(duplicatedQuad());
+ const out = laplacianSmooth(g, { iterations: 0 });
+ expect(out.getAttribute('normal')).not.toBeNull();
+ });
+});
+
+describe('decimateGeometry', () => {
+ it('reduces vertex count toward the kept fraction', () => {
+ const dense = new PlaneGeometry(2, 2, 16, 16);
+ const before = geometryStats(dense).vertices;
+ const out = decimateGeometry(dense, { keep: 0.4 });
+ expect(geometryStats(out).vertices).toBeLessThan(before);
+ });
+
+ it('clamps keep below 1 so it retains nearly all vertices at the top of the range', () => {
+ const g = new PlaneGeometry(2, 2, 4, 4);
+ const before = geometryStats(g).vertices;
+ const out = geometryStats(decimateGeometry(g, { keep: 0.99 })).vertices;
+ expect(out).toBeLessThanOrEqual(before);
+ expect(out).toBeGreaterThanOrEqual(Math.floor(before * 0.9));
+ });
+});
+
+describe('subdivideGeometry', () => {
+ it('increases triangle count', () => {
+ const plane = new PlaneGeometry(2, 2, 1, 1); // 2 big triangles
+ const before = geometryStats(plane).triangles;
+ const out = subdivideGeometry(plane, { iterations: 1 });
+ expect(geometryStats(out).triangles).toBeGreaterThan(before);
+ });
+});
+
+describe('refineGeometry pipeline', () => {
+ it('Clean preset welds and adds smooth normals without changing density', () => {
+ const spec = specForPreset('clean');
+ const out = refineGeometry(duplicatedQuad(), spec);
+ expect(out.getAttribute('position').count).toBe(4); // welded
+ expect(out.getAttribute('normal')).not.toBeNull();
+ expect(geometryStats(out).triangles).toBe(2); // unchanged
+ });
+
+ it('Game-ready preset reduces triangles', () => {
+ const dense = new PlaneGeometry(2, 2, 16, 16);
+ const before = geometryStats(dense).triangles;
+ const spec = specForPreset('gameready', 30); // keep 30%
+ const out = refineGeometry(dense, spec);
+ expect(geometryStats(out).triangles).toBeLessThan(before);
+ });
+
+ it('skips density transforms on multi-material (grouped) geometry', () => {
+ const g = new PlaneGeometry(2, 2, 8, 8);
+ g.addGroup(0, 96, 0);
+ g.addGroup(96, g.getIndex().count - 96, 1);
+ const before = geometryStats(g).triangles;
+ const out = refineGeometry(g, specForPreset('gameready', 30));
+ // Grouped → decimate skipped, triangle count preserved.
+ expect(geometryStats(out).triangles).toBe(before);
+ });
+});
+
+describe('refineScene', () => {
+ it('refines every mesh and reports before/after totals', () => {
+ const root = new Group();
+ root.add(new Mesh(duplicatedQuad()));
+ const { before, after } = refineScene(root, specForPreset('clean'));
+ expect(before.vertices).toBe(6);
+ expect(after.vertices).toBe(4); // welded
+ });
+});
+
+describe('specForPreset', () => {
+ it('maps slider values into spec overrides', () => {
+ expect(specForPreset('smooth', 6).smooth).toBe(6);
+ expect(specForPreset('gameready', 40).decimate).toBeCloseTo(0.4, 5);
+ expect(specForPreset('hero', 2).subdivide).toBe(2);
+ });
+
+ it('returns base spec for sliderless presets and null for unknown keys', () => {
+ expect(specForPreset('clean')).toEqual({ weld: true, normals: true });
+ expect(specForPreset('nope')).toBeNull();
+ });
+
+ it('every preset has a unique key and a spec', () => {
+ const keys = new Set(REFINE_PRESETS.map((p) => p.key));
+ expect(keys.size).toBe(REFINE_PRESETS.length);
+ for (const p of REFINE_PRESETS) expect(p.spec).toBeTruthy();
+ });
+});
diff --git a/vercel.json b/vercel.json
index fe15a8887..77117e052 100644
--- a/vercel.json
+++ b/vercel.json
@@ -81,11 +81,11 @@
},
"api/x402/forge.js": {
"includeFiles": "{examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**,sdk/src/sas-config.json}",
- "maxDuration": 60
+ "maxDuration": 300
},
"api/forge.js": {
"includeFiles": "{examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**,sdk/src/sas-config.json}",
- "maxDuration": 60
+ "maxDuration": 300
},
"api/brain/chat.js": {
"includeFiles": "{examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**,sdk/src/sas-config.json}",
@@ -630,7 +630,9 @@
{
"src": "/game(/.*)?",
"status": 308,
- "headers": { "Location": "/play" }
+ "headers": {
+ "Location": "/play"
+ }
},
{
"src": "/walk/?",
@@ -912,27 +914,37 @@
{
"src": "/home-classic/?",
"status": 301,
- "headers": { "Location": "/" }
+ "headers": {
+ "Location": "/"
+ }
},
{
"src": "/home-v3/?",
"status": 301,
- "headers": { "Location": "/" }
+ "headers": {
+ "Location": "/"
+ }
},
{
"src": "/home-v4/?",
"status": 301,
- "headers": { "Location": "/" }
+ "headers": {
+ "Location": "/"
+ }
},
{
"src": "/discover-next/?",
"status": 301,
- "headers": { "Location": "/discover" }
+ "headers": {
+ "Location": "/discover"
+ }
},
{
"src": "/agent-next/?",
"status": 301,
- "headers": { "Location": "/agents" }
+ "headers": {
+ "Location": "/agents"
+ }
},
{
"src": "/deploy",
@@ -944,92 +956,128 @@
},
{
"src": "/dashboard-classic/?",
- "headers": { "Location": "/dashboard/" },
+ "headers": {
+ "Location": "/dashboard/"
+ },
"status": 301
},
{
"src": "/dashboard-classic/portfolio/asset",
- "headers": { "Location": "/dashboard/portfolio" },
+ "headers": {
+ "Location": "/dashboard/portfolio"
+ },
"status": 301
},
{
"src": "/dashboard-classic/portfolio",
- "headers": { "Location": "/dashboard/portfolio" },
+ "headers": {
+ "Location": "/dashboard/portfolio"
+ },
"status": 301
},
{
"src": "/dashboard-classic/wallets",
- "headers": { "Location": "/dashboard/account" },
+ "headers": {
+ "Location": "/dashboard/account"
+ },
"status": 301
},
{
"src": "/dashboard-classic/sessions",
- "headers": { "Location": "/dashboard/settings" },
+ "headers": {
+ "Location": "/dashboard/settings"
+ },
"status": 301
},
{
"src": "/dashboard-classic/actions",
- "headers": { "Location": "/dashboard/account" },
+ "headers": {
+ "Location": "/dashboard/account"
+ },
"status": 301
},
{
"src": "/dashboard-classic/embed-policy",
- "headers": { "Location": "/dashboard/api" },
+ "headers": {
+ "Location": "/dashboard/api"
+ },
"status": 301
},
{
"src": "/dashboard-classic/memory",
- "headers": { "Location": "/dashboard/agents" },
+ "headers": {
+ "Location": "/dashboard/agents"
+ },
"status": 301
},
{
"src": "/dashboard-classic/strategy",
- "headers": { "Location": "/dashboard/library" },
+ "headers": {
+ "Location": "/dashboard/library"
+ },
"status": 301
},
{
"src": "/dashboard-classic/voice",
- "headers": { "Location": "/dashboard/settings" },
+ "headers": {
+ "Location": "/dashboard/settings"
+ },
"status": 301
},
{
"src": "/dashboard-classic/sns",
- "headers": { "Location": "/dashboard/account" },
+ "headers": {
+ "Location": "/dashboard/account"
+ },
"status": 301
},
{
"src": "/dashboard-classic/delegation",
- "headers": { "Location": "/dashboard/account" },
+ "headers": {
+ "Location": "/dashboard/account"
+ },
"status": 301
},
{
"src": "/dashboard-classic/tokens",
- "headers": { "Location": "/dashboard/tokens" },
+ "headers": {
+ "Location": "/dashboard/tokens"
+ },
"status": 301
},
{
"src": "/dashboard-classic/agent-pumpfun",
- "headers": { "Location": "/dashboard/tokens" },
+ "headers": {
+ "Location": "/dashboard/tokens"
+ },
"status": 301
},
{
"src": "/dashboard-classic/x402",
- "headers": { "Location": "/dashboard/monetize" },
+ "headers": {
+ "Location": "/dashboard/monetize"
+ },
"status": 301
},
{
"src": "/dashboard-classic/storage",
- "headers": { "Location": "/dashboard/settings" },
+ "headers": {
+ "Location": "/dashboard/settings"
+ },
"status": 301
},
{
"src": "/dashboard-classic/usage",
- "headers": { "Location": "/dashboard/analytics" },
+ "headers": {
+ "Location": "/dashboard/analytics"
+ },
"status": 301
},
{
"src": "/dashboard-classic/(.*)",
- "headers": { "Location": "/dashboard/" },
+ "headers": {
+ "Location": "/dashboard/"
+ },
"status": 301
},
{
@@ -1090,7 +1138,9 @@
},
{
"src": "/dashboard/portfolio/asset",
- "headers": { "Location": "/dashboard/portfolio" },
+ "headers": {
+ "Location": "/dashboard/portfolio"
+ },
"status": 301
},
{
@@ -1099,52 +1149,72 @@
},
{
"src": "/dashboard/wallets",
- "headers": { "Location": "/dashboard/account" },
+ "headers": {
+ "Location": "/dashboard/account"
+ },
"status": 301
},
{
"src": "/dashboard/sessions",
- "headers": { "Location": "/dashboard/settings" },
+ "headers": {
+ "Location": "/dashboard/settings"
+ },
"status": 301
},
{
"src": "/dashboard/actions",
- "headers": { "Location": "/dashboard/account" },
+ "headers": {
+ "Location": "/dashboard/account"
+ },
"status": 301
},
{
"src": "/dashboard/embed-policy",
- "headers": { "Location": "/dashboard/api" },
+ "headers": {
+ "Location": "/dashboard/api"
+ },
"status": 301
},
{
"src": "/dashboard/memory",
- "headers": { "Location": "/dashboard/agents" },
+ "headers": {
+ "Location": "/dashboard/agents"
+ },
"status": 301
},
{
"src": "/dashboard/strategy",
- "headers": { "Location": "/dashboard/library" },
+ "headers": {
+ "Location": "/dashboard/library"
+ },
"status": 301
},
{
"src": "/dashboard/voice",
- "headers": { "Location": "/dashboard/settings" },
+ "headers": {
+ "Location": "/dashboard/settings"
+ },
"status": 301
},
{
"src": "/dashboard/sns",
- "headers": { "Location": "/dashboard/account" },
+ "headers": {
+ "Location": "/dashboard/account"
+ },
"status": 301
},
{
"src": "/dashboard/delegation",
- "headers": { "Location": "/dashboard/account" },
+ "headers": {
+ "Location": "/dashboard/account"
+ },
"status": 301
},
{
"src": "/dashboard/agent-pumpfun",
- "headers": { "Location": "/dashboard/tokens" },
+ "headers": {
+ "Location": "/dashboard/tokens"
+ },
"status": 301
},
{
@@ -1398,7 +1468,9 @@
},
{
"src": "/dashboard/storage",
- "headers": { "Location": "/dashboard/settings" },
+ "headers": {
+ "Location": "/dashboard/settings"
+ },
"status": 301
},
{
@@ -2023,12 +2095,16 @@
{
"src": "/agent/([^/]+)",
"status": 301,
- "headers": { "Location": "/agents/$1" }
+ "headers": {
+ "Location": "/agents/$1"
+ }
},
{
"src": "/agent",
"status": 301,
- "headers": { "Location": "/agents" }
+ "headers": {
+ "Location": "/agents"
+ }
},
{
"src": "/api/widgets/oembed",
@@ -2352,7 +2428,9 @@
},
{
"src": "/dashboard/usage",
- "headers": { "Location": "/dashboard/analytics" },
+ "headers": {
+ "Location": "/dashboard/analytics"
+ },
"status": 301
},
{
@@ -2609,7 +2687,9 @@
{
"src": "/(pages|directory|everything|all-pages)/?",
"status": 308,
- "headers": { "Location": "/sitemap" }
+ "headers": {
+ "Location": "/sitemap"
+ }
},
{
"src": "/sitemap",
@@ -2913,7 +2993,9 @@
{
"src": "/home-v2/?",
"status": 301,
- "headers": { "Location": "/" }
+ "headers": {
+ "Location": "/"
+ }
},
{
"src": "/home",
diff --git a/vite.config.js b/vite.config.js
index 75ba70d97..4d5128653 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -355,6 +355,7 @@ const appConfig = {
status: resolve(__dirname, 'pages/status.html'),
xr: resolve(__dirname, 'pages/xr.html'),
walk: resolve(__dirname, 'pages/walk.html'),
+ irl: resolve(__dirname, 'pages/irl.html'),
communities: resolve(__dirname, 'pages/communities.html'),
'walk-embed': resolve(__dirname, 'pages/walk-embed.html'),
city: resolve(__dirname, 'pages/city.html'),
@@ -679,6 +680,8 @@ const appConfig = {
'/avatar-artifact/': resolve(root, 'pages/avatar-artifact.html'),
'/walk': resolve(root, 'pages/walk.html'),
'/walk/': resolve(root, 'pages/walk.html'),
+ '/irl': resolve(root, 'pages/irl.html'),
+ '/irl/': resolve(root, 'pages/irl.html'),
'/play': resolve(root, 'pages/play.html'),
'/play/': resolve(root, 'pages/play.html'),
'/play/agent-wallet': resolve(root, 'pages/play/agent-wallet.html'),