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.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
feat(forge): pass texture size and face budget through to the TRELLIS.2 worker
nirholas781dc5d97c5e
diff --git a/api/_providers/gcp.js b/api/_providers/gcp.jsindex 67d38913a..c948ded51 100644--- a/api/_providers/gcp.js+++ b/api/_providers/gcp.js@@ -196,6 +196,9 @@ function buildWorkerRequest(request) {if (Number.isFinite(Number(params?.resolution))) body.resolution = Math.round(Number(params.resolution));if (params?.tier) body.tier = params.tier;if (Number.isFinite(Number(params?.seed))) body.seed = Math.floor(Number(params.seed));+ // The worker clamps both (512 to 4096 px, 50k to 2M faces).+ if (Number.isFinite(Number(params?.texture_size))) body.texture_size = Math.round(Number(params.texture_size));+ if (Number.isFinite(Number(params?.decimation_target))) body.decimation_target = Math.round(Number(params.decimation_target));return {path: '/infer',resultKey: 'result_gcs_url',diff --git a/api/forge.js b/api/forge.jsindex c1fb0115c..8d8e2bf4f 100644--- a/api/forge.js+++ b/api/forge.js@@ -2141,6 +2141,10 @@ async function startJobWithBody(req, res, body) {// the tier (draft 512, standard and high 1024).resolution: opts.resolution ?? undefined,tier: tier.id,+ // Bake overrides. Absent, the resolution preset decides+ // (512: 2048 px and 300k faces, 1024 and 1536: 4096 px).+ texture_size: opts.textureSize ?? undefined,+ decimation_target: opts.targetPolycount ?? undefined,},} : {mode: 'trellis',diff --git a/tests/api/forge-trellis-selfhost.test.js b/tests/api/forge-trellis-selfhost.test.jsindex 7be4bb3a3..2d5b2e40d 100644--- a/tests/api/forge-trellis-selfhost.test.js+++ b/tests/api/forge-trellis-selfhost.test.js@@ -20,6 +20,7 @@ import { createRegenProvider } from '../../api/_providers/gcp.js';const VARS = ['MODEL_TRELLIS_URL',+ 'MODEL_TRELLIS2_URL','GCP_RECONSTRUCTION_KEY','NVIDIA_API_KEY','HF_TOKEN',@@ -328,3 +329,60 @@ describe('gcp provider — trellis quality forwarding', () => {}});});++describe('gcp provider — trellis2 mode wire contract', () => {+ it('forwards resolution, seed and the bake overrides to the TRELLIS.2 worker', async () => {+ process.env.MODEL_TRELLIS2_URL = 'https://trellis2.example.run.app';+ process.env.GCP_RECONSTRUCTION_KEY = 'secret';+ let sent = null;+ globalThis.fetch = vi.fn(async (url, opts) => {+ expect(url).toBe('https://trellis2.example.run.app/infer');+ sent = JSON.parse(opts.body);+ return new Response(JSON.stringify({ task_id: 'task-t2', status: 'queued' }), {+ status: 202,+ headers: { 'content-type': 'application/json' },+ });+ });+ const provider = createRegenProvider();+ await provider.submit({+ mode: 'trellis2',+ sourceUrl: 'https://three.ws/cdn/photo.png',+ params: {+ images: ['https://three.ws/cdn/photo.png'],+ resolution: 1536,+ seed: 7,+ tier: 'standard',+ texture_size: 2048,+ decimation_target: 300000,+ },+ });+ expect(sent).toMatchObject({+ images: ['https://three.ws/cdn/photo.png'],+ resolution: 1536,+ seed: 7,+ tier: 'standard',+ texture_size: 2048,+ decimation_target: 300000,+ });+ });++ it('leaves the bake overrides to the resolution preset when absent', async () => {+ process.env.MODEL_TRELLIS2_URL = 'https://trellis2.example.run.app';+ process.env.GCP_RECONSTRUCTION_KEY = 'secret';+ let sent = null;+ globalThis.fetch = vi.fn(async (_url, opts) => {+ sent = JSON.parse(opts.body);+ return new Response(JSON.stringify({ task_id: 'task-t3', status: 'queued' }), {+ status: 202,+ headers: { 'content-type': 'application/json' },+ });+ });+ await createRegenProvider().submit({+ mode: 'trellis2',+ sourceUrl: 'https://three.ws/cdn/photo.png',+ params: { images: ['https://three.ws/cdn/photo.png'], tier: 'draft' },+ });+ expect(sent).not.toHaveProperty('texture_size');+ expect(sent).not.toHaveProperty('decimation_target');+ });+});