🧊 Zpup turns a JSON scene into a flat SVG picture, drawn for AI models to write
In brief
- 🧊 Zpup, inspired by Zdog, renders a small 3D scene written as JSON into a plain SVG seen from any angle.
- 🤖 An MCP server lets Claude and other models write a scene, look at it and correct it; a demo game uses sprite sheets drawn this way.
- 📦 Library is ESM-only with no runtime dependencies, 27 KB gzipped, MIT license; version 1.0.
- ⚠️ No perspective, textures or text, and deeply intersecting shapes are not drawn correctly.
Zpup is a small open-source library on GitHub by rxolve: the user describes a scene of simple solids as JSON and gets back an SVG picture of it from any angle, without JavaScript in the file. 🧊 It is inspired by Zdog and works out which shape is in front of which by comparing every pair of overlapping shapes. The scene is plain data, so a person, a script or an AI model can write it, and invalid input produces errors that say where and how to fix it. An MCP server lets models such as Claude write a scene, look at the result and correct it. According to the project, it is meant for small illustrations with volume and for game sprites, not as a 3D engine.
**What a scene is.** A scene is a tree of nodes: group, dot, path, ellipse, rect, polygon and the solids box, pyramid, cylinder, cone and hemisphere. Each takes position, rotation and scale, and children inherit the transform of their parent. One color per solid is enough, because each face gets a fixed lighter or darker version of it by the direction it faces. To see the scene from another side, only the view angle changes. The project's example is a lighthouse of eleven solids plus a door and a window; one view is 5.5 KB of SVG.
📐 **The depth-sorting claim.** The README says Zdog orders shapes by one point each, so a large ground shape can cover smaller shapes standing on it, which Zdog users fix by hand. Zpup instead compares every pair of overlapping shapes on screen. In the project's own benchmark, the median share of a picture painted in the wrong order was 2.9% and 4.2% for Zdog in two runs, and 0.4% and 0.3% for Zpup. These are the author's figures.
🤖 **Use with AI models.** The scene format is data, and mistakes come back as errors listing every problem with its path, what was expected and how to fix it; a second function lists valid-but-suspicious things such as angles in radians. In Claude Code the MCP server is added with `claude mcp add zpup -- npx -y @zpup/mcp`. The demo game on the project's site shows the idea: a person, a tree, a cabin and animals were each written once as JSON by a model and drawn from eight directions and several poses as sprite sheets. A pose is a short list of changes, mostly joint angles, and a second session added the axe and the load without redrawing the person. The author writes that it is not much of a game, with one cabin and a clock, and that the rules, paths and timing were written by hand.
🌀 **Soft shading and spinning.** By default shapes have one flat color; `shading: "soft"` adds gradients for round surfaces as if lit from the upper left. `renderSpinSvg` produces an SVG that turns the scene one full rotation using SMIL animation, which also plays inside an image tag or a GitHub README. It suits small scenes, since file size grows quickly with the number of pieces, and it does not respect reduced-motion settings.
⚠️ **Limits.** The README says Zpup is not a 3D engine: no perspective, no textures, no light to place, no text shape and no clipping, and shapes that cut deep into each other are not drawn correctly. Those features are listed as not planned. Version 1.0 promises a stable scene format within 1.x, while the exact SVG a scene produces may change. The library is ESM-only, has no runtime dependencies and runs in browsers; bundled and minified it is 75 KB, 27 KB gzipped. Code and reference are on [GitHub](https://github.com/rxolve/zpup) under the MIT license, and there is a [demo game](https://rxolve.github.io/zpup/game/).