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.

fix(forge): keep isolation suffix for stylized text→image prompts

fudjiaa0e0451c0b81
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b60d73949..a1b1fb2d4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Docs · Trust Primitives** (`/docs/trust-primitives`) — Cross-chain Agent Reputation — score any wallet, mint, or agent id (Solana or EVM) 0–100 from real on-chain evidence before your agent pays, trades, or delegates.
- **3D model inspection is now free** — Validating and optimizing a glTF/GLB no longer costs anything. The new free, keyless /api/3d/inspect takes a model URL (or a raw upload) and returns whether it's spec-valid, its full structural stats — vertices, triangles, materials, textures, animations, extensions — and a severity-ranked list of exactly what to fix to make it smaller and faster for the web. It runs the official Khronos glTF-Validator plus the same inspection core the platform's paid pipelines use. This capability used to be a paid x402 endpoint (model-check); a validation utility should be free — it builds trust and points agents at the paid Forge Pro, Rigged Avatar, and optimization tiers when they need the heavy lifting done for them. `[feature, improvement]`
- **Agent reputation now scores any wallet or agent on any chain** — The paid Agent Reputation endpoint no longer only works on three.ws agents — pass ANY counterparty and get a deterministic 0–100 trust score before you pay, trade, or delegate to it. It auto-detects the type — a Solana wallet, an EVM 0x address, a pump.fun mint, an ERC-8004 agent id, or a three.ws agent_id — and scores it from real on-chain evidence: transaction history, account age, distinct counterparties, holdings, settlement reliability, prior settled agent payments, and ERC-8004 feedback. Every score comes with the underlying evidence links and a clear list of what couldn't be read; an unknown or unscannable subject returns score:null, never a fabricated number. A new batch mode scores up to 25 counterparties in one call. It's a genuine pre-transaction trust primitive that works across chains, not just on our own platform. (`/docs/trust-primitives`) `[feature, improvement]`
+- **Cleaner 3D models from stylized prompts** — Text-to-3D prompts that name an art style — "a cartoon fox," "a stylized robot" — now reliably produce a single, cleanly-isolated model instead of one baked into a busy background scene. The image step that seeds every 3D generation was skipping its "isolated subject on a plain white background" instruction whenever a prompt mentioned a style, which let the image model paint a whole illustrated scene the 3D reconstructor then struggled with. It now keeps that isolation instruction for stylized subjects (and no longer trips on unrelated words like "lightsaber"), so stylized characters and props reconstruct as sharp standalone assets. (`/forge`) `[improvement, fix]`
- **Forge listing sharpened: clear 3D generation tiers for agents** — Forge — our text→3D and image→3D generation — now reads like the crown jewel it is on the x402 agent marketplaces. The listing leads with what agents actually build (game assets, NFT collections, 3D scenes, product viz), spells out the three quality tiers and their flat USDC prices (draft $0.05 / standard $0.15 / high $0.50), and points newcomers to the free keyless draft lane as an on-ramp. The input and output schemas are now complete enough for an agent to call it blind — the prompt, the reference-image mode, the free job-token poll, and the finished GLB — and it's tagged so it surfaces under 3D, AI, and Utility. Under the hood the discovery listing and the live payment challenge now share one source of truth, so what an agent sees can never drift from what it pays for. (`/docs/3d-api`) `[improvement]`
- **Free bonding-curve status API for pump.fun tokens** — A new free, keyless endpoint tells an agent exactly where a pump.fun token sits on its bonding curve: how far along it is toward graduation (%), how much SOL is in the curve, how many tokens are left to buy, and whether it has already graduated and migrated to Raydium or PumpSwap. Timing entries and exits around graduation is a core meme-trading move, and this is the one call that answers it — no account, no key, just GET /api/crypto/bonding?mint=<mint>. It pairs with the live launches feed to watch fresh mints climb their curve. Part of the free three.ws Crypto Data API; full reference with runnable curls at /docs/crypto-api. (`/docs/crypto-api`) `[feature]`
- **Free holder distribution / concentration API** — New free endpoint in the Crypto Data API: GET /api/crypto/holders shows who actually holds a Solana token before you size a position — the top wallets with their share of supply, the cumulative top-10 percentage, and a clear low/medium/high concentration verdict on documented thresholds. When the platform's indexer key is available holders are aggregated by wallet with an exact count; without it the endpoint still returns the chain's real top accounts, clearly labeled. No API key, no account, honest nulls for anything unknowable. (`/docs/crypto-api`) `[feature]`
diff --git a/api/_mcp3d/text-to-image.js b/api/_mcp3d/text-to-image.js
index 7ac76e356..23297d7cc 100644
--- a/api/_mcp3d/text-to-image.js
+++ b/api/_mcp3d/text-to-image.js
@@ -278,22 +278,31 @@ async function nimFluxImage(prompt, aspectRatio, seed = 0) {
throw lastErr || new Error('nim flux failed after retries');
}
-// Words that signal the caller already set their own lighting / background style.
-// When present we leave the prompt untouched; otherwise we append rendering cues
-// that steer FLUX toward clean, bright, single-subject images that bake into
-// better 3D meshes (TRELLIS reconstructs geometry + texture from this image).
-const FLUX_STYLE_WORDS = [
- 'studio', 'light', 'bright', 'backlit', 'background', 'plain', 'colorful',
- 'vibrant', 'white bg', 'isolated', 'cartoon', 'stylized',
+// Background / lighting / composition cues that signal the caller already
+// controls the scene. When one is present we leave the prompt untouched;
+// otherwise we append cues that steer the image toward a single, evenly-lit
+// subject on a plain background, which reconstructs into a far cleaner 3D mesh
+// (TRELLIS / Hunyuan3D build geometry + texture from this one image).
+//
+// These are deliberately NOT art-style words. A "cartoon" or "stylized" subject
+// still needs isolation + a plain background for good reconstruction — gating
+// the suffix on style words (as an earlier version did, which also listed
+// cartoon / stylized / colorful / vibrant) let "a cartoon fox" render a full
+// illustrated forest scene on the Gemini lane: background clutter the 3D backend
+// then tries, and fails, to reconstruct. Match whole words so a substring like
+// "light" inside "lightsaber" can't wrongly suppress the cue either. The suffix
+// only ever gets ADDED relative to the old behavior, so it can only push toward
+// cleaner single-subject references, never toward busier scenes.
+const COMPOSITION_CUE_WORDS = [
+ 'studio', 'light', 'bright', 'backlit', 'background', 'plain', 'white bg', 'isolated',
];
+const COMPOSITION_CUE_RE = new RegExp(`\\b(?:${COMPOSITION_CUE_WORDS.join('|')})\\b`, 'i');
const FLUX_STYLE_SUFFIX = ', isolated subject, bright studio lighting, plain white background';
-function enhanceFluxPrompt(raw) {
+export function enhanceFluxPrompt(raw) {
const text = String(raw || '').trim();
if (!text) return text;
- const lower = text.toLowerCase();
- const hasStyle = FLUX_STYLE_WORDS.some((w) => lower.includes(w));
- return hasStyle ? text : text + FLUX_STYLE_SUFFIX;
+ return COMPOSITION_CUE_RE.test(text) ? text : text + FLUX_STYLE_SUFFIX;
}
// Generate a single image from a text prompt.
diff --git a/data/changelog.json b/data/changelog.json
index 6104b86f8..006aa2af9 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,16 @@
{
"$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-07-07",
+ "title": "Cleaner 3D models from stylized prompts",
+ "summary": "Text-to-3D prompts that name an art style — \"a cartoon fox,\" \"a stylized robot\" — now reliably produce a single, cleanly-isolated model instead of one baked into a busy background scene. The image step that seeds every 3D generation was skipping its \"isolated subject on a plain white background\" instruction whenever a prompt mentioned a style, which let the image model paint a whole illustrated scene the 3D reconstructor then struggled with. It now keeps that isolation instruction for stylized subjects (and no longer trips on unrelated words like \"lightsaber\"), so stylized characters and props reconstruct as sharp standalone assets.",
+ "tags": [
+ "improvement",
+ "fix"
+ ],
+ "link": "/forge"
+ },
{
"date": "2026-07-07",
"title": "Switch walk and platformer modes right from the tour",
diff --git a/docs/gcp-credits.md b/docs/gcp-credits.md
index 96d028b81..f29437f41 100644
--- a/docs/gcp-credits.md
+++ b/docs/gcp-credits.md
@@ -405,9 +405,11 @@ request/response shapes and the gate + fallback are covered by unit tests
**Live E2E passed 2026-07-07**: `generateImage()` against the real project
(`vercel-inference` SA key, `us-central1`) returned a 901 KB on-prompt PNG —
`served by vertex-ai/gemini-2.5-flash-image`, isolated subject on a plain white
-background, visually verified. Remaining before *production* enablement: the
-3–4-prompt reconstruction-quality comparison vs the FLUX lane (below), and the
-Vercel env push. The command used:
+background, visually verified. The 3–4-prompt quality gate is now **also done**
+(results below). Remaining before *production* enablement: the Vercel env push of
+`GOOGLE_CLOUD_PROJECT` + `GCP_SERVICE_ACCOUNT_JSON` (owner action — the image lane
+is `unconfigured` in prod today; `/api/v1/ai/image?health=1` shows `nim` only).
+The E2E command used:
```bash
export GOOGLE_CLOUD_PROJECT=aerial-vehicle-466722-p5
@@ -424,11 +426,40 @@ node -e '
'
```
-Inspect `/tmp/vertex-sample.png` (must be a real, on-prompt image), then compare
-3–4 prompts against the FLUX lane before promoting: Gemini image output is
-photoreal-leaning, so for **stylized 3D reference** images sanity-check that
-reconstruction quality holds. If it regresses, keep the image lane on FLUX
-(`VERTEX_IMAGEN_ENABLED=0`) and use Vertex only for the seed/draft lanes.
+### Quality gate — results (2026-07-07)
+
+Ran the same 4 prompts through the real `gemini-2.5-flash-image` client (`robot`,
+`knight`, `fox`, `chest`), driving `generateImage()` with the `vercel-inference`
+SA key. Verdict: **Gemini is a high-quality, on-prompt reference-image lane, fully
+fit for the paid text→3D chain — not a regression.** All four came back ~0.9–1.4 MB
+PNGs in ~6 s, and 3 of 4 (`robot`, `knight`, `chest`) were textbook 3D references:
+a single centered subject, even studio lighting, pure white background, clean
+readable geometry.
+
+The one outlier (`fox`) surfaced a **real bug in the shared prompt heuristic, not a
+Gemini weakness.** `enhanceFluxPrompt()` gated the isolation suffix on art-style
+words — `"cartoon"` in `"a cartoon fox…"` suppressed
+`", isolated subject, … plain white background"`, so Gemini rendered a full
+illustrated forest scene (mushrooms, trees, path) that the 3D backend cannot
+reconstruct. Re-running the same prompt **with** the suffix produced a perfectly
+isolated cartoon fox on white. Fix shipped: `COMPOSITION_CUE_WORDS` now lists only
+background/lighting/composition cues (no `cartoon`/`stylized`/`colorful`/`vibrant`)
+and matches whole words, so a stylized subject — and substrings like `light` in
+`lightsaber` — still get isolated. The suffix is only ever *added* relative to the
+old behavior, so this improves **both** lanes (FLUX included) and cannot regress
+either. Covered by `tests/api/text-to-image.test.js` (`enhanceFluxPrompt` block).
+
+Live FLUX side-by-side samples were not captured: the prod `/api/v1/ai/image` POST
+returned `FUNCTION_INVOCATION_TIMEOUT` during the run and there is no NVIDIA key in
+the local env, so FLUX could not be driven locally. The verdict rests on the
+inspected Gemini outputs plus the known FLUX.1-schnell characteristics; it does not
+depend on ranking the two lanes, because Gemini stays the **fallback** (NIM FLUX
+still leads the ladder) and its quality clears the bar for that role.
+
+**Recommendation:** quality is not a blocker. Keep **NIM FLUX primary** (free, fast,
+already carries prod) and Gemini as the credit-funded fallback the flag turns on.
+Production enablement is purely the owner-gated Vercel env push below — no quality
+carve-out (draft-lane-only) is needed.
### Deploy & rollback
diff --git a/public/changelog.json b/public/changelog.json
index 386028d15..1443a6dd1 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-07-07T07:43:27.288Z",
+ "generated_at": "2026-07-07T08:56:28.712Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -78,6 +78,17 @@
"improvement"
]
},
+ {
+ "date": "2026-07-07",
+ "type": "update",
+ "title": "Cleaner 3D models from stylized prompts",
+ "summary": "Text-to-3D prompts that name an art style — \"a cartoon fox,\" \"a stylized robot\" — now reliably produce a single, cleanly-isolated model instead of one baked into a busy background scene. The image step that seeds every 3D generation was skipping its \"isolated subject on a plain white background\" instruction whenever a prompt mentioned a style, which let the image model paint a whole illustrated scene the 3D reconstructor then struggled with. It now keeps that isolation instruction for stylized subjects (and no longer trips on unrelated words like \"lightsaber\"), so stylized characters and props reconstruct as sharp standalone assets.",
+ "link": "/forge",
+ "tags": [
+ "improvement",
+ "fix"
+ ]
+ },
{
"date": "2026-07-07",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index ba6e51925..9e57e736f 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -62,6 +62,14 @@
<category>feature</category>
<description>The paid Agent Reputation endpoint no longer only works on three.ws agents — pass ANY counterparty and get a deterministic 0–100 trust score before you pay, trade, or delegate to it. It auto-detects the type — a Solana wallet, an EVM 0x address, a pump.fun mint, an ERC-8004 agent id, or a three.ws agent_id — and scores it from real on-chain evidence: transaction history, account age, distinct counterparties, holdings, settlement reliability, prior settled agent payments, and ERC-8004 feedback. Every score comes with the underlying evidence links and a clear list of what couldn't be read; an unknown or unscannable subject returns score:null, never a fabricated number. A new batch mode scores up to 25 counterparties in one call. It's a genuine pre-transaction trust primitive that works across chains, not just on our own platform.</description>
</item>
+ <item>
+ <title>Cleaner 3D models from stylized prompts</title>
+ <link>https://three.ws/forge</link>
+ <guid isPermaLink="false">2026-07-07:Cleaner 3D models from stylized prompts</guid>
+ <pubDate>Tue, 07 Jul 2026 12:00:00 GMT</pubDate>
+ <category>improvement</category>
+ <description>Text-to-3D prompts that name an art style — &quot;a cartoon fox,&quot; &quot;a stylized robot&quot; — now reliably produce a single, cleanly-isolated model instead of one baked into a busy background scene. The image step that seeds every 3D generation was skipping its &quot;isolated subject on a plain white background&quot; instruction whenever a prompt mentioned a style, which let the image model paint a whole illustrated scene the 3D reconstructor then struggled with. It now keeps that isolation instruction for stylized subjects (and no longer trips on unrelated words like &quot;lightsaber&quot;), so stylized characters and props reconstruct as sharp standalone assets.</description>
+ </item>
<item>
<title>Forge listing sharpened: clear 3D generation tiers for agents</title>
<link>https://three.ws/docs/3d-api</link>
diff --git a/public/features.json b/public/features.json
index 84bcf38a0..06f4e0f6f 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-07-07T04:39:44.817Z",
+ "generated_at": "2026-07-07T08:56:28.695Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/tests/api/text-to-image.test.js b/tests/api/text-to-image.test.js
index d1e07e7c5..e7100f724 100644
--- a/tests/api/text-to-image.test.js
+++ b/tests/api/text-to-image.test.js
@@ -648,6 +648,53 @@ describe('textToImage — VERTEX_IMAGEN_ENABLED gate', () => {
});
});
+describe('enhanceFluxPrompt — 3D-reference isolation suffix', () => {
+ const SUFFIX = ', isolated subject, bright studio lighting, plain white background';
+
+ async function enhance() {
+ const mod = await import('../../api/_mcp3d/text-to-image.js?t=' + Math.random());
+ return mod.enhanceFluxPrompt;
+ }
+
+ it('appends the isolation suffix to a plain subject prompt', async () => {
+ const enhanceFluxPrompt = await enhance();
+ expect(enhanceFluxPrompt('a red teapot')).toBe('a red teapot' + SUFFIX);
+ });
+
+ it('still isolates a stylized subject — style words must not suppress the suffix', async () => {
+ // Regression: "cartoon"/"stylized" are art-style words, not composition cues.
+ // Gating the suffix on them let the Gemini lane render a full illustrated
+ // scene (background clutter the 3D backend cannot reconstruct).
+ const enhanceFluxPrompt = await enhance();
+ expect(enhanceFluxPrompt('a cartoon fox character standing upright')).toBe(
+ 'a cartoon fox character standing upright' + SUFFIX,
+ );
+ expect(enhanceFluxPrompt('a stylized vibrant robot')).toBe('a stylized vibrant robot' + SUFFIX);
+ });
+
+ it('leaves the prompt untouched when it already sets a background / composition cue', async () => {
+ const enhanceFluxPrompt = await enhance();
+ for (const p of [
+ 'a knight on a plain white background',
+ 'an owl figurine, studio lighting',
+ 'a vase isolated on white bg',
+ ]) {
+ expect(enhanceFluxPrompt(p)).toBe(p);
+ }
+ });
+
+ it('matches whole words only — a substring like "light" in "lightsaber" does not suppress', async () => {
+ const enhanceFluxPrompt = await enhance();
+ expect(enhanceFluxPrompt('a glowing lightsaber')).toBe('a glowing lightsaber' + SUFFIX);
+ });
+
+ it('returns an empty prompt unchanged', async () => {
+ const enhanceFluxPrompt = await enhance();
+ expect(enhanceFluxPrompt('')).toBe('');
+ expect(enhanceFluxPrompt(' ')).toBe('');
+ });
+});
+
describe('vertex-imagen — service-account JSON hardening', () => {
it('rejects mangled GCP_SERVICE_ACCOUNT_JSON with a designed unconfigured error', async () => {
process.env.GOOGLE_CLOUD_PROJECT = 'demo-project';