From 4b68328e3e4c30fb95b97108fe7e405f73e90293 Mon Sep 17 00:00:00 2001 From: Ilker Manap Date: Sat, 10 Oct 2026 18:47:52 +0200 Subject: [PATCH] A mesh's resolution is the model's own: a multiple of 32 from 64 to 2048 TripoSR takes 256 by default; 512, 1024 and 1536 were TRELLIS.2's alone. Co-Authored-By: Claude Opus 5.5 (1M context) --- internal/router/meshes.go | 11 +++++------ internal/router/meshes_test.go | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/internal/router/meshes.go b/internal/router/meshes.go index d2e0a96..1bdcea9 100644 --- a/internal/router/meshes.go +++ b/internal/router/meshes.go @@ -34,8 +34,9 @@ type meshRequest struct { Image string `json:"image"` Seed *int64 `json:"seed"` Steps int `json:"steps"` - // Resolution is the model's own grid, where it has a choice: TRELLIS.2 - // makes 512, 1024 or 1536. Zero leaves it to the workflow. + // Resolution is the model's own grid, where it has a choice: TripoSR's + // marching cubes take 256 by default, TRELLIS.2 512 to 1536. Zero leaves + // it to the workflow. Resolution int `json:"resolution"` picture []byte @@ -82,10 +83,8 @@ func parseMeshRequest(body []byte) (meshRequest, error) { if in.Steps < 0 || in.Steps > maxSteps { return in, fmt.Errorf("steps is between 1 and %d", maxSteps) } - switch in.Resolution { - case 0, 512, 1024, 1536: - default: - return in, fmt.Errorf("resolution %d is not 512, 1024 or 1536", in.Resolution) + if r := in.Resolution; r != 0 && (r < 64 || r > 2048 || r%32 != 0) { + return in, fmt.Errorf("resolution %d is not a multiple of 32 from 64 to 2048", r) } return in, nil } diff --git a/internal/router/meshes_test.go b/internal/router/meshes_test.go index 76cbef0..61fdd4a 100644 --- a/internal/router/meshes_test.go +++ b/internal/router/meshes_test.go @@ -228,7 +228,7 @@ func TestA3DModelIsAskedOfAModelThatMakesThem(t *testing.T) { "a mesh of flux": {meshesPath, map[string]any{"model": "flux", "image": testPicture(t)}, "makes pictures, not 3D models"}, "no picture": {meshesPath, map[string]any{"model": "trellis2"}, "image is required"}, "not a picture": {meshesPath, map[string]any{"model": "trellis2", "image": base64.StdEncoding.EncodeToString([]byte("hello"))}, "not a PNG"}, - "an odd resolution": {meshesPath, map[string]any{"model": "trellis2", "image": testPicture(t), "resolution": 700}, "not 512, 1024 or 1536"}, + "an odd resolution": {meshesPath, map[string]any{"model": "trellis2", "image": testPicture(t), "resolution": 700}, "multiple of 32"}, "a picture of trellis2": {imagesPath, map[string]any{"model": "trellis2", "prompt": "a cube"}, "makes 3D models, not pictures"}, "a chat with trellis2": {"/v1/chat/completions", map[string]any{"model": "trellis2", "messages": []any{}}, "makes 3D models"}, } {