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): offer FBX and 3MF on the download menu, converted on the server

nirholasf1b9f5860a6d
diff --git a/docs/forge.md b/docs/forge.md
index 008e01f25..044bb63d2 100644
--- a/docs/forge.md
+++ b/docs/forge.md
@@ -127,9 +127,50 @@ stills; it never reports a recording that did not happen.
3. For text, type a prompt like `a weathered brass diving helmet`. For photos, add one to six images of the same object from different angles (front, back, left, right, top, three-quarter); each uploads straight to object storage via a presigned URL and the public URLs are fused with multi-view conditioning.
4. Optionally open the quality controls and pick a tier (Draft, Standard, High) and an engine. The default engine carries a **FREE** pill. Down lanes are disabled with the reason shown.
5. Click Generate. A real elapsed-driven progress line runs against the catalog's ETA estimate for the chosen path, tier, and engine.
-6. When the model lands, orbit it in the viewer, view it in AR, download the GLB, or run the post-generation tools (stylize, optimize, Game-Ready retopology, split). Press `R` (or click **Reel**) to render a shareable video and stills of it without leaving the page.
+6. When the model lands, orbit it in the viewer, view it in AR, download it in any of seven formats (see [Download formats](#download-formats)), or run the post-generation tools (stylize, optimize, Game-Ready retopology, split). Press `R` (or click **Reel**) to render a shareable video and stills of it without leaving the page.
7. Keep going on the same result: **Rig for animation** adds a humanoid skeleton (POST `/api/forge?action=rig`) and hands off to Pose Studio or IRL placement; **Restyle materials** re-skins the surface with a free-text instruction or a preset chip (chrome, wood, gold, neon, marble, rust) via `/api/material-studio`, keeping the mesh untouched; **Iterate** makes a shape-changing edit from a plain-language instruction ("make the helmet red", "add a backpack") via `/api/forge-iterate` (the same conversational core the `refine_model` MCP tool uses) and keeps every version in a branchable lineage strip; **Place IRL** opens `/irl?avatar=<glb_url>` to anchor the model in AR at a real-world location.
+## Download formats
+
+The Download button always hands back the source GLB immediately. The caret
+beside it opens a format menu with seven targets:
+
+| Format | Converted | Use it for |
+|---|---|---|
+| GLB | nothing to convert | The source. Textures embedded, works anywhere glTF does. |
+| OBJ | in your browser | Universal geometry + UVs for Blender, Maya, C4D. No materials. |
+| STL | in your browser | Solid geometry for 3D printing and CAD. Binary. |
+| PLY | in your browser | Vertex-level data for scanning and point-cloud tools. Binary. |
+| USDZ | in your browser | Textured AR asset. Opens directly on iPhone and Vision Pro. |
+| FBX | on the server | Rigged interchange for Unity, Unreal and Maya. Keeps the skeleton, skin weights and blendshapes. |
+| 3MF | on the server | Manufacturing package for slicers and print services. |
+
+The first five are converted by three.js exporters in the page: no upload, no
+queue, and the parsed scene is cached so switching formats does not re-download
+the model. FBX and 3MF have no browser exporter, so they are authored by the
+remesh worker from the source GLB. A server conversion is a real job: it shows
+progress while it runs, names the reason if it fails, and leaves a
+"download again" link for a minute in case the browser missed the download.
+
+Both server formats are the same conversion the API exposes directly, so an
+agent can ask for one without going through the page:
+
+```bash
+# Convert an existing GLB to FBX (geometry untouched, rig preserved).
+curl -sX POST https://three.ws/api/forge-remesh \
+ -H 'content-type: application/json' \
+ -d '{"mesh_url":"https://.../model.glb","operation":"convert","output_format":"fbx"}'
+# → 202 { "job_id": "...", "status": "queued" }
+
+# Poll it. Terminal states are "done" (with result_url) and "failed" (with error).
+curl -s 'https://three.ws/api/forge-remesh?job=<job_id>'
+```
+
+`output_format` accepts `glb`, `obj`, `stl`, `ply`, `usdz`, `3mf` and `fbx`.
+`operation: "convert"` re-containers the mesh without touching its geometry;
+drop it to remesh and convert in one pass (see
+[3d-asset-pipeline.md](3d-asset-pipeline.md)).
+
## Examples
Forge's read and generate surface is plain HTTP. No key is required for the free lanes.
diff --git a/public/changelog.json b/public/changelog.json
index 453913273..34b5e35fc 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-09-03T08:23:37.813Z",
+ "generated_at": "2026-09-03T08:23:29.098Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
diff --git a/public/features.json b/public/features.json
index a9e06a310..6def03384 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-09-03T08:23:37.800Z",
+ "generated_at": "2026-09-03T08:23:29.088Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/src/forge-export.js b/src/forge-export.js
index 066fdb023..64472c780 100644
--- a/src/forge-export.js
+++ b/src/forge-export.js
@@ -1,12 +1,24 @@
// Multi-format export layered onto the forge result viewer.
//
// The download button always offers the source GLB instantly. This module adds
-// a format menu beside it that converts the live model in the browser with
-// three.js exporters — no worker, no queue, no upload:
-// • OBJ — universal geometry for DCC tools (geometry + UVs, no materials)
-// • STL — solid geometry for 3D printing (binary)
-// • PLY — vertex data for scanning/point-cloud tools (binary)
-// • USDZ — textured AR asset for iPhone / Vision Pro
+// a format menu beside it. Most formats convert the live model in the browser
+// with three.js exporters, so there is no worker, no queue and no upload:
+// • OBJ : universal geometry for DCC tools (geometry + UVs, no materials)
+// • STL : solid geometry for 3D printing (binary)
+// • PLY : vertex data for scanning/point-cloud tools (binary)
+// • USDZ : textured AR asset for iPhone / Vision Pro
+//
+// Two formats have no browser exporter and are converted by the remesh worker
+// (POST /api/forge-remesh with operation:"convert"), which authors them from
+// the source GLB and hands back a storage URL:
+// • FBX : rigged interchange for Unity / Unreal / Maya (keeps the skeleton)
+// • 3MF : modern manufacturing package for slicers and print services
+//
+// The worker already backed both formats and the optimize panel already
+// exposed all seven; this menu offered only the five it could do client-side,
+// so the download button and the optimize panel disagreed about what the
+// platform supports. A server format is a real job, so it reports queued
+// progress and can fail with a message rather than resolving instantly.
//
// three.js and the exporters load lazily on first use; the parsed scene is
// cached per model URL so switching formats doesn't re-download the GLB.
@@ -56,6 +68,20 @@ if (download && resultPanel) {
ext: 'usdz',
mime: 'model/vnd.usdz+zip',
},
+ {
+ id: 'fbx',
+ label: 'FBX',
+ blurb: 'Rigged interchange for Unity, Unreal and Maya. Keeps the skeleton. Converted on the server.',
+ ext: 'fbx',
+ server: true,
+ },
+ {
+ id: '3mf',
+ label: '3MF',
+ blurb: 'Manufacturing package for slicers and print services. Converted on the server.',
+ ext: '3mf',
+ server: true,
+ },
];
// ---- markup ------------------------------------------------------------
@@ -78,15 +104,25 @@ if (download && resultPanel) {
.export-split > a { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; }
.export-menu {
position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 40;
- min-width: 290px; padding: 0.35rem;
+ /* Width is capped to the viewport as a first line of defence; the menu
+ is anchored to the button's right edge, which is itself inset, so
+ clampIntoView() below does the rest once the real geometry is known. */
+ width: min(290px, calc(100vw - 1.5rem)); padding: 0.35rem;
+ /* Set by clampIntoView() when right-anchoring would put the left edge
+ off-screen. Zero is the ordinary desktop case. */
+ transform: translateX(var(--export-menu-shift, 0px));
border: 1px solid var(--border, rgba(255,255,255,0.14));
border-radius: 12px;
background: var(--surface-1, #16161d);
box-shadow: 0 16px 40px rgba(0,0,0,0.45);
- opacity: 0; transform: translateY(6px); pointer-events: none;
+ opacity: 0; pointer-events: none;
transition: opacity 0.16s ease, transform 0.16s ease;
}
- .export-menu.is-open { opacity: 1; transform: translateY(0); pointer-events: auto; }
+ .export-menu { transform: translate(var(--export-menu-shift, 0px), 6px); }
+ .export-menu.is-open {
+ opacity: 1; pointer-events: auto;
+ transform: translate(var(--export-menu-shift, 0px), 0);
+ }
.export-item {
display: flex; align-items: baseline; gap: 0.65rem; width: 100%;
padding: 0.55rem 0.7rem; border: 0; border-radius: 8px;
@@ -100,6 +136,12 @@ if (download && resultPanel) {
.export-item .blurb { flex: 1; font-size: 0.78rem; opacity: 0.72; line-height: 1.35; }
.export-item .status { font-size: 0.74rem; min-width: 5.5em; text-align: right; opacity: 0.85; }
.export-item .status.is-error { color: var(--danger, #ff6b6b); }
+ /* A server format's status can carry a whole sentence (a converter error,
+ or the download-again link). The five client-side formats still resolve
+ in a word, so the column only grows when it has something to say. */
+ .export-item .status:has(.export-again), .export-item .status.is-error { min-width: 9em; }
+ .export-item .export-again { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
+ .export-item .export-again:hover, .export-item .export-again:focus-visible { opacity: 1; text-decoration-thickness: 2px; }
.export-spinner {
display: inline-block; width: 0.85em; height: 0.85em; vertical-align: -0.1em;
border: 2px solid currentColor; border-right-color: transparent;
@@ -155,11 +197,33 @@ if (download && resultPanel) {
// ---- menu behavior -------------------------------------------------------
+ // The menu is right-anchored to the split button, which sits inset from the
+ // page edge. On a narrow viewport that puts its LEFT edge off-screen (at
+ // 320px the format names sat at x=-46 and were simply unreadable) without
+ // ever overflowing the document, so no scrollbar appeared to hint at it.
+ // Measure once per open and slide it back inside the gutter.
+ const VIEWPORT_GUTTER_PX = 12;
+ function clampIntoView() {
+ menu.style.removeProperty('--export-menu-shift');
+ const left = menu.getBoundingClientRect().left;
+ if (left < VIEWPORT_GUTTER_PX) {
+ menu.style.setProperty('--export-menu-shift', `${Math.ceil(VIEWPORT_GUTTER_PX - left)}px`);
+ }
+ }
+
function setOpen(open) {
+ // Clamp BEFORE the class flips so the menu animates in already in place,
+ // rather than sliding sideways after the user can see it.
+ if (open) clampIntoView();
menu.classList.toggle('is-open', open);
caret.setAttribute('aria-expanded', String(open));
if (open) menu.querySelector('.export-item')?.focus();
}
+
+ // A resize or an orientation change invalidates the measurement.
+ addEventListener('resize', () => {
+ if (menu.classList.contains('is-open')) clampIntoView();
+ });
const isOpen = () => menu.classList.contains('is-open');
caret.addEventListener('click', () => setOpen(!isOpen()));
@@ -261,6 +325,51 @@ if (download && resultPanel) {
}
}
+ // ---- server conversion (FBX, 3MF) ----------------------------------------
+
+ // Poll cadence and ceiling for a worker conversion. A convert job does no
+ // geometry work, so it lands in seconds on a warm worker; the ceiling exists
+ // for a cold start, which is the slow case worth waiting through rather than
+ // failing the user out of.
+ const CONVERT_POLL_MS = 2_500;
+ const CONVERT_TIMEOUT_MS = 180_000;
+
+ // Aborts an in-flight poll when a new generation replaces the model, so a
+ // stale conversion can never write its result over the new one's status.
+ let convertEpoch = 0;
+
+ async function convertOnServer(format, sourceUrl, onProgress) {
+ const epoch = convertEpoch;
+ const res = await fetch('/api/forge-remesh', {
+ method: 'POST',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({
+ mesh_url: sourceUrl,
+ operation: 'convert',
+ output_format: format.id,
+ }),
+ });
+ const started = await res.json().catch(() => ({}));
+ if (!res.ok || !started.job_id) {
+ throw new Error(started.message || started.error || `the converter returned ${res.status}`);
+ }
+ const deadline = Date.now() + CONVERT_TIMEOUT_MS;
+ while (Date.now() < deadline) {
+ if (epoch !== convertEpoch) return null; // a new model replaced this one
+ await new Promise((r) => setTimeout(r, CONVERT_POLL_MS));
+ if (epoch !== convertEpoch) return null;
+ const pollRes = await fetch(`/api/forge-remesh?job=${encodeURIComponent(started.job_id)}`, {
+ headers: { accept: 'application/json' },
+ });
+ const data = await pollRes.json().catch(() => ({}));
+ if (!pollRes.ok) throw new Error(data.message || `the converter returned ${pollRes.status}`);
+ if (data.status === 'done' && data.result_url) return data.result_url;
+ if (data.status === 'failed') throw new Error(data.error || 'the conversion failed');
+ onProgress(data.status === 'running' ? 'converting' : 'queued');
+ }
+ throw new Error('the conversion timed out');
+ }
+
const busy = new Set();
async function onPick(format, item) {
if (format.id === 'glb') {
@@ -276,8 +385,30 @@ if (download && resultPanel) {
busy.add(format.id);
item.setAttribute('aria-disabled', 'true');
status.classList.remove('is-error');
- status.innerHTML = '<span class="export-spinner" aria-hidden="true"></span> converting';
+ const spin = (label) => {
+ status.innerHTML = `<span class="export-spinner" aria-hidden="true"></span> ${label}`;
+ };
+ spin('converting');
try {
+ if (format.server) {
+ const resultUrl = await convertOnServer(format, url, spin);
+ // Null means a new generation superseded this model mid-conversion;
+ // the status was already cleared for the new one, so say nothing.
+ if (resultUrl === null) return;
+ // The artifact lives in Cloud Storage, a different origin, so the
+ // anchor's `download` attribute is ignored and the browser decides
+ // from the response instead. It is served as an octet-stream, which
+ // downloads rather than navigates. The link stays on screen after
+ // the click so a blocked or missed download is still recoverable
+ // without re-running the whole conversion.
+ triggerDownload(resultUrl);
+ status.innerHTML =
+ `<a class="export-again" href="${resultUrl}" download="${baseName()}.${format.ext}">saved ✓ (download again)</a>`;
+ setTimeout(() => {
+ if (status.querySelector('.export-again')) status.textContent = '';
+ }, 60_000);
+ return;
+ }
const scene = await loadScene(url);
const data = await convert(format, scene);
saveBlob(data, format.mime, `${baseName()}.${format.ext}`);
@@ -287,7 +418,11 @@ if (download && resultPanel) {
}, 4000);
} catch (err) {
log.error(format.id, err);
- status.textContent = 'failed — retry';
+ // Say what went wrong. "failed" alone sent people re-clicking a button
+ // that was never going to work; a converter that is down and a mesh it
+ // cannot read need different responses from the user.
+ const why = format.server && err?.message ? `failed: ${err.message}` : 'failed, retry';
+ status.textContent = why.length > 90 ? `${why.slice(0, 87)}…` : why;
status.classList.add('is-error');
} finally {
busy.delete(format.id);
@@ -295,10 +430,24 @@ if (download && resultPanel) {
}
}
+ // Same-tab anchor click. Kept separate from saveBlob because there is no blob
+ // here: the bytes never enter the page, so nothing needs revoking.
+ function triggerDownload(url) {
+ const a = document.createElement('a');
+ a.href = url;
+ a.download = '';
+ a.rel = 'noopener';
+ document.body.appendChild(a);
+ a.click();
+ a.remove();
+ }
+
// A new generation invalidates the parsed-scene cache (the href changes, but
// clearing eagerly also frees the old scene graph for GC).
document.addEventListener('forge:model-ready', () => {
sceneCache = { url: null, scene: null };
+ // Retire any conversion still polling for the previous model.
+ convertEpoch += 1;
for (const status of itemStatus.values()) {
status.textContent = '';
status.classList.remove('is-error');