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) <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Opus 5.5 committed 2026-10-10 18:47:52 +02:00
1 parent 88781cfcfe
commit 4b68328e3e
2 files changed
+6 -7

No files matched your search

+5 -6
View File
@@ -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
}
+1 -1
View File
@@ -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"},
} {