meshforge

A 3D modelling kernel you drive with JSON.

meshforge models, edits and rigs meshes in pure Rust on the CPU. You, or an AI agent, send small JSON commands from the shell, Rust or the browser, and every reply says what changed or how to fix what went wrong.

A chair, a sword and a drilled bracket in four views, rendered by meshforge's own CPU preview

Against headless Blender

Slower than Blender: uv_unwrap_pack_high (0.66x), three of the small uv_unwrap rows (0.93x each) and decimate_10pct_guard (0.99x). Ten rows use more memory than Blender: the eight UV unwrap and UV project rows (uv_unwrap_pack, uv_unwrap_pack_high, the four small uv_unwrap rows, uv_project_pack, uv_project_body), sweep_pipe_knot (0.82x) and decimate_10pct_guard (0.995x). Every row, slow ones included, is on the full board (numbers, footprint, method).

Bar chart: meshforge against headless Blender 5.0.1, speed-up and peak memory per operation; rows where meshforge is slower or uses more memory are orange

Measured on main (568f752); the next release includes these changes; 0.4.0 is slower on some rows.

Board: meshforge at commit 568f752 against headless Blender 5.0.1 (blender -b), on two boat.dev xlarge VMs (16 vCPU, AMD EPYC), 4 threads on each side, Blender and meshforge back to back on the same VM for every row, 4 paired rounds per VM, median of 8. Memory per operation is each op's own peak, measured in a fresh process. Footprint: meshforge at 568f752 (version 0.4.0 on main) against Blender 5.0.1 on x86_64 Linux, median of 3 runs; memory is max RSS. Synthetic and CC0 inputs only.

Install

With a Rust toolchain (pure Rust, no C compiler needed):

cargo install meshforge-cli

With Homebrew on macOS or Linux (Homebrew asks you to trust a third-party tap once):

brew tap partiigames/tap && brew trust partiigames/tap && brew install meshforge

Or download a prebuilt binary for Linux (x86_64, aarch64), macOS (x86_64, Apple silicon) or Windows (x86_64) from GitHub releases; each release lists SHA256SUMS. The library is cargo add meshforge. An npm package (npx meshforge) is coming soon.

Quick start

A beveled crate with a hole drilled through it, written to glTF:

meshforge apply --session crate.mfs -e '{"op":"create_primitive","kind":"cube","name":"crate"}'
meshforge apply --session crate.mfs -e '{"op":"bevel","object":"crate","select":{"sharper_than_deg":30},"width":0.05,"segments":3}'
meshforge apply --session crate.mfs -e '[{"op":"create_primitive","kind":"cylinder","name":"drill","radius":0.2,"height":2,"segments":32},{"op":"boolean","object":"crate","with":"drill","mode":"difference"},{"op":"delete_object","object":"drill"}]'
meshforge apply --session crate.mfs -o crate.glb
meshforge validate crate.glb --text
meshforge preview crate.glb -o crate.png --style beauty

The whole session with its real output and the rendered preview: quick start. Every op: meshforge ops --text.

For AI agents

meshforge was built for a model working in a loop. An agent with a shell needs nothing else:

  1. Discover. meshforge ops --text lists every op; meshforge ops bevel boolean prints their fields, types and defaults in one line each; meshforge ops --all is the whole API as JSON, and --format json-schema or --format gbnf gives a grammar. Unknown fields are errors, so a misspelled argument never falls back to a default.
  2. Act in small batches: one JSON command or an array, with the state kept in a session file (--session name.mfs). Select by meaning, such as {"faces_facing":[0,1,0]} or {"tag":"top"}, not by id.
  3. Read the reply. One JSON object on stdout: ok, warnings, and per object tris, shells, boundary_loops and bbox. A failed command changes nothing and returns error.code, message and a hint.
  4. Look. meshforge preview renders four views to a PNG; inside-out faces are hatched magenta, and with --json the reply counts them (back_faces_visible).
  5. Stay in budget. Every command predicts its face count before it allocates and fails with budget_exceeded instead of running away.

Read next: the command reference, the CLI guide, AGENTS.md and SKILL.md (a drop-in agent skill). For agents fetching docs: llms.txt, and everything in one file: llms-full.txt. There is no MCP server yet; agents call the CLI.

What it does

Edit opsextrude, inset, loop cut, bevel (edges and vertices), Catmull-Clark subdivide, mirror, merge by distance, displace, transform, join, duplicate; linear, radial and grid arrays
Shapesprimitives; sweep, pipe, revolve (lathe), loft; helix and thread; 3D text in a built-in font or a TrueType font
Booleansunion, difference, intersection with exact predicates; watertight output
Modifiersa non-destructive stack: subdivide, mirror, bevel, array, solidify
UVsunwrap (LSCM and ARAP charts, or fast planar projection) and packing
Decimatequadric edge collapse that carries UV seams, normals, colours and skin weights
Riggingskeletons, automatic skin weights (bone heat), weight transfer, posing
Placement and fitrest objects on surfaces, align, check contacts and floating parts; shrinkwrap, snap to surface, poke-through checks
Sessionundo and redo, named checkpoints, face budgets, tags and selectors, area, volume and closedness queries
FilesglTF 2.0 in and out (.glb, .gltf), STL in and out, OBJ in, meshopt-compressed glTF in
Previewa CPU renderer that writes four views to one PNG
Experimentalmay change garment fitting, face refinement, hair cards and their metrics

Details per release: what is in 0.4.0, changelog.

In the browser

The same JSON commands run as WebAssembly, on the CPU, with no GPU needed: meshforge-wasm (wasm-bindgen; cargo add meshforge-wasm) and an ES-module runtime with workers and three.js buffers in web/runtime. The main wasm module is 3.02 MB, 0.97 MB gzipped. A batch that works in the CLI runs unchanged in a browser tab. Guide: browser and node runtime.

Licence and source

Dual-licensed under MIT or Apache-2.0, at your option. Source: github.com/PartiiGames/meshforge. meshforge is written from published papers and permissively licensed libraries, each cited with its licence in NOTICE; no Blender code is used.

meshforge is built with AI coding agents.