Code Any Shape

Feedforward 3D Program Generation from a Single Image

*Equal contribution†Equal advising

About fifty clay-colored shapes on a round stage around the word GeoFunc and the line 617K programs: mechanical parts in blue, architecture and furniture in orange, household items in green, equipment and vehicles in yellow, organic forms in pink.

OVERVIEW

One image in, an editable 3D program out

Code-Any-Shape reads one image and writes a GeoFunc program in a single forward pass; Blender runs the program to rebuild the shape. Below are its own outputs for five held-out test images, one per domain.

1Input image
Model

Code-Any-Shape

4B vision-language model

One forward pass, no tools

Reading image

0 tokens

2GeoFunc program written in one pass

      
3Executed shape

Drag to turnSwipe sideways to turn

EDITABLE

A program, not a mesh

Dimensions are named parameters, repeated parts are functions, and each part is named by the code that builds it. Change one number and everything derived from it follows.

ACCURATE

80.7% of shapes from one image

On CAS-Bench, in a single pass. The best proprietary model, writing Blender Python in one pass without tools, recovers 47.5%.

FAST

3.2 s per shape

Median on one GPU. It is on par with render-and-compare coding agents built on GPT-6 Astra at about 1/200 of their cost; the agents take 2 to 22 minutes.

DATA

617K programs, 19.8K categories

CAS-600K pairs each program with its image and mesh, across five domains. Every program is verified by execution, and CAS-Bench is its 2,000-item test subset.

Abstract

Most 3D shapes are represented as meshes or other dense formats, which are unstructured and difficult to edit. Code offers a compelling alternative: programs express shapes as structured, editable compositions of parametric operations and can be generated autoregressively by leveraging the priors of large language models. However, existing image-to-program methods are either restricted to mechanical CAD models or rely on iterative render-and-compare agents that incur high inference costs.

To bridge this gap, we present Code-Any-Shape, a vision-language model that generates image-aligned 3D programs in a single forward pass. Specifically, we introduce GeoFunc, a unified general-purpose geometry language, and construct CAS-600K, a large-scale corpus of 617K image-3D-code triplets spanning 19.8K categories across five domains, alongside the CAS-Bench evaluation benchmark. Trained on this data via supervised fine-tuning and reinforcement learning with hierarchical execution-grounded rewards, Code-Any-Shape demonstrates strong visual-geometric alignment. Extensive experiments show that it surpasses frontier proprietary models in geometric accuracy, matches agent-based methods at roughly 200× lower cost, and achieves state-of-the-art performance on CAS-Bench and three external benchmarks.

EXPLORE

Every part has a line of code

Ten held-out test shapes from CAS-600K, two per domain, each with the GeoFunc program that builds it. Hover a part to find its code, or a line to find its part.

Hover a part · drag to turnTap a part · swipe sideways to turn


      

EDIT

Change a value, and the shape follows

Five dataset programs from the paper's editing figure. A slider rewrites one named parameter; a rewrite changes or adds a call. Every combination shown here was executed, and red marks what changed.

Hover a part · drag to turnTap a part · swipe sideways to turn

changed

      

GEOFUNC

One language for CAD, meshes and procedural shapes

GeoFunc is a functional geometry language embedded in Python and executed in Blender. Its 86 words, in 11 families, cover CAD features, mesh modeling and procedural operations.

Functional

Every word is a pure function. It returns a new value and never depends on Blender's selection or mode, so a part can be edited without touching the rest.

Canonical

Each construct has one spelling: fixed argument order, keywords and number format. The model learns geometry instead of style.

Deterministic

Each word is a fixed composition of Blender operations with every input pinned. The same program always builds the same mesh.

Compact

Programs keep their named constants, loops and helper functions. For the same objects, other languages need 0.9 to 7.7 times the tokens and 1.3 to 9.5 times the operation calls.

BENCHMARK

Accurate in one pass, at a fraction of the cost

Each predicted program is executed and its mesh compared with the ground truth. On CAS-Bench, an item counts as solved when the Chamfer distance is below 0.02.

CAS-Bench

Success rate on 2,000 test items, one image in. Failures count as 0.

Proprietary models and open VLMs write Blender Python in a single turn without tools; CAD-Coder reads one image rendered in its own style. cadrille and CADEvolve were built for multi-view input, so they read four and eight ground-truth renders and are not ranked. 3D generators output a mesh, not a program.

Accuracy versus cost

F@0.02 on 20 test items, four per domain, against the inference cost per object.

Scatter plot of F at 0.02 against cost per object on a log scale. Code-Any-Shape sits at 80.5 for 0.0027 dollars, at the top left. The Pareto frontier of prior methods rises from Claude Opus 5.5 at low effort, about 46 for 0.02 dollars, through GPT-6 Astra as a coding agent, 73.4 for 0.52 dollars, to GPT-6 Astra Ultra, 78.5 for 4.58 dollars. Single-pass API runs score 42 to 67, the 3DCodeVerse harness 35 to 45, and VIGA 34.
Figure from the paper. Single passes are one turn without tools, at the reasoning effort in brackets; coding agents render and revise. Code-Any-Shape scores 80.5 at $0.0027 per object, on par with the two GPT-6 Astra coding agents (73.4 and 78.5) at 1/197 and 1/1,721 of their cost. Costs are API list prices or $1.09 per GPU-hour.

External benchmarks

Each scored with the benchmark's own metric code.

Code-Any-Shape against the three strongest prior entries of each benchmark. Prior entries read each benchmark’s own input; Code-Any-Shape reads one untextured render.

COMPARE

One image, sixteen methods

Five test objects, one per domain, with every method of the main results: proprietary models and open VLMs writing Blender Python in a single pass, CAD code models and 3D generators. Pick a method to see its output beside the ground truth.

Ground truth

Drag to turn bothSwipe sideways to turn both


      

Chamfer distance to the ground truth after centering and scaling both meshes to a unit longest edge; success is a distance below 0.02.

CITE

BibTeX

zheng2026codeanyshape
@article{zheng2026codeanyshape,
  title   = {Code Any Shape: Feedforward 3D Program Generation from a Single Image},
  author  = {Zheng, Zehan and Cao, Wei and Wang, Chenlong and Wang, Xingrui and Xu Fei, Esther and
             Xie, Jianwen and Liu, Yaoyao and Chen, Jieneng and Yuille, Alan},
  journal = {arXiv preprint},
  year    = {2026}
}

ACKNOWLEDGMENTS

Part of CAS-600K is translated: 521K of its 617K programs are rewritten in GeoFunc from programs released with 24 public datasets. The other 96K programs are generated by our agentic synthesis pipeline. We thank the authors of these datasets: CADFS, DeepCAD, Zero-to-CAD, CADEvolve, CodeCAD, FutureCAD, CadQuarry, FllumaOne, Fusion 360 Gallery, Thingiverse, the FreeCAD library, WHUCAD, AutoMate, CADExpert, Objaverse, Objaverse-XL, MeshCoder, RFW-A, Infinigen, Articraft, BlendNet, SimReady and Bioinspired3D, and the Sand3D team, whose released programs bring several of these collections into the corpus.