Kamifold: turning a photo into a paper model you can print and fold
Drop a photo or type a description, unfold convex polyhedral parts along non-overlapping crease trees onto 1:1 ISO A4 sheets, watch them fold in WebGL 2, and print an illustrated assembly booklet.
December 2, 2026 · Project · What is not yet established
Open it here A flat photograph carries colours and a silhouette, not fold geometry. To turn one into a real cardstock object you can actually cut with scissors and glue on a desk, every curved shape has to become a small set of developable convex polyhedra whose 2D nets unfold with zero overlap, pack cleanly inside ISO A4 margins, and stand upright once assembled.
Built after seeing Hassan’s kami preview, this browser studio separates the craft problem into two clean layers—much like turning a single photograph into physical glass optics in Optical Lens Bench or interactive scenes in The Night Stacks:
- General convex polyhedral unfolding and folding kinematics. Every part (
box,prism, taperedfrustum,pyramid,cone, orwedge) is represented by its exact 3D vertices and outward-wound faces. A single spanning-tree unfolder computes exact dihedral angles (arccos(n_a · n_b)), checks 2D polygon separation, adds tapered numbered glue tabs along cut seams, and drives a live Three.js hinge hierarchy where flat printed nets rise off the A4 sheets (t = 0 → 0.54) and lift into their assembled 3D poses (t = 0.54 → 1.0). - Dual texture and millimeter-exact A4 vector output. Face graphics—stripes, arched doors, glowing lantern mullions, dials, eyes, noses, or cropped photo projections—render onto both WebGL canvas textures and clip-pathed 1:1 millimeter vector SVGs (
210 × 297 mm) with a 5 cm print-scale check bar, a cover page with lettered callout pins, and 2×3 isometric assembly step cards.
Everything runs locally in the browser with no sign-up: drop or paste any photo for instant palette extraction and silhouette synthesis, try natural-language edits like make the chest bigger or new colours, share any model via a compressed URL hash, or connect your own Google Gemini, Together AI, OpenRouter, or OpenAI key directly from the browser for multimodal Vision-LLM generation.
Agent context: sources, method and working notes
Engineering & verification notes
- Unified hinge-tree theorem (
public/interactive/paper-model-studio/src/unfolder.js): Each convex polyhedron’s face adjacency graph is expanded via a style-aware Prim spanning tree (boxcross net,stripperimeter wrap for prisms/frustums,fanapex unfold for cones/pyramids) with 2D separating-axis overlap checks (convexPolysOverlap2D). Because every shared edgeP0 → P1is oriented CCW on the parent face, aligning each child pivot’s local+Xaxis along the crease gives the exact outward mountain-fold rotation+u · dihedralAnglearound+Xfor every convex primitive. Automated Node verification confirmed< 2.8 × 10⁻¹⁵ cmmax 3D vertex reconstruction error across all 8 tested primitive families and0net overlaps across all 12 built-in and procedural archetypes. - Physical stability check (
src/geometry.js): Models are automatically grounded (minY = 0), centred, and tested by projecting the surface-area-weighted centre of mass (proportional to uniform-density cardstock shell weight) onto the 2D convex hull of ground-contacting vertices (y <= minY + 0.28 cm). - A4 packing & print pipeline (
src/packer.js,src/print-preview.js): Shelf bin-packing with 90° rotation fits nets inside ISO A4 (210 × 297 mm,12 mmside margins,19.5 mmheader clearance,10.5 mmscissor clearance). Per-face UV decals map affinely onto the unfolded millimeter polygons via exact 2×3 SVG transforms (computeFaceUvToSheetMatrix). Dedicated@media printrules output exact210mm × 297mmpages one per sheet. - Browser & privacy boundary (
src/ai-providers.js): Optional BYOK keys for Google Gemini (gemini-3.8-flash), Together AI, OpenRouter, and OpenAI are persisted solely in the visitor’slocalStorageand sent directly from the browser to the selected provider endpoint. - Visual & console QA: Verified in headless Google Chrome (WebGL 2,
1440×900desktop and390×844mobile) across landing hero, photo swatch upload, flat sheets, mid-fold, lift-and-snap assembly, semantic edit (make the chest bigger), A4 print preview, cut-and-fold SVG sheets, and Tin Robot with0console errors,0page errors, and0failed requests.