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): power-of-two texture sizes; 3072 killed every standard-tier bake

nirholas71152113328d
diff --git a/api/_lib/forge-tiers.js b/api/_lib/forge-tiers.js
index 21448fd4e..618e124e6 100644
--- a/api/_lib/forge-tiers.js
+++ b/api/_lib/forge-tiers.js
@@ -639,8 +639,12 @@ export function selfHostPrimary() {
// own etaMultiplier: 2.2 headroom — steps moved the least (biggest linear
// time cost), texture/simplify moved the most (near-free export-time cost).
export const SELFHOST_TRELLIS_QUALITY = Object.freeze({
+ // texture_size MUST be a power of two: TRELLIS's nvdiffrast texture bake
+ // builds a mip stack and hard-fails on any other extent ("Mip-map size
+ // error", proven live 2026-07-16 when standard briefly shipped 3072 and
+ // every standard-tier generation failed at the bake step).
draft: Object.freeze({ ss_steps: 12, slat_steps: 12, simplify: 0.95, texture_size: 1024 }),
- standard: Object.freeze({ ss_steps: 35, slat_steps: 35, simplify: 0.82, texture_size: 3072 }),
+ standard: Object.freeze({ ss_steps: 35, slat_steps: 35, simplify: 0.82, texture_size: 2048 }),
high: Object.freeze({ ss_steps: 50, slat_steps: 50, simplify: 0.65, texture_size: 4096 }),
});
diff --git a/workers/model-trellis/main.py b/workers/model-trellis/main.py
index 50aed747b..fd12e27a5 100644
--- a/workers/model-trellis/main.py
+++ b/workers/model-trellis/main.py
@@ -421,13 +421,21 @@ def _clamped_quality(q: dict | None, tier: str | None = None) -> dict:
return base[key]
return max(lo, min(hi, val))
+ # nvdiffrast's texture bake builds a mip stack and hard-fails on any
+ # non-power-of-two extent (proven live 2026-07-16: a 3072 request killed
+ # every generation at the bake step). Snap the requested size down to the
+ # nearest power of two inside the clamp envelope so no caller value can
+ # crash the bake.
+ tex = num("texture_size", 512, 4096, int)
+ tex = 1 << (int(tex).bit_length() - 1)
+
return {
"ss_steps": num("ss_steps", 8, 50, int),
"slat_steps": num("slat_steps", 8, 50, int),
"ss_cfg": num("ss_cfg", 1.0, 15.0),
"slat_cfg": num("slat_cfg", 1.0, 10.0),
"simplify": num("simplify", 0.5, 0.98),
- "texture_size": num("texture_size", 512, 4096, int),
+ "texture_size": tex,
}