TopoTopo v0.2#
Release date: 2026-10-22. The first tagged release; topotopo@0.1.0 on npm was an untagged preview.
TopoTopo is an open-source procedural geometry engine. You describe geometry as a node graph in JSON; the engine cooks it headless and deterministic, and exports it to Unreal, Blender and Houdini. Built for LLM agents through MCP, and for people through the CLI. It runs on Node.js with no GPU and no editor, and every cook is reproducible from the graph and its seeds.
Counts come from the repository at the release commit, with the commands under Counting at the end. Measured numbers come from the repository's benchmarks.
What is in v0.2#
224 node types in 19 categories, 37 shelf assets, 34 example graphs. Every node documents its parameters and carries an example that the tests cook without warnings. The full reference is docs/nodes.md.
Modelling#
- Generators (box, sphere, tube, torus, platonic, grid, terrain, L-systems, text with the bundled DejaVu Sans font), transforms and deformers (noise, twist, bend, taper, soft transform with falloff, lattice, path and point deform, rest positions).
- Polygon editing on a cached half-edge structure:
poly_bevel(edge and point, chamfer and round),poly_extrude,knife,polysplit,polybridge,polyfill(quad fill),edge_divide,dissolve,edge_collapse, crease-awaresubdivide, hard-edgenormal. - Point, vertex, primitive and edge groups with Houdini-style patterns; float, int and string attributes, including array attributes.
- Solids through manifold-3d: robust booleans, hull, Minkowski, clip, slice, Voronoi fracture.
Curves#
- Bezier and NURBS primitives evaluated exactly wherever they are used, sweeps, revolve, loft, 2D offsets and booleans,
fillet_curve,offset_curve_3d,spline_fit,project_curve(roads on terrain),curve_attribs(curveu, frames, ramps). straight_skeleton(Rust/WASM): pitched roofs and polygon offsets for any footprint, holes included.
Instancing and PCG#
- Packed primitives:
copy_to_points {pack: true}keeps a million copies as a million points plus shared meshes, with variants chosen by attribute or weights;pack,unpack, automatic unpacking with a warning where needed. scatterby count or density per m², density attribute and mask, blue noise, relaxation, exact minimum distance.backend: auto(the default) picks the Rust/WebAssembly kernels or parallel TypeScript per stage and workload; every backend, with the worker pool on or off, returns the same points byte for byte.- PCG nodes:
mask(slope, height, curvature, occlusion, distance, direction, noise),attribute_from_map,orient,points_along_curve,cluster,prune.
Terrain#
- 25 heightfield nodes: noise, masks, blur, terrace, cutout, roads (
heightfield_path), projection of meshes and curves, scatter, conversion to mesh and SDF. heightfield_erodewith three models, each followed by a thermal talus pass:method: droplet(seeded droplets; TypeScript by default,backend: kernelfor the WebAssembly port),method: pipe(virtual-pipe shallow water with conservative sediment transport) andmethod: stream_power(pipes plus drainage-driven incision K·A^m·S^n).hardness_layer,freeze_layerand, for pipes,rain_layersteer where it acts. The default (dropletwithbackend: js) gives the same result as before the kernels existed.heightfield_flowwrites D8 or D-infinity drainage and a flow-direction layer for river masks.heightfield_fill_sinksfills closed depressions by priority flood (Barnes et al.), keeps depressions deeper thanmax_depthas lakes and writesfillandlakedepth layers. Withfill_sinks: true,heightfield_flowand stream-power erosion route water over a filled surface without raising the ground, so drainage no longer stops in pits.sample: unreal_trianglesonheightfield_scatterandproject_curvesamples the terrain the way an Unreal Landscape triangulates it (matchesheightfield_to_meshto 2e-14 m), so scattered bases sit on the imported Landscape exactly.- Export as Unreal Landscape heightmaps (16-bit PNG or RAW
.r16with a JSON sidecar), 8-bit weight layers, or oneunreal_landscapebundle with a manifest of the exact Landscape import settings.tile_size(in quads) splits the bundle into tiles that fit Unreal's components exactly: overlapping heightmaps and weight layers that share one encoding range, and one instance stream per tile, each row kept exactly once. The Unreal plugin imports both forms in one command.
Simulation#
Five sim nodes for procedural assembly and set dressing (settled props, debris, cloth over shapes, flow trails), not
film-scale effects:
rbd_settledrops pieces (packed instances or polygon pieces) onto a terrain, a container or a ground plane and lets them come to rest;rbd_stackdrops them one at a time, everyintervalsteps, lifting each above what already lies under it, so crates stack and rocks pile up. Both run on the Rapier physics engine: one convex hull per packed source (reduced tohull_points, 64 by default), continuous collision detection,rest_dampingto end slow wobbling, afallenpoint group (ordelete_fallen), and packed input stays packed. Withanimate: truethe frame shows the drop in progress.examples/rbd_settle.jsonsettles 116 rocks on a 51k-triangle terrain in 2.6 s and stacks 16 crates in 0.35 s.particlesis Houdini's POP network in one node: emission from points, gravity, drag, wind, curl noise, velocity fields from points, heightfields (downhill) or SDFs, attraction, floor and mesh collisions (die, slide, bounce), and trails as polylines. It steps with the frame and caches each frame's state, so frame 48 continues from frame 47, and it is bit-identical with the worker pool on and off. 100k particles × 200 steps with floor collisions take 0.25 s on the pool (1.3 s serial).examples/particles.jsontraces runoff down the ridges of an eroded massif, with a fountain next to it.drapeis XPBD cloth (Vellum-lite): stretch, shear and bend stiffness in physical units, pins (by group, attribute or a pins input), static colliders and the floor, wind and drag, optional self collision, and tethers so pinned cloth does not stretch under its own weight.inflateuses the same solver with a volume constraint for cushions and balloons.examples/drape.jsonhas a tarp over shelf crates, a banner in the wind and a cushion.
Dependency note. Rapier (@dimforge/rapier3d-compat 0.21.0, Apache-2.0) is a regular dependency of the package.
It adds about 5 MB to the download (15 MB unpacked). Its 4.3 MB module, with the WebAssembly inlined, is imported only
when an rbd_* node first cooks (about 60 ms), so graphs without rigid bodies never load it, and a browser bundle can
split it into its own chunk. It stays a regular dependency so that a graph with rigid bodies cooks on every install.
Volumes, remeshing and UVs#
- Implicit SDFs (shapes, expressions, smooth combine) and sampled SDF grids (Rust/WASM) with CSG, offset, blur,
dilate, erode, resample, and meshing by sharp dual contouring or marching cubes (
grid_to_mesh,voxel_remesh). Dual contouring places one QEF vertex per active cell and joins them with edge-dual quads, so box edges and corners come out straight (within 1e-9 voxel); a 256³ band meshes in about 0.9 s, a filled grid in about 1.9 s. remesh_isotropic; field-aligned quad-dominantremesh_quad(Rust/WASM) with feature and crease alignment,quads_onlymode, acleanuppass for short edges and irregular vertices, source attribute transfer, and anirregular_fractiondetail attribute. On the 100k-triangle test sphere 1.83 % of the interior vertices are irregular (2.69 % with UV seams kept), and a quads-only tube asked for 350 faces gets 346 with a regular cap grid.- Attribute-preserving
decimate(meshoptimizer),mesh_repair,lod. uv_unwrap(xatlas),uv_flatten(LSCM),uv_layout,uv_autoseam, and a UV view in the renderer.
Textures and bakes#
- 38 texture nodes: generators (noise, patterns, cells, shapes, gradients, splatter, scratches, text), filters (blend, levels, curves, blur, warp, normal from height, AO from height, channel packing, tile sampler) and bakes in uv space (AO, curvature, thickness, position, normals, height from a high-res mesh, island ids, masks, vertex colour).
image_fileloads your own PNGs (8 or 16 bit, grey or colour) as images for the texture nodes and materials.- Images travel with the geometry; materials reference them as
image:<name>; glTF embeds them, USD writes them next to the file, and thetexturesexport writes PNGs.
Rust/WASM kernels#
- The straight skeleton, sampled SDF grids and dual contouring, quad remeshing, erosion, drainage and depression
filling, and scatter's sample elimination, minimum-distance rejection and relaxation are a Rust crate (
kernels/) compiled to WebAssembly and shipped in the package: no native build and no compiler on the user's machine. - Two builds ship side by side, SIMD (simd128) and scalar, 1.56 MB together. The loader uses SIMD when the runtime
validates a simd128 module and the scalar build otherwise;
TOPOTOPO_WASM=simdorscalaroverrides the choice. Both builds return byte-identical results (688 exact comparisons across 22 kernels in the tests).
Engine#
- Lazy cooking from the output node, a content-signature cache (an edit re-cooks only what is downstream), per-node
errors with did-you-mean hints, Houdini aliases (
copytopoints,attribwrangle,polyextrude…). - Expressions in any parameter (
"=count * 2") that can read other nodes:npoints,bbox,centroid,detail,point,prim,ch. They run in a sandbox that sees only the graph vars, the cook time,Mathand the documented helpers. - Time: every cook happens at a frame; only time-dependent nodes re-cook; a
solvernode with cached frame states. foreach,switch,graph_ref, saved assets; graph versioning with migrations and node deprecation.- A worker pool for heavy per-element work and concurrent branches, with output identical bit for bit to the serial path.
- Code nodes:
wrangle(per element, VEX-style@Psyntax) andscript(whole geometry), run under the script timeout (see Security below).
Shelf#
37 graph assets used like nodes: walls, windows, doors, a whole house built from other assets, gable, hip and
straight-skeleton roofs, stairs, railings, fences, bricks, tiles, props, trees, rocks and PCG helpers. A workspace
asset with the same name overrides a shelf asset.
Rendering and preview#
- A software renderer (no GPU): quad views, turntables, UV view, texture view, colour by attribute, group highlights, flipped normals in blue, section and clip planes with caps, wireframe overlays (all, hard, boundary, groups), normal and orientation glyphs, labels, matcap and AO shading.
- A live viewer that updates when a graph changes;
topotopo view <graph.json>opens it for a graph file and re-cooks on every save, and the MCPpreviewtool opens it for the agent's workspace. It is built as an editor viewport: Maya navigation (Houdini and Blender keymap presets), single and 2 × 2 views with orthographic cameras, an adaptive metre grid with readouts, display modes with flipped faces in blue, click and box selection, an outliner and a properties column, and undo for guides and controls.
Inputs, controls and markers#
The first pieces of the GUI, in the order a person working with an agent needs them:
- Controls. A graph declares the few vars a person tunes as
params(type, range, options, label, step); the viewer draws them as sliders, checkboxes, menus, vectors and colour pickers, and every change re-cooks. - Inputs. People drop their own files onto the viewer or into the workspace's
inputs/folder (beside the graph file undertopotopo view): guide curves, sites and blockouts drawn in Blender, Houdini or Unreal, and PNG masks. The viewer shows them as ghosted reference layers; the MCPinputstool lists them and describes what each holds for the agent, and help topicinputssets the conventions (plainnameandroleattributes; roles site, path, zone, volume, blockout). - Markers. Sites, paths, zones and volumes placed by clicking in the viewer are saved as
inputs/markers.json, which a graph reads like any other input. - Scene import. glTF empties arrive as points with
name,orient,scaleandpscale, the node hierarchy as apathattribute, object extras as attributes and shared meshes as packed primitives..blendfiles load through a headless Blender (found in the usual install places, or setTOPOTOPO_BLENDER), and thefilenode reads a whole folder, naming each piece after its file forcopy_to_pointsvariants.
Unreal plugin#
TopoTopoPCG 0.1.5 (integrations/unreal/TopoTopoPCG, Apache-2.0) for Unreal Engine 5.8:
- Tools > Import TopoTopo scene (console
TopoTopo.ImportScene <bundle> <content folder> landscape=1 layers=1 material=1 objects=1) turns anunreal_landscapebundle into a Landscape with the manifest's exact settings, one paint layer per weight map with a generated landscape material, HISM instances for the instance stream and the static objects;lighting=1adds a sun, sky and fog where the level has none. Tiled bundles become streaming proxies in World Partition levels (one Landscape in plain levels), with one HISM actor per tile. - PCG nodes TopoTopo Point Stream and TopoTopo Instance Spawner read the instance stream inside a PCG graph.
- 19 automation tests pass in the editor, the 536-point PCG graph and the tiled imports among them.
Fixes from real-world use#
- Colours in glTF and USD are now linear, as both formats require: TopoTopo keeps display values internally (the numbers you type and see), and the exporters convert. Files written by v0.1 showed every colour too light in Blender, Unreal and other viewers; re-importing a v0.2 glTF gives back the exact values.
- A constant vertex colour is written as the material colour, and the
unreal_landscapebundle always uses the material colour, because Unreal's default glTF materials ignore vertex colours. - The bundle writes
objects_static.glb(buildings, roads) at any instance count; the plugin (0.1.4) places it, and keeps prototype meshes atMeshes/<name>when a material has the same name. heightfield_projectlevel: meanlevels each building pad at the average ground under it.heightfield_scattermin_distance(exact spacing for lots) andalign: upright | slope:copy_to_pointsaims a copy's +Z along N (Houdini convention), which lays Y-up trees down;alignwrites anorientthat stands them up or follows the slope.variant_weightsalso takes names ({"tree": 3, "bush": 1}).- Several
--renderflags per CLI run share one cook,--max-trianglesdraws dense instancing in full, and the viewer no longer clips at kilometre scale. - Unreal plugin 0.1.5: preview lighting (
lighting=1), and each prototype gets its own material folder (0.1.4 stalled on a dialog when two prototypes shared a material name such asbark). - A parameter outside its range now warns, in cooks and dry runs, instead of clamping silently. The warning found two
assets that had been cutting walls short:
wall_segmentnow allows 60 m and 24 windows,brick_wall40 m. topotopo viewkeeps dropped files ininputs/beside the graph file, so the graph reads them asinputs/<name>and they outlive the viewer.- The CLI lists and documents shelf assets (
--catalog,--help-node house),--layersfilters the Landscape bundle's weight maps, and--versionand bad arguments give one-line answers.
Agent and MCP support#
An MCP server with 13 tools: catalog, help, build, edit, inspect, render, export, graphs, assets,
inputs, explain, diff, preview. An agent can build a whole graph in one call, edit it incrementally, look at a
render, read the files a person dropped in, and verify its work with assert nodes, explain (shape descriptors in
words) and diff (Hausdorff distance between versions).
Interop and verification#
Export formats: GLB/glTF through glTF Transform (materials with embedded textures, EXT_mesh_gpu_instancing with
per-instance attributes, optional meshopt compression and quantization), USDA (PointInstancer, UsdPreviewSurface),
Houdini .geo (every attribute and group, packed prims as PackedGeometry), CSV and points.json instance streams with
Unreal PCG columns, OBJ, PLY, STL and lossless JSON, with Y- or Z-up and scale. The file node reads glTF (including
meshopt and external buffers), .geo, uncompressed .bgeo, CSV, points.json, OBJ, PLY, STL, JSON, PNG (as an
image), .blend (through a local Blender) and whole folders.
npm run export:demo writes the demo scene (examples/unreal_demo.json: a 126 × 126 m eroded terrain, a road, 292
trees and 244 rocks as 536 packed instances) as a Landscape bundle, GLB, USDA, .geo and an instance stream. That
file set was checked in three applications on 2026-10-13:
- Unreal Engine 5.8. The Landscape imported with the manifest values (section size 63, 2 × 2 sections, 2 × 2 components, scale (50, 50, 4.603792), location (0, 0, 1169.3223)); line traces show the terrain ending at ±6300 cm, the low corner at the exported minimum height, and the tree bases on the surface (median gap 0.16 cm). The 536 CSV rows were spawned as actors; applied with Unreal's rotator convention they put all 39,350 transformed vertices within 0.1 cm of the reference geometry, and row 0 reads back from the editor equal to the CSV. GLBs import through Interchange with their materials; the axis mapping is X = x, Y = z, Z = y.
- Blender 5.2.
scene.glbimports as 536 instances sharing 5 mesh datablocks with 7 materials;scene.usdaas 7 meshes plus the PointInstancer. - Houdini 22.0.466.
scene.geoloads with 0 errors: 63,645 polygons and 536 PackedGeometry primitives over 5 embedded sources, every point, primitive, vertex and detail attribute present.
Since then the Unreal plugin imports the same bundle in one command, with every CSV row and the Landscape bounds and transform matching the export, and a whole test environment has been through it: a 1 km² eroded valley with a road, a river mask, 26 houses and 12.9k trees, bushes and rocks, built from one graph in about 6 s and imported as a 2 × 2 tiled bundle.
Testing: npm test chains 43 test programs: smoke (every node type on its fixture), 293 golden fingerprints (222 node
fixtures, 34 example graphs, 37 shelf assets), property tests on 150 random node chains, a fuzz layer (wrangle
snippets, and hostile expressions, scripts and SDF fields that must fail within the script timeout, with the worker
pool off and on), docs staleness, every node's example (cooked without warnings), a NOTICE check, export/import round
trips for every format, scene import, interop checks (every GLB through the Khronos glTF validator), the MCP server end
to end over stdio, the viewer's routes and page logic, the resource limits, and suites per feature: the kernel suites
(780 quad-remesher checks, 2,125 erosion checks, 1,741 exact scatter checks across TypeScript, scalar and SIMD, 688
exact scalar/SIMD comparisons across 22 kernels), particles, rigid bodies and cloth among them. The Rust kernels have
130 tests of their own. CI runs the suite on Ubuntu (Node 22 and 24) and Windows (Node 22). npm run pack:test
installs the packed tarball in an empty folder and runs the CLI, the library import with its types, the worker pool,
both kernel builds, the MCP server and the viewer page from there.
Known limits#
From our measurements (Intel i7-10700K). Most of the kernel and simulation numbers were measured while other jobs loaded the machine, so they are upper bounds rather than idle-machine results.
Performance
remesh_quad: 100k triangles take 5.1 s (sphere) and 4.2 s (grid) with the shipped SIMD build and 7.0 s / 5.4 s with the scalar build, at 98–100 % background CPU load, against a 3 s target. The profiled build measured 4.2 s / 2.9 s at 63–92 % load.heightfield_erode: the pipe model meets its targets (3.0 s in Node with SIMD WebAssembly and 1.9 s native for 1024² × 200 steps, against 4 s / 2 s), but the WebAssembly droplet kernel is only 1.38× faster than the TypeScript default (1.32 s against 1.83 s for 512² × 100), against a 3× target.scatteron 8 cores / 16 threads with the default pool: 100k blue-noise points take 0.65 s (target 0.5 s) and 100k points with a density mask 0.81 s (target 1 s, met); eliminating 1M candidates down to 100k takes 3.2 s (target 1.5 s). With four workers the masked case takes 1.2 s.drape: a 100 × 100 cloth for 200 steps against a 5k-triangle collider takes 3.3–3.4 s at about 73 % load (target 3 s).rbd_settle: 1,000 packed rocks settle in 2.1–2.4 s; a dense 10-layer pile of 1,000 rocks takes 5.5 s.particles: curl noise raises 100k particles × 200 steps from 0.25 s to 2.5 s.- AO bake 2048² × 16 rays about 6 s;
uv_unwrapabout 2.7 s per 20k triangles (xatlas-bound); occlusion 50k × 32 rays about 2 s.
Quality
- Dual contouring: vertices at sharp concave junctions of unions sit up to 0.4 voxel off the surface (target 0.1); there is no adaptive octree; winding numbers for open meshes are approximate.
remesh_quad: hard constraints and validity checks can keep short edges or triangles; structured caps need convex planar disks with an even boundary count of 8–512.heightfield_erode: stream-power drainage is computed once from the incoming terrain and pits remain sinks unlessfill_sinksis on (then it is recomputed over a filled surface every iteration); open pipe edges export water only (sediment stays).- Drainage routed over filled flats runs in straight lines across them, so a river mask looks synthetic there.
- Heightfield nodes cap a field at 4097 × 4097 samples. Tiles split the export, not the field, and the Unreal import assembles the whole grid in memory before it splits it into streaming proxies.
straight_skeletonaccepts at most 4096 vertices; some near-degenerate events return an error instead of a result.- Bit identity across platforms is tested by replay, native/WebAssembly fixtures and scalar/SIMD comparisons on one machine, not by a full platform matrix. Rigid-body results can change with a different Rapier version.
poly_bevelskips boundary edges, clamps with one global factor, and relaxes irregular round corners rather than making them spherical.latticecages are axis-aligned;path_deformfollows polylines only.uv_layoutpacks bounding rectangles;uv_autoseamis rough.- meshoptimizer can pinch thin parts at very low decimation ratios.
- Heightfields are axis-aligned. With the default
sample: bilinear, scattered points can sit a few centimetres off an Unreal Landscape on steep cells; usesample: unreal_triangleswhere that matters. - Splines are written to
.geoand USD as polylines;fillet_curve,offset_curve_3dandproject_curveoutput polylines. - Textures: colour is stored display-referred; no MikkTSpace tangents; bakes cover the 0..1 uv square only.
roof_hiphandles rectangles only (roof_skeletonhandles any footprint).- The self-intersection check in
assertmisses coplanar overlaps;assertexpressions cannot read graph vars. scriptsyntax errors have no line hint.- Time: the live viewer cooks frame 1, MCP
exportwrites a single frame, andsdf_exprand parametric code cannot read time.drapeandinflatedo not depend on the frame; drivestepswith=frameto animate them (each frame re-simulates). - No node editor yet. The viewer shows results, controls, inputs and markers, but has no transform gizmo: a placed marker cannot be moved (delete it and place it again). Wireframe modes draw the triangles of the preview mesh, not the polygon edges.
Simulation
- Rigid bodies: moving pieces collide as convex shapes (hull, box or sphere); there is no convex decomposition, so a
concave piece collides as its hull, and
collision_shape: meshis for static pieces only. Reduced hulls (64 vertices by default) let pieces sink into each other by up to about 5 % of their radius;hull_points: 0uses the exact hull. Heightfields collide as triangles. Unpacked congruent copies are not deduplicated (one hull per piece). - Particles: no particle–particle interaction (no flocking, SPH or inter-particle collisions); a
max_particlesslot stays taken until the particle's life ends; moving colliders do not push particles; sphere collisions are not swept. - Cloth: static colliders only; per-point collision plus corner contacts, so a sharp collider edge can pass between
the points of a coarse cloth; point–point self collision only; no tearing, welds or plasticity;
inflatehas one volume constraint for the whole mesh.
Unreal
- The plugin supports Unreal Engine 5.8 on Win64 and is built from source with RunUAT BuildPlugin (steps in its README); there is no prebuilt binary or Fab listing.
- Static objects (buildings, roads) are not split across tiles.
- Without the plugin, the Landscape import is done by hand in Landscape mode with the values from
landscape.json, and loadinginstances.csvwith PCG's Load Data Table needs a user-defined row struct (Mesh Name, Position Vector, Rotation Rotator, Scale Vector) and the--pcg-structCSV variant. - Export OBJ with
up_axis: zfor Unreal; Unreal keeps a Y-up OBJ lying on its side.
Security
- A graph is code:
"=expr"parameters and the code ofwrangle,script,sdf_exprand similar nodes are JavaScript taken from the graph JSON. On Node, expressions and wrangles run sandboxed in separatevmrealms with a timeout (TOPOTOPO_SCRIPT_TIMEOUT_MS, default 30 s): an expression sees only graph vars, the cook time,Mathand the documented helpers (noprocess,require,import,fetchorglobalThis), and a runaway loop fails its node instead of hanging the process. The same timeout coversscript,heightfield_layerand the parametric nodes, ansdf_exprfield wherever it is sampled (sdf_to_mesh,sdf_gridandparticlessample it under the timeout), and reading whatever such code throws. - That contains mistakes, not attackers: sandboxed code can still allocate memory and burn CPU until the timeout, and
a
vmrealm is not a hard security boundary. Do not cook graphs, shelf assets or workspace assets from untrusted sources in a privileged process, and do not expose the MCP server to untrusted clients. - Hosts without
vm(a browser build of the core) compile expressions withnew Function, without a timeout. - Every count parameter has a maximum, and the long-running nodes (
rbd_settle,rbd_stack,drape,inflate,particles,heightfield_erode) stop after a wall-clock budget (TOPOTOPO_SIM_TIMEOUT_MS, default 600 s). There is no per-cook memory budget. - Meshing a heavy
sdf_exprfield is capped by the same timeout; raiseTOPOTOPO_SCRIPT_TIMEOUT_MSfor large grids.
Install and quick start#
Requires Node.js 22.18 or later.
npx topotopo --catalog # node types by category
npx topotopo --help-node scatter # one node's params, defaults and example
npx topotopo graph.json --render out.png --export out.glb
npx topotopo level.json --node landscape --format unreal_landscape --export out/level # Landscape bundle
npx topotopo view graph.json # live viewer, re-cooks on save
Or install it globally and use the short alias:
npm install -g topotopo
topo graph.json --render out.png
The package ships JavaScript compiled at pack time (npm run build → dist/, run by prepack), the shelf, the bundled
font and both WebAssembly kernel builds, with topotopo and topo as commands and the engine API as the package
export. npm run pack:test installs the tarball in an empty folder and runs these commands there.
From a clone:
git clone https://github.com/topotopo-dev/topotopo
cd topotopo
npm install
npm test
node src/cli.ts examples/house_city.json --render out/house_city.png --export out/house_city.glb
npm run export:demo # the Unreal/Blender/Houdini file set in out/unreal_demo/
npm run preview # the examples in the live viewer
A minimal graph:
{
"vars": { "count": 200 },
"nodes": {
"ground": { "type": "terrain", "params": { "size": [30, 30], "height": 3 } },
"pts": { "type": "scatter", "in": ["ground"], "params": { "count": "=count", "seed": 1 } },
"rock": { "type": "sphere", "params": { "type": "ico", "level": 2, "radius": 0.3 } },
"rough": { "type": "noise_displace", "in": ["rock"], "params": { "amplitude": 0.08, "frequency": 4 } },
"rocks": { "type": "copy_to_points", "in": ["rough", "pts"] },
"out": { "type": "merge", "in": ["ground", "rocks"] }
}
}
MCP server#
For Claude Desktop and other MCP clients:
{
"mcpServers": {
"topotopo": {
"command": "npx",
"args": ["-y", "topotopo", "mcp", "--workspace", "/absolute/path/to/workspace"]
}
}
}
For Claude Code:
claude mcp add topotopo -- npx -y topotopo mcp --workspace /absolute/path/to/workspace
The package exposes the MCP server as the mcp subcommand of its command, as written here. From a clone, point the
client at the server file instead: "command": "node", "args": ["/path/to/topotopo/src/mcp/server.ts", "--workspace", "/path/to/workspace"]. The repository's .mcp.json registers it for Claude Code sessions opened in the folder.
Options: --viewer starts the live preview at once; the workspace, viewer port, script timeout and worker count can
also be set by environment variables (TOPOTOPO_WORKSPACE, TOPOTOPO_PORT, TOPOTOPO_SCRIPT_TIMEOUT_MS,
TOPOTOPO_SIM_TIMEOUT_MS, TOPOTOPO_WORKERS). The server exits when the client closes its stdin.
Licence and contributing#
TopoTopo is licensed under Apache-2.0 (see LICENSE), copyright faxcorp. NOTICE lists every third-party component with
its full licence text; npm test fails if it is out of date. There is no paid edition and no feature held back.
TopoTopo has one maintainer, and reviews can take weeks. Read CONTRIBUTING.md before opening a pull request: open
an issue before large changes, every node needs tests, docs and an example, commits are signed off under the DCO
(git commit -s), and bug reports must include the graph JSON that reproduces the bug. TopoTopo follows the
Contributor Covenant 2.1 (CODE_OF_CONDUCT.md). Contact: hello@topotopo.dev.
How it was built: most of the code was written by AI coding agents (Anthropic Claude models for the engine, OpenAI Codex sessions for the Rust kernels) working on scoped items under the maintainer's direction. Every merge passed the type checker, the full test suite and a review of the rendered examples.
Acknowledgements#
TopoTopo builds on these libraries and assets (versions as in NOTICE):
- manifold-3d 3.5.4 (Apache-2.0): booleans, hull, Minkowski, level sets and Clipper2 2D offsets and booleans.
- Rapier through
@dimforge/rapier3d-compat0.21.0 (Apache-2.0): the rigid bodies ofrbd_settleandrbd_stack. - meshoptimizer 1.3.0 (MIT): decimation, LOD, meshopt compression.
- xatlas through xatlas-wasm 0.1.3 (MIT): UV unwrapping and packing.
- glTF Transform 4.5.1 (MIT): the glTF document model, reader and writer.
- earcut 3.2.4, d3-delaunay 6.0.4 and delaunator 5.1.0 (ISC); robust-predicates 3.0.3 (Unlicense).
- simplex-noise 4.0.3, opentype.js 2.0.0, three.js 0.186.1, fflate 0.8.3 (MIT).
- The Model Context Protocol SDK 1.32.0 and zod 4.6.5 (MIT).
- DejaVu Sans (Bitstream Vera licence; DejaVu changes in the public domain), bundled
as the default font of the
textnode. - Rust crates compiled into the kernels: robust 1.2.0 and wasm-bindgen 0.2.129 / js-sys 0.3.106 (MIT or Apache-2.0), libm 0.2.16 (MIT), earcutr 0.5.0 (ISC), and the rest of the 25 crates that cargo resolves for the WebAssembly target, each with its licence text in NOTICE.
- The Khronos glTF validator checks every GLB in the tests.
NOTICE covers 138 npm packages, 28 optional platform packages (listed with their licences), the 25 Rust crates of the kernels, DejaVu Sans and xatlas. One of the npm packages, sharp, arrives through manifold-3d → glTF Transform functions → ndarray-pixels; its optional platform binaries bundle libvips under LGPL-3.0. TopoTopo does not call it.
Algorithms are original implementations that follow the published work of, among others: Botsch and Kobbelt (isotropic remeshing), Lévy et al. (LSCM), Yuksel (weighted sample elimination), Biedl et al., Huber, and Aichholzer et al. (straight skeletons), Jakob et al. (Instant Field-Aligned Meshes), Barill et al. (fast winding numbers), Mei, Decaudin and Hu, and Šťava et al. (virtual-pipe erosion), Tarboton (D-infinity drainage), Macklin, Müller and Chentanez (XPBD), Bergou et al. (isometric bending), and Bridson et al. (curl noise).
Counting#
The counts above hold at the v0.2.0 tag; these commands from the repository root reproduce them:
# node types, categories and nodes per category (heightfield: 25, texture: 38, sim: 5), from the registry the engine uses
node --input-type=module -e "await import('./src/nodes/index.ts'); const { allNodeDefs } = await import('./src/graph/registry.ts'); const d = allNodeDefs(); const c = {}; for (const x of d) c[x.category] = (c[x.category] ?? 0) + 1; console.log(d.length, 'node types in', Object.keys(c).length, 'categories', c)"
ls shelf/*.json | grep -vc index.json # shelf assets (shelf/index.json is the index, not an asset): 37
ls examples/*.json | wc -l # example graphs: 34
ls test/golden/*.json | wc -l # golden fingerprints: 293 (node.*: 222, example.*: 34, shelf.*: 37)
grep -r '#\[test\]' kernels/src kernels/tests | wc -l # Rust tests: 130
graph_ref and input have no node fingerprint of their own (they only cook inside a parent graph), which is why
there are 222 node fingerprints for 224 node types. npm test is 43 programs chained with && in package.json (42
test files and the NOTICE check), and the check counts are the summary lines those programs print. The 13 MCP tools are
the entries makeTools returns in src/mcp/tools.ts. The NOTICE counts are the entries of its summary,
optional-package and Rust-crate lists.