topotopo 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (354) hide show
  1. package/NOTICE +40 -10
  2. package/README.md +475 -111
  3. package/dist/cli.js +328 -133
  4. package/dist/config.d.ts +48 -0
  5. package/dist/config.js +170 -0
  6. package/dist/core/analysis.d.ts +5 -1
  7. package/dist/core/analysis.js +8 -3
  8. package/dist/core/bake.d.ts +16 -8
  9. package/dist/core/bake.js +165 -29
  10. package/dist/core/bevel.d.ts +3 -1
  11. package/dist/core/bevel.js +238 -97
  12. package/dist/core/decimate.d.ts +65 -0
  13. package/dist/core/decimate.js +409 -3
  14. package/dist/core/erosion.d.ts +37 -0
  15. package/dist/core/erosion.js +41 -1
  16. package/dist/core/geometry.d.ts +5 -1
  17. package/dist/core/geometry.js +204 -4
  18. package/dist/core/heightfield.d.ts +27 -4
  19. package/dist/core/heightfield.js +54 -16
  20. package/dist/core/imageops.d.ts +6 -0
  21. package/dist/core/imageops.js +51 -0
  22. package/dist/core/intrinsics.d.ts +7 -0
  23. package/dist/core/intrinsics.js +94 -0
  24. package/dist/core/manifold.d.ts +12 -1
  25. package/dist/core/manifold.js +78 -6
  26. package/dist/core/materials.d.ts +11 -0
  27. package/dist/core/materials.js +56 -0
  28. package/dist/core/noise.d.ts +9 -0
  29. package/dist/core/noise.js +10 -1
  30. package/dist/core/packed.js +11 -0
  31. package/dist/core/particles.d.ts +1 -1
  32. package/dist/core/particles.js +1 -1
  33. package/dist/core/polymerge.d.ts +21 -0
  34. package/dist/core/polymerge.js +327 -0
  35. package/dist/core/rbd.js +13 -1
  36. package/dist/core/repair.d.ts +2 -0
  37. package/dist/core/repair.js +2 -0
  38. package/dist/core/report.d.ts +70 -0
  39. package/dist/core/report.js +275 -0
  40. package/dist/core/scatter.d.ts +1 -1
  41. package/dist/core/scatter.js +1 -1
  42. package/dist/core/scene.d.ts +20 -0
  43. package/dist/core/scene.js +72 -0
  44. package/dist/core/sha256.d.ts +4 -0
  45. package/dist/core/sha256.js +69 -0
  46. package/dist/core/shapes.d.ts +3 -0
  47. package/dist/core/shapes.js +34 -0
  48. package/dist/core/snippet-lib.d.ts +15 -2
  49. package/dist/core/snippet-lib.js +40 -14
  50. package/dist/core/solidify.d.ts +38 -0
  51. package/dist/core/solidify.js +356 -0
  52. package/dist/core/tangents.d.ts +54 -0
  53. package/dist/core/tangents.js +218 -0
  54. package/dist/core/texcoord.d.ts +4 -0
  55. package/dist/core/texcoord.js +14 -0
  56. package/dist/core/texnoise.d.ts +6 -1
  57. package/dist/core/texnoise.js +6 -2
  58. package/dist/core/texsdf.d.ts +131 -0
  59. package/dist/core/texsdf.js +637 -0
  60. package/dist/core/texture.d.ts +163 -9
  61. package/dist/core/texture.js +844 -20
  62. package/dist/core/topology.d.ts +32 -0
  63. package/dist/core/topology.js +238 -7
  64. package/dist/core/traceimage.d.ts +7 -0
  65. package/dist/core/traceimage.js +221 -0
  66. package/dist/core/tritri.d.ts +5 -0
  67. package/dist/core/tritri.js +120 -0
  68. package/dist/core/unwrap.d.ts +72 -0
  69. package/dist/core/unwrap.js +800 -0
  70. package/dist/core/usercode.d.ts +27 -0
  71. package/dist/core/usercode.js +87 -0
  72. package/dist/core/uv.d.ts +15 -16
  73. package/dist/core/uv.js +36 -189
  74. package/dist/core/uvislands.d.ts +62 -0
  75. package/dist/core/uvislands.js +574 -0
  76. package/dist/core/uvoverlap.d.ts +58 -0
  77. package/dist/core/uvoverlap.js +220 -0
  78. package/dist/core/uvpack.d.ts +64 -0
  79. package/dist/core/uvpack.js +628 -0
  80. package/dist/core/uvreport.d.ts +127 -0
  81. package/dist/core/uvreport.js +372 -0
  82. package/dist/core/wrangle.d.ts +6 -1
  83. package/dist/core/wrangle.js +27 -16
  84. package/dist/core/xatlas.d.ts +16 -1
  85. package/dist/core/xatlas.js +95 -61
  86. package/dist/engines.d.ts +63 -0
  87. package/dist/engines.js +180 -0
  88. package/dist/explain.d.ts +4 -3
  89. package/dist/explain.js +129 -12
  90. package/dist/graph/engine.d.ts +92 -29
  91. package/dist/graph/engine.js +298 -148
  92. package/dist/graph/expr.d.ts +6 -3
  93. package/dist/graph/expr.js +18 -8
  94. package/dist/graph/outputs.d.ts +23 -0
  95. package/dist/graph/outputs.js +41 -0
  96. package/dist/graph/packages.d.ts +72 -0
  97. package/dist/graph/packages.js +261 -0
  98. package/dist/graph/parallel.d.ts +3 -1
  99. package/dist/graph/parallel.js +4 -1
  100. package/dist/graph/params.d.ts +6 -0
  101. package/dist/graph/params.js +34 -7
  102. package/dist/graph/scope.d.ts +55 -0
  103. package/dist/graph/scope.js +14 -0
  104. package/dist/graph/types.d.ts +75 -12
  105. package/dist/graph/types.js +4 -2
  106. package/dist/graph/vars.d.ts +16 -0
  107. package/dist/graph/vars.js +80 -0
  108. package/dist/host/artifacts.d.ts +10 -1
  109. package/dist/host/artifacts.js +37 -6
  110. package/dist/host/cook.d.ts +241 -0
  111. package/dist/host/cook.js +844 -0
  112. package/dist/host/export-targets.d.ts +42 -5
  113. package/dist/host/export-targets.js +72 -13
  114. package/dist/host/godot-commands.d.ts +4 -0
  115. package/dist/host/godot-commands.js +21 -0
  116. package/dist/host/godot.d.ts +183 -0
  117. package/dist/host/godot.js +916 -0
  118. package/dist/host/node.d.ts +12 -7
  119. package/dist/host/node.js +27 -9
  120. package/dist/host/pool.js +51 -2
  121. package/dist/host/sidecars.d.ts +8 -0
  122. package/dist/host/sidecars.js +50 -0
  123. package/dist/host/types.d.ts +19 -6
  124. package/dist/host/version.d.ts +1 -0
  125. package/dist/host/version.js +3 -0
  126. package/dist/host/worker.js +5 -2
  127. package/dist/index.d.ts +5 -3
  128. package/dist/index.js +3 -2
  129. package/dist/inspect.d.ts +84 -1
  130. package/dist/inspect.js +271 -24
  131. package/dist/io/common.d.ts +33 -5
  132. package/dist/io/export.js +2 -1
  133. package/dist/io/files.d.ts +23 -4
  134. package/dist/io/files.js +60 -8
  135. package/dist/io/gltf.js +355 -51
  136. package/dist/io/heightmap.d.ts +3 -0
  137. package/dist/io/heightmap.js +1 -0
  138. package/dist/io/import.js +10 -0
  139. package/dist/io/inspect-scene.d.ts +55 -0
  140. package/dist/io/inspect-scene.js +155 -0
  141. package/dist/io/kinds.d.ts +81 -0
  142. package/dist/io/kinds.js +163 -0
  143. package/dist/io/points.d.ts +2 -1
  144. package/dist/io/points.js +3 -1
  145. package/dist/io/sidecars.d.ts +24 -0
  146. package/dist/io/sidecars.js +57 -0
  147. package/dist/io/source.d.ts +65 -0
  148. package/dist/io/source.js +112 -0
  149. package/dist/io/targets.d.ts +47 -3
  150. package/dist/io/targets.js +149 -14
  151. package/dist/io/textures.js +21 -1
  152. package/dist/io/unreal.js +5 -1
  153. package/dist/mcp/docs.d.ts +10 -1
  154. package/dist/mcp/docs.js +816 -119
  155. package/dist/mcp/inputs.d.ts +12 -5
  156. package/dist/mcp/inputs.js +50 -13
  157. package/dist/mcp/server.js +70 -24
  158. package/dist/mcp/tools.d.ts +14 -7
  159. package/dist/mcp/tools.js +207 -108
  160. package/dist/mcp/verify.d.ts +2 -2
  161. package/dist/mcp/verify.js +1 -1
  162. package/dist/mcp/workspace.d.ts +15 -0
  163. package/dist/mcp/workspace.js +349 -0
  164. package/dist/nodes/attributes.js +198 -1
  165. package/dist/nodes/bake.js +207 -83
  166. package/dist/nodes/beam.d.ts +1 -0
  167. package/dist/nodes/beam.js +201 -0
  168. package/dist/nodes/bevel.js +54 -5
  169. package/dist/nodes/cloth.js +2 -0
  170. package/dist/nodes/code.js +22 -10
  171. package/dist/nodes/curves.js +440 -93
  172. package/dist/nodes/flow.js +53 -33
  173. package/dist/nodes/generate.js +13 -39
  174. package/dist/nodes/heightfield.js +248 -77
  175. package/dist/nodes/imageops.d.ts +1 -0
  176. package/dist/nodes/imageops.js +203 -0
  177. package/dist/nodes/index.d.ts +4 -0
  178. package/dist/nodes/index.js +4 -0
  179. package/dist/nodes/material.js +91 -23
  180. package/dist/nodes/measure.js +45 -18
  181. package/dist/nodes/particles.js +2 -0
  182. package/dist/nodes/pcg.js +6 -5
  183. package/dist/nodes/procedural.js +4 -3
  184. package/dist/nodes/rbd.js +1 -1
  185. package/dist/nodes/remesh.js +71 -15
  186. package/dist/nodes/scene.d.ts +1 -0
  187. package/dist/nodes/scene.js +55 -0
  188. package/dist/nodes/sdf.js +10 -5
  189. package/dist/nodes/solid.js +20 -5
  190. package/dist/nodes/solidify.d.ts +1 -0
  191. package/dist/nodes/solidify.js +52 -0
  192. package/dist/nodes/splines.d.ts +15 -1
  193. package/dist/nodes/splines.js +112 -105
  194. package/dist/nodes/texture.d.ts +21 -6
  195. package/dist/nodes/texture.js +1318 -185
  196. package/dist/nodes/topology.d.ts +7 -0
  197. package/dist/nodes/topology.js +133 -6
  198. package/dist/nodes/transform.js +11 -3
  199. package/dist/nodes/util.d.ts +1 -1
  200. package/dist/nodes/uv.js +192 -174
  201. package/dist/nodes/wasmcall.js +6 -2
  202. package/dist/open.d.ts +19 -0
  203. package/dist/open.js +12 -0
  204. package/dist/package.d.ts +288 -0
  205. package/dist/package.js +772 -0
  206. package/dist/packages/check.d.ts +32 -0
  207. package/dist/packages/check.js +169 -0
  208. package/dist/packages/commands.d.ts +57 -0
  209. package/dist/packages/commands.js +537 -0
  210. package/dist/packages/registry.d.ts +796 -0
  211. package/dist/packages/registry.js +2998 -0
  212. package/dist/packages/update.d.ts +124 -0
  213. package/dist/packages/update.js +476 -0
  214. package/dist/render/options.d.ts +2 -0
  215. package/dist/render/options.js +44 -5
  216. package/dist/render/pbr.d.ts +28 -0
  217. package/dist/render/pbr.js +378 -0
  218. package/dist/render/preview.d.ts +69 -0
  219. package/dist/render/preview.js +26 -0
  220. package/dist/render/raster.d.ts +78 -7
  221. package/dist/render/raster.js +600 -145
  222. package/dist/render/texview.d.ts +7 -1
  223. package/dist/render/texview.js +34 -2
  224. package/dist/scan.d.ts +61 -0
  225. package/dist/scan.js +228 -0
  226. package/dist/session.d.ts +311 -0
  227. package/dist/session.js +849 -0
  228. package/dist/viewer/app/api.js +48 -6
  229. package/dist/viewer/app/camera.js +1 -1
  230. package/dist/viewer/app/cooking.js +78 -0
  231. package/dist/viewer/app/embed.js +100 -0
  232. package/dist/viewer/app/export-popover.js +118 -16
  233. package/dist/viewer/app/grid.js +6 -2
  234. package/dist/viewer/app/guides.js +123 -1
  235. package/dist/viewer/app/keymap.js +7 -4
  236. package/dist/viewer/app/layers.js +5 -5
  237. package/dist/viewer/app/main.js +186 -53
  238. package/dist/viewer/app/markers.js +61 -1
  239. package/dist/viewer/app/outliner.js +72 -27
  240. package/dist/viewer/app/output-info.js +45 -0
  241. package/dist/viewer/app/outputs.css +147 -8
  242. package/dist/viewer/app/outputs.js +168 -54
  243. package/dist/viewer/app/packages.js +614 -0
  244. package/dist/viewer/app/props.js +177 -53
  245. package/dist/viewer/app/scene.js +35 -6
  246. package/dist/viewer/app/select.js +5 -4
  247. package/dist/viewer/app/selection.js +1 -1
  248. package/dist/viewer/app/status.js +12 -15
  249. package/dist/viewer/app/style.css +66 -8
  250. package/dist/viewer/app/units.js +1 -1
  251. package/dist/viewer/app/vars.js +48 -1
  252. package/dist/viewer/app/welcome.js +72 -0
  253. package/dist/viewer/graph-file.d.ts +62 -0
  254. package/dist/viewer/graph-file.js +175 -0
  255. package/dist/viewer/index.html +24 -11
  256. package/dist/viewer/json-edit.d.ts +13 -0
  257. package/dist/viewer/json-edit.js +274 -0
  258. package/dist/viewer/outputs.d.ts +49 -5
  259. package/dist/viewer/outputs.js +264 -56
  260. package/dist/viewer/packages.d.ts +121 -0
  261. package/dist/viewer/packages.js +584 -0
  262. package/dist/viewer/server.d.ts +24 -7
  263. package/dist/viewer/server.js +289 -31
  264. package/dist/web/app/web.css +419 -0
  265. package/dist/web/app/web.js +188 -0
  266. package/dist/web/bake.d.ts +34 -0
  267. package/dist/web/bake.js +153 -0
  268. package/dist/web/folder-page.d.ts +101 -0
  269. package/dist/web/folder-page.js +146 -0
  270. package/dist/web/folders.d.ts +280 -0
  271. package/dist/web/folders.js +970 -0
  272. package/dist/web/library.d.ts +91 -0
  273. package/dist/web/library.js +228 -0
  274. package/dist/web/markdown.d.ts +45 -0
  275. package/dist/web/markdown.js +677 -0
  276. package/dist/web/pages.d.ts +258 -0
  277. package/dist/web/pages.js +301 -0
  278. package/dist/web/server.d.ts +24 -0
  279. package/dist/web/server.js +1068 -0
  280. package/dist/workspace.d.ts +88 -105
  281. package/dist/workspace.js +359 -375
  282. package/integrations/godot/addons/topotopo/LICENSE +202 -0
  283. package/integrations/godot/addons/topotopo/README.md +57 -0
  284. package/integrations/godot/addons/topotopo/context_menu.gd +43 -0
  285. package/integrations/godot/addons/topotopo/dock.gd +266 -0
  286. package/integrations/godot/addons/topotopo/dock.tscn +72 -0
  287. package/integrations/godot/addons/topotopo/export_filter.gd +72 -0
  288. package/integrations/godot/addons/topotopo/gltf_instancing.gd +131 -0
  289. package/integrations/godot/addons/topotopo/icons/topotopo.svg +1 -0
  290. package/integrations/godot/addons/topotopo/inspector.gd +38 -0
  291. package/integrations/godot/addons/topotopo/instances_post_import.gd +111 -0
  292. package/integrations/godot/addons/topotopo/package.gd +23 -0
  293. package/integrations/godot/addons/topotopo/package_importer.gd +187 -0
  294. package/integrations/godot/addons/topotopo/plugin.cfg +7 -0
  295. package/integrations/godot/addons/topotopo/plugin.gd +970 -0
  296. package/integrations/godot/addons/topotopo/record.gd +435 -0
  297. package/integrations/godot/addons/topotopo/runner.gd +458 -0
  298. package/integrations/godot/addons/topotopo/tools/check.gd +42 -0
  299. package/integrations/godot/addons/topotopo/watcher.gd +199 -0
  300. package/kernels/pkg/README.md +23 -29
  301. package/kernels/pkg-simd/README.md +23 -29
  302. package/library/architecture/versions/1.0/architecture.topo +12 -0
  303. package/{shelf → library/architecture/versions/1.0/graphs}/arch.json +3 -3
  304. package/{shelf → library/architecture/versions/1.0/graphs}/beam_truss.json +6 -6
  305. package/{shelf → library/architecture/versions/1.0/graphs}/brick_wall.json +8 -8
  306. package/{shelf → library/architecture/versions/1.0/graphs}/door_frame.json +3 -3
  307. package/{shelf → library/architecture/versions/1.0/graphs}/hex_grid_floor.json +3 -2
  308. package/{shelf → library/architecture/versions/1.0/graphs}/house.json +8 -8
  309. package/library/architecture/versions/1.0/graphs/lineup.json +42 -0
  310. package/{shelf → library/architecture/versions/1.0/graphs}/pillar.json +3 -2
  311. package/{shelf → library/architecture/versions/1.0/graphs}/railing.json +5 -5
  312. package/{shelf → library/architecture/versions/1.0/graphs}/roof_gable.json +2 -2
  313. package/{shelf → library/architecture/versions/1.0/graphs}/roof_hip.json +2 -2
  314. package/{shelf → library/architecture/versions/1.0/graphs}/roof_skeleton.json +2 -1
  315. package/{shelf → library/architecture/versions/1.0/graphs}/scaffold.json +4 -4
  316. package/{shelf → library/architecture/versions/1.0/graphs}/spiral_stairs.json +3 -2
  317. package/{shelf → library/architecture/versions/1.0/graphs}/stairs.json +6 -6
  318. package/{shelf → library/architecture/versions/1.0/graphs}/tile_floor.json +3 -2
  319. package/{shelf → library/architecture/versions/1.0/graphs}/wall_segment.json +10 -10
  320. package/{shelf → library/architecture/versions/1.0/graphs}/window_frame.json +2 -2
  321. package/library/architecture/versions/1.0/version.json +1119 -0
  322. package/{shelf → library/nature/versions/1.0/graphs}/bush.json +2 -2
  323. package/{shelf → library/nature/versions/1.0/graphs}/cliff_block.json +4 -3
  324. package/{shelf → library/nature/versions/1.0/graphs}/forest_patch.json +5 -5
  325. package/{shelf → library/nature/versions/1.0/graphs}/grass_clumps.json +2 -2
  326. package/library/nature/versions/1.0/graphs/lineup.json +24 -0
  327. package/{shelf → library/nature/versions/1.0/graphs}/log.json +6 -6
  328. package/{shelf → library/nature/versions/1.0/graphs}/rock.json +5 -4
  329. package/{shelf → library/nature/versions/1.0/graphs}/scatter_rocks.json +5 -5
  330. package/{shelf → library/nature/versions/1.0/graphs}/tree_lowpoly.json +3 -2
  331. package/library/nature/versions/1.0/nature.topo +12 -0
  332. package/library/nature/versions/1.0/version.json +534 -0
  333. package/{shelf → library/props/versions/1.0/graphs}/barrel.json +5 -4
  334. package/{shelf → library/props/versions/1.0/graphs}/crate.json +3 -3
  335. package/library/props/versions/1.0/graphs/lineup.json +18 -0
  336. package/{shelf → library/props/versions/1.0/graphs}/pallet.json +4 -3
  337. package/{shelf → library/props/versions/1.0/graphs}/pipe_run.json +3 -3
  338. package/{shelf → library/props/versions/1.0/graphs}/sandbag_wall.json +5 -5
  339. package/library/props/versions/1.0/props.topo +12 -0
  340. package/library/props/versions/1.0/version.json +336 -0
  341. package/{shelf → library/street/versions/1.0/graphs}/bench.json +5 -5
  342. package/{shelf → library/street/versions/1.0/graphs}/bollard.json +2 -1
  343. package/{shelf → library/street/versions/1.0/graphs}/cable.json +4 -4
  344. package/{shelf → library/street/versions/1.0/graphs}/fence.json +7 -7
  345. package/{shelf → library/street/versions/1.0/graphs}/lamp_post.json +2 -2
  346. package/library/street/versions/1.0/graphs/lineup.json +22 -0
  347. package/{shelf → library/street/versions/1.0/graphs}/road_strip.json +2 -2
  348. package/{shelf → library/street/versions/1.0/graphs}/sign_post.json +1 -1
  349. package/library/street/versions/1.0/street.topo +12 -0
  350. package/library/street/versions/1.0/version.json +421 -0
  351. package/package.json +23 -8
  352. package/dist/graph/migrate.d.ts +0 -23
  353. package/dist/graph/migrate.js +0 -58
  354. package/shelf/index.json +0 -190
package/dist/mcp/docs.js CHANGED
@@ -1,29 +1,33 @@
1
1
  import { CATEGORY_ORDER } from '../graph/registry.js';
2
+ import { PACKAGE_COMMANDS } from '../packages/commands.js';
3
+ import { GODOT_COMMANDS } from '../host/godot-commands.js';
2
4
  export const INSTRUCTIONS = `TopoTopo: a procedural geometry engine (Houdini-SOP style) you drive with JSON node graphs.
3
5
 
4
6
  WORKFLOW
5
- 0. inputs {action:"list"} → the person's own files in the workspace inputs/ folder (guide curves, sites, zones, blockouts, PNG masks). Building a landscape or scene: look there first and build on them (help topic "inputs").
6
- 1. catalog → see node types (100+, Houdini names work as aliases: copytopoints, attribwrangle, polyextrude, mountain…).
7
+ 0. inputs {action:"list"} → the person's own files in the package inputs/ folder (guide curves, sites, zones, blockouts, PNG masks). Building a landscape or scene: look there first and build on them (help topic "inputs").
8
+ 1. catalog → see node types (100+, Houdini names work as aliases: copytopoints, attribwrangle, polyextrude, mountain…) and TopoTopo's own packages, ready-made generators by full name (topotopo/architecture/house, topotopo/nature/tree_lowpoly, topotopo/street/road_strip …).
7
9
  2. help {nodes:[...]} for exact params before using unfamiliar nodes; help {topic:"wrangle"|"graph"|"recipes"…} for concepts.
8
10
  3. build {graph} the WHOLE network in one call (dry_run:true validates without cooking). Every response reports errors per node with did-you-mean hints.
9
11
  4. render to SEE it (quad view: persp/front/right/top; backfaces are tinted blue = flipped normals; views "quad_uv" + checker:true for UVs; overlays for specific questions: wireframe "hard"/"boundary", views "section", glyphs "N", label_groups, shading "matcap", see help topic "render"). inspect for numbers (bbox, attributes, watertightness).
10
12
  5. edit {ops} for incremental changes (set params, insert nodes, rewire) — only downstream nodes re-cook.
11
- 6. export to glb/gltf (materials, textures, meshopt), geo (Houdini), csv (Unreal PCG points / instance rows), points.json, usda, obj/ply/stl/json for Unreal, Blender, Houdini; unreal_landscape = a whole terrain scene for Unreal.
13
+ 6. export to glb/gltf (materials, textures, meshopt), geo (Houdini), csv (Unreal PCG points / instance rows), points.json, usda, obj/ply/stl/json for Unreal, Blender, Houdini; unreal_landscape = a whole terrain scene for Unreal. Every export records its source (graph, vars, seeds, frame, version) so it can be made again (help topic "export").
12
14
  7. verify: assert nodes guard invariants in the graph (watertight, counts, bbox, expr); explain {graph} reads a result in words; diff {a, b} shows what an edit changed. See help topic "verify".
13
- OUTPUTS: publish intended deliverables in graph.outputs: {"rotor":{"node":"rotor_final","label":"Rotor"}}. The default graph.output stays unchanged. The viewer lists every graph and named result, its generated textures and image layers; clicking a result isolates it. Rendered images and exports are saved and visible too. Use descriptive names; keep intermediate work in the node outliner. Rename/remove edits maintain published references.
15
+ OUTPUTS: publish intended deliverables in graph.outputs: {"rotor":{"node":"rotor_final","label":"Rotor"}}. The default graph.output stays unchanged. The viewer lists every graph and named result, its generated textures and image layers; clicking a result isolates it. Each card says what the result is (mesh, instances, points, curves, terrain, textures, material, volume or scene; its size) and offers the formats that write it: Download (the export as a file, or a zip with its sidecars) and Export (its target in exports/). Rendered images and exports are saved and visible too. Use descriptive names; keep intermediate work in the node outliner. Rename/remove edits maintain published references. In a package that publishes versions, give each output "tags" (["conifer", "low-poly"]: search finds outputs by them) and a "description" (else its graph's is recorded); "kind" (mesh, instances, points, curves, terrain, textures, material, volume, scene; a mesh with scene_null sockets is a mesh; materials alone are a material) pins what it must cook to: build warns and publishing blocks when it does not.
14
16
  INSTANCING: copy_to_points {pack:true} / pack make packed instances (millions stay cheap; glb, usda and geo export them as instances, csv/points.json as one row per instance). See help topic "instancing".
15
17
  PCG: mask → scatter {density_mask} → orient → prune → copy_to_points {pack, variants, variant_weights}; points_along_curve, cluster, attribute_from_map. See help topic "pcg".
16
18
  CURVES: bezier / nurbs make spline prims (CVs + order, exact everywhere); convert_curve, resample, fillet_curve, offset_curve_3d, project_curve (roads on terrain), spline_fit, curve_attribs (curveu, frames, ramps). See help topic "curves".
17
19
  CLOTH: drape {steps} simulates a mesh as cloth over a collider (input 1) and the floor, from pins (pin_group / input 2) and in wind; inflate {pressure} puffs a closed mesh into a cushion or balloon. See help topic "cloth".
18
20
 
19
21
  CONVENTIONS: Y-up, metres, angles in degrees (wrangle trig uses radians). Houdini attribute names (P N Cd uv pscale orient up scale width name class piece). Polygons are closed prims, polylines are open prims.
20
- GRAPH: {"nodes": {"name": {"type": "...", "in": ["upstream", ...], "params": {...}}}, "output": "name", "vars": {"k": 1}}. Params accept "=expr" using vars (e.g. "=height*0.5"), time (frame, time) and other nodes (npoints('pts'), bbox('base').size.y, ch('box1/size')).
22
+ GRAPH: {"nodes": {"name": {"type": "...", "in": ["upstream", ...], "params": {...}}}, "output": "name", "vars": {"k": 1}}. Params accept "=expr" using vars by their bare name (e.g. "=height*0.5"), time (frame, time) and other nodes (npoints('pts'), bbox('base').size.y, ch('box1/size')). Code (wrangle, script, sdf_expr, heightfield_layer, parametric, group and assert expressions) reads vars the same way: height, not vars.height.
21
23
  HUMANS TUNE VARS: declare "params" for the 3–8 vars a person would tune ({"k": {type, desc, min, max, options, label, step}}); the live viewer (preview) shows them as sliders and menus. People change vars at any time, so read the graph (graphs {action:"get"}) before assuming a var's value. See help topic "graph".
22
24
  TIME: build/edit/render/inspect/export take "frame" (default 1). solver = per-frame feedback (growth, accumulation). See help topic "time".
23
25
  PARTICLES: particles(emitter points, collision mesh, field) = Houdini POPs in one node: emission, gravity/drag/wind, curl noise, fields, floor and mesh collisions, trails as polylines; steps with the frame. See help topic "particles".
24
26
  ESCAPE HATCHES: wrangle (per-element JS with @P/@Cd syntax), script (whole-geometry JS with the engine library), sdf_expr (signed distance functions). If a node is missing, write it with these.
25
- TERRAIN: heightfield → heightfield_noise → heightfield_erode → masks / heightfield_path → heightfield_scatter + copy_to_points, heightfield_to_mesh; export png16 for an Unreal Landscape, or unreal_landscape for the landscape + layers + instances bundle. See help topic "heightfield".
26
- PHYSICS: rbd_settle drops pieces (packed instances) onto a terrain/container/ground until they rest, so scattered rocks and props sit in contact; rbd_stack drops them one at a time into piles. See help topic "rbd".`;
27
+ TERRAIN: heightfield → heightfield_noise → heightfield_erode → masks / heightfield_path → heightfield_scatter + copy_to_points, heightfield_to_mesh; heightfield_crop works on one tile of a big map; export png16 for an Unreal Landscape, or unreal_landscape for the landscape + layers + instances bundle. See help topic "heightfield".
28
+ PHYSICS: rbd_settle drops pieces (packed instances) onto a terrain/container/ground until they rest, so scattered rocks and props sit in contact; rbd_stack drops them one at a time into piles. See help topic "rbd".
29
+ WORKSPACE, PACKAGE, LIBRARY: a package is a folder of graphs and the models they make, marked by one <id>.topo file; every tool works in the open package. A workspace is a folder tree with topotopo-workspace.json at its root, best inside the engine's content folder (the Godot project, Unreal's Content/): every folder in it with a .topo file is a package, its packages find each other by themselves, use the shared libraries its file lists and share one copy of each package version, and their exports stay in each package's exports/, where the engine imports them. A library is a registered folder of packages, shared across workspaces; outside a workspace a package finds packages in every registered library. The web app (topotopo web) shows the workspaces and libraries (the person's board links to them), and TopoTopo ships one library built in. The workspace tool works on all three: workspace {action:"list"} finds a package, {action:"open"} makes it the folder every tool works in, {action:"create"} starts one, {action:"show"} says what the open package's workspace holds, {action:"check"} cooks what it relies on and lists what broke (after a TopoTopo update). See help topic "workspace".
30
+ PACKAGES: a package uses the published outputs of other packages as node types, {"type": "owner/name/output"} (help {nodes:[...]} gives their params and version); a build that names one adds it to the package once the graph validates. TopoTopo's own packages are four packages built into TopoTopo, used the same way: topotopo/architecture (walls, windows, doors, houses, roofs, stairs, railings, floors), topotopo/nature (rocks, cliffs, trees, bushes, logs, forests, grass), topotopo/props (barrels, crates, pallets, sandbags, pipes) and topotopo/street (roads, lamp posts, bollards, benches, signs, fences, cables), e.g. {"type": "topotopo/nature/rock", "params": {"size": 2}}. Only a package's graphs use packages: when the server starts it makes its folder a package if the folder holds nothing but a package's own folders (its first reply says so), and workspace {action:"init"} makes any other folder one when the person says so. workspace {action:"packages"} lists them, {action:"search", query?, kind?, tag?} finds outputs in the places the package looks in ("a conifer", every terrain) and says whether the package can use each, {action:"libraries", add} lists a shared library the person names for the workspace, {action:"publish", dry_run:true} says what publishing would do (show it to the person; publish {note} only when they say so), {action:"outdated"} lists newer versions, {action:"update", package} shows the before/after of an update, which you apply (from, to, apply:true) only when the person says so. See help topic "packages".`;
27
31
  /**
28
32
  * The complete example of help topic "inputs": guides.glb's path.* curves cut roads into a heightfield and its zone.*
29
33
  * areas mask a tree scatter; the vars a person tunes are exposed as params. test/mcp.ts cooks it on a real guides.glb.
@@ -41,7 +45,7 @@ export const INPUTS_EXAMPLE = {
41
45
  zone_mask: { type: 'heightfield_mask_by_object', in: ['road', 'areas'], params: { by: 'footprint', distance: 0, falloff: 3 } },
42
46
  off_road: { type: 'heightfield_layer', in: ['zone_mask'], params: { layer: 'mask', expression: 'mask * (1 - path)' } },
43
47
  spots: { type: 'heightfield_scatter', in: ['off_road'], params: { density: '=tree_density', align: 'upright', seed: 3 } },
44
- tree: { type: 'tree_lowpoly', params: { height: 7 } },
48
+ tree: { type: 'topotopo/nature/tree_lowpoly', params: { height: 7 } },
45
49
  trees: { type: 'copy_to_points', in: ['tree', 'spots'], params: { pack: true } },
46
50
  land: { type: 'heightfield_to_mesh', in: ['off_road'], params: { color: 'terrain' } },
47
51
  out: { type: 'merge', in: ['land', 'trees'] },
@@ -61,6 +65,107 @@ export function graphLines(g) {
61
65
  return `{${parts.join(',\n ')}}`;
62
66
  }
63
67
  export const TOPICS = {
68
+ workspace: `WORKSPACE, PACKAGE, LIBRARY (the three words, and the workspace tool)
69
+ - A WORKSPACE is a folder tree: one production, a game, an archviz job, with topotopo-workspace.json at its root. Its
70
+ best place is inside the engine's content folder (Godot: the project folder or a folder in it; Unreal: Content/ or a
71
+ folder in it), so Explorer, the engine and the web app show one tree and the engine imports each package's exports/.
72
+ - A PACKAGE is a folder of graphs and the models they make, marked by one <id>.topo file, its manifest (the file's
73
+ name is the package id). Every folder of a workspace with a .topo file is a package of it, and the packages of a
74
+ workspace find each other by themselves. Every tool works in one package, the open package; only a package's graphs
75
+ use other packages. A package that publishes versions is used by other packages by name (help topic "packages").
76
+ - A LIBRARY is a folder of packages registered on this machine by name (\`topotopo library add <name> <folder>\`, kept
77
+ in ~/.topotopo/config.json), shared across workspaces: a workspace lists the libraries it uses. TopoTopo's built-in
78
+ library, "topotopo", is always there. Workspaces and libraries share one set of names.
79
+ The workspace tool works on all three; its actions that use or publish packages are in help topic "packages".
80
+
81
+ A PACKAGE'S FOLDER
82
+ props/lantern/lantern.topo {title, description, tags, graph:"main", bake:{graph?, node?, frame?}, links:[{label, url}],
83
+ name?:"owner/name", uses}
84
+ props/lantern/graphs/ assets/ inputs/ exports/ graphs, saved assets, the person's input files, exports
85
+ props/lantern/attachments/ concept art, references, source files (shown on the package's page)
86
+ props/lantern/.web/ thumb.png, preview.glb, bake.json: derived, never edit
87
+ A folder holds one package at most (two .topo files in a folder are an error), and a package holds no other package.
88
+ Plain folders group packages: props/, levels/, a Godot project's assets/.
89
+
90
+ WORKING IN A PACKAGE
91
+ - workspace {action:"list", query?, tag?} → find one in the registered libraries and workspaces (and the open
92
+ package's workspace); workspace {action:"get", library, id, thumbnail:true} → what it holds ("library": a library's
93
+ or a workspace's name).
94
+ - workspace {action:"open", library, id} (or {path}) → every tool (build, edit, render, export, inputs, assets,
95
+ preview) now works in that folder. Build the package's model into graph "main" (or the manifest's "graph").
96
+ - workspace {action:"create", library, path:"props/barrel", title, tags, links} → a new package in a library or a
97
+ workspace, opened.
98
+ - workspace {action:"init"} → the server's folder becomes a package where it is none (<id>.topo in its folder), when
99
+ the person wants its graphs to use packages. When the server starts it makes its folder, named or not, a package
100
+ if the folder is in no package and holds nothing but what TopoTopo makes itself (graphs/, assets/, exports/,
101
+ inputs/), or nothing at all; a folder with anything else in it (a repository, the person's own files) stays as it is
102
+ until the person says so.
103
+ - workspace {action:"set", tags, links, description, bake:{frame: 48}} → edit the manifest (bake.frame for
104
+ simulations that settle after frame 1; bake.node to show one part).
105
+ - workspace {action:"bake"} → render the previews now and see the thumbnail.
106
+ Put reference images the person gives you in attachments/, guide files in inputs/. Links in "links" point back to the
107
+ board or concept pages, so the package page and the board link both ways. To find a ready-made output ("a conifer",
108
+ every terrain): workspace {action:"search", query?, kind?, tag?}.
109
+
110
+ WORKSPACES: topotopo-workspace.json at the workspace's root:
111
+ {"name": "my-game", "libraries": ["props", "../shared/materials"],
112
+ "engine": {"type": "godot", "project": "../project.godot"}, "follow": false, "uses": {"topotopo/props": "1.1"}}
113
+ Paths are written from the workspace's folder. The person makes one: CLI topotopo workspace init <folder>
114
+ [--engine godot:<path>|unreal:<path>|none] [--library <name or folder>] [--follow]; MCP workspace
115
+ {action:"init_workspace", path, ...} when the person says so. workspace {action:"show"} (CLI: topotopo workspace)
116
+ says what the open package's workspace holds: its packages as the scan finds them.
117
+ - THE SCAN: every folder below the root with exactly one .topo file is a package; the scan does not enter a package.
118
+ It skips dot folders, node_modules, topotopo-packages, Unreal's Binaries, Intermediate, Saved, DerivedDataCache,
119
+ __ExternalActors__ and __ExternalObjects__, C#'s bin and obj beside a .csproj or .sln, a folder holding another
120
+ engine project than the workspace's own, another workspace (listed, not scanned) and a TopoTopo checkout; it goes 16
121
+ folders deep and says which folder it cut off there.
122
+ - WHERE A PACKAGE LOOKS: in a workspace, the workspace itself, then the shared libraries its file lists, in order, then
123
+ TopoTopo's built-in library. Outside a workspace: the library the package is in (a registered library's root or a
124
+ library.json above it, read from the package's own checkout), then every other registered library, then the built-in
125
+ library. A name comes from the first place that has it; the same name in a later place is not used (packages and
126
+ search say "also in …, not used"). Only the built-in library has the packages named "topotopo/…". Two folders of one
127
+ place publishing the same name leave the name out (said, naming both), and publishing blocks while they do. A library
128
+ listed by the workspace that lies inside it, or holds it, is a problem: its packages are found by themselves.
129
+ - SHARED LIBRARIES: "libraries" holds registered names and paths to folders outside the workspace. The person lists
130
+ one: CLI topotopo workspace library add|remove <name or folder> [--workspace <folder>]; MCP workspace
131
+ {action:"libraries", add:"props"} (a relative path is read from the server's folder), only when the person names it.
132
+ {action:"libraries"} alone says what the workspace lists. Registering a library is the person's own act.
133
+ - ONE COPY PER WORKSPACE: the packages inside share one copy of each package version, in topotopo-packages/ beside the
134
+ file, whose "uses" names one version of each package for the whole workspace. A first use in any package adds it
135
+ there; Update compares every place any package of the workspace uses the updated package, and applying changes them
136
+ all. A package that publishes versions keeps its own uses and copies (they are published with it). workspace init
137
+ moves the copies of the packages inside that kept their own.
138
+ - FOLLOWING: "follow": true shows the workspace's own packages live from their working folders, for looking (the
139
+ viewer, renders, inspect); exports and publishing always use the published versions, and an export made while
140
+ following says which it used.
141
+ - THE ENGINE: "engine" names the engine project ({"type", "project"}, the path written from the workspace and leading
142
+ upward when the workspace is inside it) or "none" (kept). workspace init finds it: the nearest at or above the
143
+ folder, else one below. It says when Unreal will not see the workspace (outside the project's Content/ or a plugin's),
144
+ which packages lie outside a project found below (their exports are not imported), and which Godot export presets
145
+ would ship TopoTopo's files, with the exclude_filter entries to add. An export lands in its package's exports/, which
146
+ the engine imports where the workspace is inside it. Inside a Godot project TopoTopo keeps a .gdignore in each
147
+ package's versions/, packages/ and inputs/ (its working folders, not game content); files engines write beside ours
148
+ (*.import, *.uid, *.uasset …) never count as TopoTopo's.
149
+ - CHECK: workspace {action:"check"} (CLI: topotopo check) cooks the newest version of the workspace's packages that
150
+ publish, every graph of the others and the newest versions in the shared libraries it lists, and lists what broke
151
+ and why; it changes nothing but missing .gdignore files. Run it after a TopoTopo update.
152
+
153
+ LIBRARIES AND THE WEB APP: a library holds packages in folders below it; the parent folders ("props") are a package's
154
+ collection, and an id is unique in its library or workspace. The web app (\`topotopo web\`, http://127.0.0.1:7340)
155
+ mirrors the folders of the registered workspaces (CLI: topotopo workspace add <folder>) and libraries: the front page
156
+ shows each as a card (TopoTopo's built-in library last) and searches every package and output; every folder is a page
157
+ (/w/<workspace>/<path>/, /l/<library>/<path>/) with its flags, its package when it holds a .topo file (preview,
158
+ versions, outputs with their kinds and tags, the packages that use it and those it uses, graphs, exports), its notes,
159
+ its subfolders and its files by type (images, sounds and videos in players, models in 3D). Notes: every .md and .txt
160
+ file of a folder is a box on its page, in file name order; markdown renders, and a link shows what it leads to (an
161
+ image inline, a sound or video in a player, a .glb in 3D, a folder as a card, a YouTube or Vimeo address in its
162
+ player), relative to the note's folder, res:// from the Godot project, /Game/ from Unreal's Content/; a link to a
163
+ missing file is a flag. The other flags: a preview that did not cook, a package with no version or with changes no
164
+ version holds, an export older than its graph, published outputs no package of the workspace uses. Each package keeps
165
+ a stable address (/p/<library or workspace>/<id>, leading to its folder page), a thumbnail (…/thumb.png) and an iframe
166
+ embed (/embed/<library or workspace>/<id>) that the person's board pastes. It bakes the previews by itself after
167
+ graphs, assets or inputs change, from the graph named in "graph" (or "bake": another graph, a node, a frame);
168
+ TopoTopo's own packages show the thumbnails they keep of their outputs.`,
64
169
  graph: `GRAPH FORMAT
65
170
  {
66
171
  "nodes": {
@@ -74,39 +179,61 @@ export const TOPICS = {
74
179
  "vars": {"rock_count": 200},
75
180
  "params": {"rock_count": {"type": "int", "min": 0, "max": 2000, "label": "Rocks", "desc": "number of rocks"}}
76
181
  }
77
- - "vars": graph constants that "=expr" params read. "params": one entry per var a person would tune (3–8 of them):
78
- {type (float int bool string enum), desc, min, max, options (enum), label (control name), step (slider step)}.
182
+ - "vars": graph constants that "=expr" params and code read by their bare name ("=rock_count * 2", @P.y += height).
183
+ Name them so code can: letters, digits and _, and not a JavaScript keyword (class, default …), a helper (noise,
184
+ rand, length, detail …), a built-in (Math, Number, JSON …), the time (frame, time, fps, timeInc) or a wrangle name
185
+ (ptnum, Frame …); the build says when a name is taken. "params": one entry per var a person would tune (3–8 of them):
186
+ {type (float int bool string enum), desc, min, max, options (enum: strings or numbers; the var holds the option,
187
+ so [4, 8, 16] gives numbers), label (control name), step (slider step)}.
79
188
  The live viewer (preview) renders them as controls: sliders for numbers with a range, menus for options, checkboxes
80
189
  for bools. They are also the parameters when the graph is saved as an asset.
81
190
  - People change vars at any time (the viewer's controls edit the stored graph): read it with graphs {action:"get"}
82
191
  before assuming a var's value, and edit {op:"vars"} rather than rebuilding to change one. When a person asks to
83
192
  keep a value, keep it.
193
+ - Command line: --var name=value sets a var for one run without editing the file (repeat it; numbers, true/false and
194
+ JSON values are parsed, other text is a string; an unknown name lists the graph's vars), and --output <id> renders,
195
+ exports and inspects a named output instead of the default: topotopo terrain.json --output land --var relief=8
196
+ --render r.png --export land.glb. Exports record the vars they were made with (help topic "export", SOURCE).
197
+ - The viewer shows each cook as it runs (the node, the time) and has a Stop button: a cook a person stopped fails with
198
+ "cook stopped" at the node it stopped at. That is their decision, not an error to retry: ask before cooking it again.
84
199
  - "in": ordered input list (null = unconnected), a single name, or {"inputName": node} (names from help).
85
200
  - Output node: "output", else a node named out/OUT, else the last unconnected node.
86
201
  - Optional "outputs": {"rotor":{"node":"rotor_final","label":"Rotor"}} publishes additional deliverables beside
87
202
  the default. Publish complete assets and useful separate parts; the viewer isolates each on click and lists
88
- its textures/layers. Rename/remove edits maintain references. The latest render of each graph node is saved as
203
+ its textures/layers. In a package that publishes versions they are its outputs; "publish": false keeps one (a viewer-only
204
+ preview) out of the package, "tags" and "description" say what it is to search, and "kind" pins what it cooks to
205
+ (help topic "packages"). Rename/remove edits maintain references. The latest render of each graph node is saved as
89
206
  exports/renders/<graph>-<node>.png (each render overwrites it) unless save_to is supplied; explicit render/export
90
207
  destinations are registered in the viewer too.
91
208
  - Optional "export" (on the graph for the default output, or on an entry of "outputs") is where that output
92
209
  exports: a format ("glb" → exports/<graph or output id>.glb) or {"format":"obj","path":"parts/a.obj","up_axis":"z"}
93
- (the export tool's options), always inside exports/. The person's Export buttons in the viewer, export {output} /
94
- export {all:true} and the CLI's --export-all write these targets; set one with edit {op:"export", output?, export}.
210
+ (the export tool's options), always inside the package's exports/ (a workspace inside the engine project has it
211
+ inside the project, where the engine imports from; an "engine:" path prefix is gone: it warns, and exporting it is
212
+ refused). The person's Export buttons in the viewer, export {output} / export {all:true} and the CLI's --export-all write these
213
+ targets; set one with edit {op:"export", output?, export}.
214
+ The viewer's Download buttons need no target: they offer the formats that fit the output (a heightfield: png16,
215
+ r16, mask_png, unreal_landscape; a mesh: glb, gltf, usda, obj …) and hand the person the files, with their record.
95
216
  - Node names: letters, digits, _ . - Node types & params are case/underscore-insensitive and accept Houdini-style aliases.
96
217
  - "bypass": true passes input 0 through. "note": free text. "ui": {x,y} reserved for the future GUI.
97
218
  - Vectors: a single number broadcasts ("size": 2 → [2,2,2]). Colours accept [r,g,b], "#ff8800" or names.
98
219
  - build mode "merge" upserts nodes into the existing graph; edit ops: set, add, remove (auto-rewires), connect, rename, output, vars, bypass, replace, insert (after a node, rewiring its consumers).
99
- - Several graphs can coexist (name param); graph_ref composes them. Graphs persist as JSON in the workspace.`,
100
- inputs: `HUMAN INPUT (guides, blockouts and masks in the workspace inputs/ folder)
101
- People feed in their own material by dropping files into <workspace>/inputs/ (or onto the live viewer, or with its Add
220
+ - Several graphs can coexist (name param); graph_ref composes them. Graphs persist as JSON in the package.
221
+ - "fragment": true marks a graph that is a piece another graph or a script completes (merging in nodes it names but
222
+ does not hold): it is never cooked on its own, and topotopo check skips it.`,
223
+ inputs: `HUMAN INPUT (guides, blockouts and masks in the package inputs/ folder)
224
+ People feed in their own material by dropping files into <package>/inputs/ (or onto the live viewer, or with its Add
102
225
  input button): meshes, guide curves and points drawn in Blender, Houdini or Unreal, placeholder blockouts, PNG masks and
103
226
  heightmaps. Every tool answer ends with a note when inputs/ has files new or changed since your last call. Before building a
104
227
  landscape or scene, call inputs {action:"list"}; inputs {action:"describe", path} tells what one holds (polygons, open
105
228
  polylines, loose points, packed prims; bbox in metres; attributes; every name and role value; materials). Read a file
106
- with a file node, the path relative to the workspace: {"type":"file","params":{"path":"inputs/guides.glb"}}.
107
- MARKERS: what a person places by clicking in the live viewer (Site / Path / Zone / Volume modes) is written as
108
- inputs/markers.json with the same name and role attributes (sites: points with pscale and orient; paths open and
109
- zones closed polylines; volumes closed boxes), so describe it and read it like any other input.
229
+ with a file node: {"type":"file","params":{"path":"inputs/guides.glb"}} (relative paths read from the package folder,
230
+ the nearest folder with a .topo file at or above the graph, else the graph's folder; the list gives the exact path).
231
+ MARKERS: what a person places by clicking in the live viewer (the guides tools: null, curve, area, volume; they drag
232
+ them about afterwards) is written as inputs/markers.json with the same name and role attributes (sites: points with
233
+ pscale and orient; paths open and zones closed polylines; volumes closed boxes), so describe it and read it like any
234
+ other input. A graph meant to be directed by guides reads the file with "missing": "empty"
235
+ ({"type":"file","params":{"path":"inputs/markers.json","missing":"empty"}}): it cooks before the first guide is
236
+ drawn, and again each time the guides change.
110
237
  FORMATS: glb/gltf (+Y up already; object names → prim "name", materials → "material"), obj/stl/ply (no up axis:
111
238
  Unreal exports and Blender exports with Up = Z are Z-up, so add "up_axis":"z"), geo/bgeo (Houdini), csv and
112
239
  points.json (one point per row; columns such as name, role, pscale become point attributes), blend (needs Blender
@@ -144,14 +271,16 @@ ROLES AND RECIPES
144
271
  {density_mask:"mask"} scatters there (invert:true for a hole); group {class:"point", pattern:"@mask>0.5"} groups
145
272
  them. Let volumes reach below the ground. On a heightfield use heightfield_mask_by_object {by:"footprint"}.
146
273
  blockout a placeholder mesh to replace: bound {per_piece:true} gives each piece's box; foreach {mode:"pieces",
147
- piece_attrib:"name"} runs a body per object, where a shelf asset takes its size from the piece
274
+ piece_attrib:"name"} runs a body per object, where a package output takes its size from the piece
148
275
  ("width": "=bbox('piece').size.x", piece = the body's input node) and match_size(asset, piece) moves it in
149
276
  place. A footprint polygon feeds the house asset directly (its input 0).
150
277
  IMAGES: PNG masks and heightmaps. heightfield_from_image {path:"inputs/height.png", size:[x, z], height_min, height_max}
151
278
  makes a terrain (16-bit greys keep the detail); with a heightfield connected it writes into layer (e.g. "mask",
152
- height_min 0, height_max 1). attribute_from_map {path, projection:"xz", size, center, name:"mask"} samples it onto
153
- points (scatter density_mask, prune {mode:"density"}). Textures: image_file {path:"inputs/albedo.png"} (or a file
154
- node) loads it as an image named "albedo" for the texture nodes and texture_to_material {base_color:"albedo"}.
279
+ height_min 0, height_max 1), the image lying at size/center in the world (fit "field" stretches it over the
280
+ connected heightfield instead). attribute_from_map {path, projection:"xz", size, center, name:"mask"} samples it onto
281
+ points (scatter density_mask, prune {mode:"density"}). Textures: a node albedo = image_file {path:"inputs/albedo.png"}
282
+ loads it as an image named "albedo" (after the node; a file node names it after the file) for the texture nodes and
283
+ texture_to_material {base_color:"albedo"}.
155
284
  EXAMPLE: inputs/guides.glb holds path.* curves and zone.* areas: roads cut into hills, trees in the zones off the road,
156
285
  the vars a person would tune exposed as params:
157
286
  ${graphLines(INPUTS_EXAMPLE)}
@@ -159,8 +288,13 @@ Afterwards render it, and tell the person which of their guides you used for wha
159
288
  expressions: `PARAM EXPRESSIONS
160
289
  Any non-code param can be a string starting with "=": a JS expression evaluated with graph vars.
161
290
  "vars": {"floors": 6, "h": 3} → "height": "=floors*h", "count": "=floors*4"
291
+ ONE FORM: expressions and code (wrangle, script, sdf_expr, heightfield_layer, parametric curves and surfaces, group and
292
+ assert expressions, loop bodies) read graph vars by their bare name: height, not vars.height (an error says so).
293
+ Vars are read-only; in code a local of the same name comes first.
162
294
  Helpers: sin cos tan asin acos atan atan2 sqrt pow exp log abs floor ceil round min max sign hypot PI TAU E
163
295
  clamp fit lerp smoothstep frac mod radians degrees rand(x, seed) pick(array, i)
296
+ Conversions: Number(x) parseFloat(s) parseInt(s, radix) String(x) Boolean(x) isFinite(x) isNaN(x), Number.isInteger …
297
+ e.g. a menu var holding text: "=Number(res) * 2".
164
298
  Time: frame, time (seconds), fps, timeInc. "=sin(time*2)" animates; the node then re-cooks per frame (see topic time).
165
299
  Inside foreach bodies: iteration, numiterations, value, attr (e.g. "=attr.height"), plus parent vars.
166
300
  Inside solver bodies: iteration (frames since start_frame), substep, and frame/time/timeInc are the step's time.
@@ -170,6 +304,7 @@ READING OTHER NODES (n = a node of the same graph or body, named by a string lit
170
304
  centroid('n') → mean point position (bbox('n').center is the box centre)
171
305
  detail('n', 'attr'[, comp]) detail attribute value
172
306
  point('n', i, 'attr'[, comp]) prim('n', i, 'attr'[, comp]) (prim 'P' = centroid when no prim P exists)
307
+ primintrinsic('n', i, 'name'[, comp]) computed prim values (topic instancing): "=primintrinsic('rocks', 0, 'bounds', 3)" = ymax
173
308
  ch('n', 'param') or ch('n/param') another node's resolved param value (defaults included)
174
309
  e.g. stack on top: "translate": [0, "=bbox('base').max.y", 0] match a count: "count": "=npoints('pts')"
175
310
  Referenced nodes are dependencies: they cook first (even if not wired), changing them re-cooks this node, unknown
@@ -177,10 +312,11 @@ names get did-you-mean errors, and reading a node downstream of yourself is a cy
177
312
  Not supported: dynamic names (npoints(name) with a variable), and these functions inside graph "vars".
178
313
  Assets: their vars become node parameters.
179
314
  Expressions are per-node constants. For per-element logic use wrangle.
180
- SANDBOX: an expression sees only graph vars (read-only copies), frame/time/fps/timeInc, Math, the helpers above and the
181
- reference functions; any other name (process, require, globalThis, fetch, Number, JSON …) is an error, and so are
182
- import, \`this\` and assigning to a name. Errors name the param and the expression: param "size": expression "=…" failed: ….
183
- Straight-line expressions (operators, helper and Math calls) run directly; ones with functions, loops, regular
315
+ SANDBOX: an expression sees only graph vars (read-only copies), frame/time/fps/timeInc, Math, the helpers and
316
+ conversions above and the reference functions; any other name (process, require, globalThis, fetch, JSON …) is an
317
+ error, and so are import, \`this\` and assigning to a name. Errors name the param and the expression: param "size":
318
+ expression "=…" failed: ….
319
+ Straight-line expressions (operators, helper, conversion and Math calls) run directly; ones with functions, loops, regular
184
320
  expressions or method calls run under the script timeout (TOPOTOPO_SCRIPT_TIMEOUT_MS, default 30 s), ~0.5 ms more
185
321
  each the first time (the result is reused while the vars, time and nodes it read stay the same).
186
322
  SECURITY: a graph is code. Expressions and wrangles run sandboxed with a timeout on Node, but can still allocate
@@ -200,7 +336,8 @@ SOLVER (Houdini SOP Solver): feedback over frames.
200
336
  Body inputs: 0 = previous frame's result (initial geometry on start_frame), 1 = initial, 2/3 = solver inputs 2/3 at that frame.
201
337
  Cooking frame N runs the body for frames start_frame..N (substeps times each); before start_frame the input passes through.
202
338
  Each frame's state is cached, so stepping 10 → 11 runs the body once; jumping back is a cache hit.
203
- Body vars: iteration (frames since start_frame, from 0), substep, and frame/time/timeInc = the step's time (fractional between substeps).
339
+ Body vars (by their bare name in "=expr" params and code): iteration (frames since start_frame, from 0), substep, and
340
+ frame/time/timeInc = the step's time (fractional between substeps).
204
341
  SOLVER vs FOREACH: foreach feedback:true is count-based (N iterations in one cook, no time, cached as a whole);
205
342
  the solver's result depends on the frame you cook at and is advanced frame by frame.
206
343
  PARTICLES: the particles node is a solver too: frame f runs steps + (f - start_frame) × substeps steps, every frame's state is
@@ -239,12 +376,17 @@ GEOMETRY QUERIES (input 0 = incoming geometry, 1..3 = other inputs):
239
376
  nearpoint(i,pos[,maxdist]) nearpoints(i,pos,maxdist,maxcount) xyzdist(i,pos) minpos(i,pos) closest(i,pos)→{dist,pos,prim}
240
377
  intersect(i,orig,dir)→{prim,pos,dist} (prim -1 = miss) inpointgroup(i,"grp",pt) inprimgroup(i,"grp",pr)
241
378
  invertexgroup(i,"grp",v) inedgegroup(i,"grp",pt0,pt1)
379
+ primintrinsic(i,"name",pr): read-only values computed per prim: "bounds" [xmin,xmax,ymin,ymax,zmin,zmax], "typename"
380
+ ("Poly" | "PackedGeometry" | "BezierCurve" | "NURBCurve"), "vertexcount", "closed"; on packed prims "packedbounds" (the
381
+ source's own box), "transform" (3×3), "packedfulltransform" (4×4), "pivot" (topic instancing)
242
382
  EDITS (applied after the loop, geohandle 0 optional):
243
383
  addpoint(0,pos)→pt addprim(0,"poly"|"polyline",[pts])→prim removepoint(0,pt) removeprim(0,pr,andpoints)
244
384
  setpointattrib(0,"name",pt,v) setprimattrib setvertexattrib setdetailattrib(0,"name",v) setpointgroup(0,"g",pt,1) setprimgroup
245
385
  setvertexgroup(0,"g",v,1) setedgegroup(0,"g",pt0,pt1,1) (0 removes)
246
386
  DEBUG: print(...) (shows as warnings), error("msg") aborts. Use 'return' to skip the rest for the current element.
247
- Vars: vars.name (graph vars), iteration/numiterations inside foreach.
387
+ VARS: graph vars by their bare name, as in "=expr" params: @P.y += height * 0.5; rand(@ptnum, seed). Read-only (writing
388
+ one is an error); a local of the same name comes first. Inside foreach also iteration numiterations value attr, inside
389
+ solver iteration substep frame time timeInc. A wrangle re-cooks when a var it names changes, not for other vars.
248
390
  SPEED: a point wrangle over 64k+ points that calls no geometry query/edit/print function runs in parallel on worker threads (same result).
249
391
  SDF helpers are also available (see topic sdf).`,
250
392
  groups: `GROUP PATTERNS (any "group" param; also delete/group nodes)
@@ -255,6 +397,20 @@ SDF helpers are also available (see topic sdf).`,
255
397
  @P.y>0.5 attribute test, ops = == != > < >= <= ; components .x .y .z .w .r .g .b
256
398
  @class==3 @name=piece* @Cd.r<0.2 @ptnum<100
257
399
  Tokens are space-separated and applied left to right (union unless prefixed ! or ^).
400
+ STRING ATTRIBUTES (name, path, a material or part label):
401
+ @name=barrel exactly "barrel" (= and == are the same)
402
+ @name=bar* @name=*rel @name=b?rrel wildcards: * any run, ? one character; case-sensitive
403
+ @name!=frame every element whose name is not "frame"
404
+ "@name=barrel @name=stock" either (a space is a union)
405
+ "* ^@name=barrel ^@name=stock" all but those two
406
+ Quotes around the value are optional (@name='bolt*'); a value cannot hold a space (it splits the tokens), so name
407
+ parts with _ or -. < > <= >= never match a string. Digits in a string compare as text: @lod=1 matches "1", not "01".
408
+ A prim test reads the prim attribute, then the detail one, then the point one (a string from the prim's first point,
409
+ numbers averaged over its points); a point test reads the point attribute, then the detail one.
410
+ RECIPES: material per part {"type":"material","params":{"name":"glass","group":"@name=Glass*"}} · prims 0 to 11
411
+ "0-11" · all glass but the first three prims "@name=Glass* ^0-2" · pieces without names: name them first with
412
+ attrib_string {"format":"part_{piece:03}"} (connected pieces; piece_attrib for class / copynum), then select
413
+ "@name=part_00*". Help topic "materials" has the material recipes.
258
414
  FOUR CLASSES: point, prim, vertex (polygon corners), edge (unordered point pairs, Houdini edge groups).
259
415
  group node: "class": "point" | "prim" | "vertex" | "edge". delete: class vertex removes corners (a polygon losing
260
416
  one is deleted, polylines shrink); class edge deletes every prim using one of the edges.
@@ -286,7 +442,9 @@ SELECTING EDGES TO BEVEL (poly_bevel group; also subdivide creases, normal hard_
286
442
  "p3-7" "p0-1-2-3-0" explicit edges / closed chains of point numbers
287
443
  "rim" an edge group made with {"type":"group","params":{"class":"edge","name":"rim","pattern":"..."}}
288
444
  "bevel_edges" poly_bevel's output group (where the bevel meets the faces): bevel again to soften the first
289
- "" every edge shared by two polygons. Boundary and non-manifold edges are skipped with a warning.
445
+ "" every edge shared by two polygons where the surface bends (flat edges inside a plane, such as
446
+ the splits of a boolean's cut face, are skipped). Boundary and non-manifold edges are skipped
447
+ with a warning.
290
448
  mode "points" takes a point pattern instead ("0", "@P.y>0", a point group) and truncates those corners.
291
449
  EDGE GROUPS IN NODES: poly_bevel, subdivide creases (+ creaseweight attribute), normal hard_edges. Edge groups follow points:
292
450
  they survive transforms, fuse (remapped), merge (offset), copies, deletes (edges that no longer bound a prim
@@ -295,10 +453,45 @@ EDGE GROUPS IN NODES: poly_bevel, subdivide creases (+ creaseweight attribute),
295
453
  WRANGLE: @group_x works in vertices mode too; invertexgroup(i,"g",v) inedgegroup(i,"g",pt0,pt1) setvertexgroup(0,"g",v,1)
296
454
  setedgegroup(0,"g",pt0,pt1,1). Scripts: lib.halfEdges(geo) (edge loops/rings, one-rings, boundaries), lib.EdgeSet,
297
455
  lib.evalEdgeGroup(geo, pattern), lib.convertSelection(geo, from, to, sel, include).
298
- Groups produced by nodes: poly_extrude front/side, poly_bevel bevel/bevel_corner (+ edge group bevel_edges), extrude top/bottom/side, boolean from_a/from_b, sweep caps/sides,
456
+ Groups produced by nodes: poly_extrude front/side, poly_bevel bevel/bevel_corner (+ edge group bevel_edges), extrude top/bottom/side, boolean from_a/from_b, sweep caps/sides, loft caps/sides, curve fillet, remove_interior interior,
299
457
  clip above/below/cap, fill_holes filled, lsystem leaves/J/K/M, voronoi_fracture inside, knife cut (edge + point) and
300
458
  above/below, polysplit split (edge + point), edge_divide divided, polybridge bridge, polyfill fill, dissolve dissolved,
301
459
  edge_collapse collapsed. Create custom ones with "group".`,
460
+ materials: `MATERIALS (assign by name, range or group; name the pieces first)
461
+ A material is a prim string "material" naming an entry of the detail table "materials" (PBR base colour, metallic,
462
+ roughness, emissive, alpha, maps). The material node writes both for the prims of its group ("" = all); chain one
463
+ node per material, the later one winning where groups overlap. Maps: base_color_map / normal_map / roughness_map file
464
+ paths, or images from the texture nodes through texture_to_material (help topic "textures").
465
+ PICK THE PRIMS (any group pattern, help topic "groups"; string tests take wildcards and are case-sensitive):
466
+ by name {"type":"material","params":{"name":"glass","group":"@name=Glass*","alpha":0.3}}
467
+ "@name=*lass*" contains · "@name=glass_* @name=Glass_*" either · "@name!=frame" all but
468
+ by prim range "0-11" (prims 0 to 11) · "0-100:2" every second · "6-11 ^7" without 7 · "@name=Glass* ^0-2"
469
+ by node groups extrude "top" / "side", poly_extrude "front", poly_bevel "bevel", boolean "from_b" (the cut
470
+ faces), clip "cap" … ; by attribute "@P.y>1.5", "@N.y>0.9" (facing up)
471
+ NAME THE PIECES FIRST when they have no names (one node each):
472
+ connected pieces attrib_string {"format":"part_{piece:03}"} → part_000 … (or connectivity {name_prefix:"part_"})
473
+ copies attrib_string {"format":"crate_{copynum}"} after copy_xform / copy_to_points
474
+ engine suffixes attrib_string {"format":"hull_{piece:03}-convcolonly"} names 146 collision hulls at once
475
+ clean up attrib_string {"find":"_LOD","replace":"_lod"} · {"find":"\\\\.\\\\d+$","regex":true} · {"case":"lower"}
476
+ prefix attrib_string {"format":"gun_{value}"} keeps each name behind a prefix
477
+ Then material {group:"@name=hull_*"} and export split_by_name write one mesh per name.
478
+ EXPORT: glTF writes one material per table entry; a named material decides the colour of its prims (their Cd is
479
+ dropped unless vertex_colors:true). Merging pieces whose materials or images share a name but differ (two package
480
+ outputs that both call their map "basecolor") renames the later one ("paint_2", "<material>_basecolor"), so every
481
+ piece keeps its own look. Inspect the table: inspect lists materials; render {shading:"pbr", textures:true}.
482
+ MATERIAL OUTPUTS (a material as a package output, kind "material": materials and their maps, no geometry):
483
+ make texture nodes → texture_to_material with NOTHING in input 0, the images in input 1 ("in": {"images": "maps"}
484
+ or [null, "maps"]), {material:"steel", base_color, normal, orm} → the output; or material {name, base_color,
485
+ roughness} with no input for a plain one.
486
+ Each map keeps its texture node's resolution (a 4k normal beside a 512 mask); expose one as a param (a var
487
+ such as "normal_resolution" read by that node) to let a use change it.
488
+ use {"type":"owner/materials/steel", "params":{...}} → input 1 of material {group:"@name=body*"} on the mesh: the
489
+ material and its maps are copied in and assigned (from names one when the source holds several; name
490
+ renames it). The material node's own colour and map params are not used then.
491
+ see renders, the viewer and the web app show it on spheres (one per material) with its base colour maps;
492
+ publishing records each map's size (packages lists "maps baseColor 2048, normal 4096").
493
+ export format "textures": one PNG per map + materials.json (each material's values and the files of its maps), for
494
+ engines to rebuild it; glb and usda need a mesh: export the mesh that uses it.`,
302
495
  attributes: `ATTRIBUTES (Houdini conventions)
303
496
  Classes: point (P and per-point data), vertex (per polygon corner: uv seams, hard normals), prim (per face/curve), detail (global).
304
497
  Lookup precedence when reading: vertex > point > prim > detail.
@@ -336,7 +529,8 @@ Volumes are signed distance functions (negative inside) carried in geometry; nod
336
529
  smooth_* with blend k) → sdf_modify (offset shell noise twist bend repeat) → sdf_to_mesh (watertight triangles, smooth N).
337
530
  sdf_from_mesh turns closed meshes into volumes (blend meshes, offsets); remesh = voxel remesh (remesh_isotropic keeps
338
531
  sharp edges, boundaries and attributes).
339
- sdf_expr: write the distance in JS: p = [x,y,z]; return a number. Inputs via sdf(0, p), sdf(1, p).
532
+ sdf_expr: write the distance in JS: p = [x,y,z]; return a number. Inputs via sdf(0, p), sdf(1, p); graph vars by their
533
+ bare name (sdSphere(p, radius)).
340
534
  IQ-style helpers: sdSphere(p,r) sdBox(p,[hx,hy,hz]) sdRoundBox(p,b,r) sdTorus(p,R,r) sdCapsule(p,a,b,r) sdCylinder(p,h,r)
341
535
  sdCone(p,h,r) sdEllipsoid(p,[rx,ry,rz]) sdPlane(p,n,h) sdOctahedron(p,s) sdHexPrism(p,[r,h]) sdSegment(p,a,b,r)
342
536
  opUnion opSubtract(a,b) opIntersect smin/opSmoothUnion(a,b,k) smax opSmoothSubtract(a,b,k) opRound(d,r) opOnion(d,t)
@@ -355,6 +549,8 @@ counts landscape vertices the same way). Layers: height (world Y), mask (0..1 se
355
549
  (written by heightfield_erode), path (heightfield_path) and any user layer (rock, snow …).
356
550
  WORKFLOW
357
551
  heightfield {size, resolution} → heightfield_noise {fractal: "ridged", amplitude, element_size, range: "positive"}
552
+ (warp_amplitude, warp_element_size: a domain warp in metres bends ridges, escarpments and rivers into meanders;
553
+ terrace a broad warped noise for cliff bands, carve a band of a warped mask_noise around 0.5 for a river)
358
554
  → heightfield_erode {iterations: 60} (gullies and sediment fans; writes flow, sediment, debris, water)
359
555
  → heightfield_path (road along a curve, writes "path") · heightfield_project (stamp meshes/curves: plateaus, ridges)
360
556
  → heightfield_mask_by_feature (slope/height/curvature/direction/flow/occlusion) → heightfield_scatter → copy_to_points
@@ -363,23 +559,50 @@ WORKFLOW
363
559
  {min_distance: 12} for lots that never overlap; heightfield_project {level: "mean"} levels the pads under them)
364
560
  → heightfield_to_mesh {color: "terrain"} for polygons (layers become point attributes), or export png16.
365
561
  Other sources: heightfield_from_mesh (project polygons along Y), heightfield_from_image (8/16-bit PNG).
366
- Layer tools: heightfield_layer (expression over layers "height * mask + 2", or copy/rename/delete/fill), remap, blur,
367
- terrace, clip, cutout, mask_noise, mask_blur, mask_expand, resample (e.g. samples [505, 505]), transform (translate,
368
- scale, 90° turns; the generic transform node works too), to_sdf (solid terrain for caves/overhangs with sdf_combine).
562
+ Layer tools: heightfield_layer (expression over layers and graph vars "height * mask + lift", or copy/rename/delete/
563
+ fill; a layer named like a var comes first, with a warning, so name terrain vars apart from layers: relief, not height), remap
564
+ (input_min..input_max → output range), blur, terrace (levels at base + n × step_height), clip, cutout, mask_noise,
565
+ mask_blur, mask_expand, resample (e.g. samples [505, 505]), crop (a tile or world bounds, samples kept exactly),
566
+ transform (translate, scale, 90° turns; the generic transform node works too), to_sdf (solid terrain for
567
+ caves/overhangs with sdf_combine).
568
+ TILES: a big map (4 × 4 km at 2 m = 2001² samples) is previewed and processed one tile at a time at full resolution:
569
+ heightfield {size:[4000, 4000], resolution:2} → heightfield_crop {tiles:[8, 8], tile:[3, 5], margin:40} → the chain.
570
+ Everything that works at world positions gives the tile the same samples as the whole map: noise (and its warp),
571
+ terrace levels step/range, remap's input range, layer expressions in x z, masks by height and by object distance,
572
+ mask_noise, clip, from_image (fit world). Cell sizes exact in binary (0.25, 0.5, 1, 2 m) make the positions
573
+ bit-identical. Filters read neighbours: crop with a margin of their reach (a sample for slope and direction masks;
574
+ blur radius, curvature and occlusion radius, mask_expand and footprint distance + falloff, cutout feather, path
575
+ shoulder + smooth, project radius and whole pieces for its level mean) and crop the margin off again
576
+ (heightfield_crop {mode:"bounds"} to the crop_core_min / crop_core_max detail attributes). Not local, so a tile only
577
+ matches statistically: erosion (droplets and water cross tile borders: erode the whole map, or a tile with a margin),
578
+ heightfield_flow / fill_sinks (catchments), heightfield_scatter (points drawn over the field; scatter on the map and
579
+ keep the tile's points). Tied to the field's own extent: the options terrace levels "layer", remap and
580
+ heightfield_to_tex auto_range, heightfield_flow normalise, transform pivot_at_center and from_image fit "field" (all
581
+ off by default), and layer variables i j u v, to_mesh uv and its height / terrain colours, to_sdf's bottom.
582
+ Exports: pass the same height_min / height_max to every tile.
369
583
  MASKS: every mask node combines with the existing mask (mode replace/add/subtract/multiply/max/min): chain them,
370
584
  multiply = and, max = or. Most layer nodes take mask_layer to blend their effect by a mask.
371
585
  e.g. rocks on steep slopes off the road: mask_by_feature slope 33° → heightfield_layer {layer:"mask", expression:"mask * (1 - path)"}.
372
- EROSION: droplets (rain_density per sample per iteration, rain_amount, erosion_rate, deposition_rate, sediment_capacity,
373
- evaporation, inertia, gravity, max_lifetime) + thermal (thermal_talus_angle, thermal_rate); hardness_layer (1 = rock),
374
- freeze_layer (1 = untouched); boundary closed conserves material. Deterministic per seed. Cost ≈ samples ×
375
- rain_density × iterations × 30 steps (512² × 100 iterations ≈ 2–3 s). Stronger: more iterations or sediment_capacity.
586
+ EROSION: droplets in metres, so the same params erode alike at any spacing (an 8 m preview like the 2 m map, finer
587
+ detail aside): rain_density droplets per m² per iteration, max_distance metres a droplet travels, erosion_radius the
588
+ brush radius in metres (about a gully's half-width). erosion_rate, deposition_rate, evaporation, inertia, gravity and
589
+ thermal_rate act per droplet step of erosion_radius / 3 and sediment_capacity is a volume in those steps cubed; the
590
+ node converts them to the field's cells (cells of erosion_radius / 3 take them as given: the defaults at 0.1 m).
591
+ Scale: for a terrain λ times larger multiply erosion_radius and max_distance by λ and divide rain_density by λ², the
592
+ rest unchanged (a 4 km map at 2 m: erosion_radius 6, max_distance 60, rain_density 0.005). Thermal:
593
+ thermal_talus_angle, thermal_rate; hardness_layer (1 = rock), freeze_layer (1 = untouched); boundary closed conserves
594
+ material. Deterministic per seed. Cost ≈ rain_density × area × iterations × max_distance / cell droplet steps
595
+ (512² × 100 iterations at the defaults ≈ 2–3 s). Stronger: more iterations, rain_density or sediment_capacity. Not
596
+ local: a tile erodes like the same area of the map only statistically (see TILES).
376
597
  method droplet / backend js is the unchanged default. backend kernel loads WASM; auto uses an already loaded
377
598
  kernel or falls back to js. method pipe and stream_power require the kernel. Pipe uses virtual pipes, CFL-limited
378
- time_step (0 = automatic), rain_amount in metres/second, optional rain_layer multiplier, evaporation and thermal
599
+ time_step (0 = automatic, shorter on finer cells; a time_step below the limit of every spacing simulates the same
600
+ time per iteration), rain_amount in metres/second, optional rain_layer multiplier, evaporation and thermal
379
601
  talus relaxation. stream_power adds stream_power_k * drainage^stream_power_m * slope^stream_power_n incision.
380
602
  Kernel erosion also writes wear (cumulative eroded depth); pipe water is remaining water depth in metres.
381
- heightfield_flow {method:"dinf", normalise:true, log_scale:true} writes drainage and direction without erosion.
382
- Raw drainage is contributing area (m²); direction E/SE/S/SW/W/NW/N/NE = 0..7, sink = 255. D8 routes one receiver,
603
+ heightfield_flow {method:"dinf", log_scale:true} writes drainage and direction without erosion: drainage is
604
+ ln(1 + contributing area in m²) (raw area without log_scale; normalise:true divides by the field's largest value,
605
+ which depends on its extent); direction E/SE/S/SW/W/NW/N/NE = 0..7, sink = 255. D8 routes one receiver,
383
606
  D-infinity splits across two downhill receivers; local pits retain flow unless fill_sinks:true routes over a
384
607
  virtually filled surface (height stays unchanged). stream_power accepts the same opt-in fill_sinks flag.
385
608
  See examples/erosion_models.json for all four erosion methods on the same ridged terrain.
@@ -392,8 +615,11 @@ DRAINAGE: heightfield_fill_sinks uses deterministic priority-flood to raise clos
392
615
  Protected outlets and retained lakes are exceptions to border drainage. Pipe/stream_power erosion initializes from lake and writes simulated water
393
616
  depth back to lake within that original lake footprint. Droplet water remains its legacy normalised resting mask.
394
617
  See examples/drainage.json: unfilled massif beside shallow fills, blue retained lakes and coloured accumulation.
395
- RENDER / INSPECT: render draws heightfields as a shaded grid (the mask in red); color_by any layer name. inspect and
396
- every cook summary list the grid and each layer's min/max/mean.
618
+ RENDER / INSPECT: render draws heightfields as a shaded grid with the mask in red; heightfield_layer:"flow" draws
619
+ another layer in red instead ("none": none; the viewer's layer picker does the same), color_by any layer name maps
620
+ it to colours. It draws at most 256 quads per side, so a 513 × 513 field shows at 257 × 257 (the footer and a note
621
+ say so); heightfield_res: "full" (CLI --heightfield-res full) draws every sample. inspect and every cook summary
622
+ list the grid and each layer's min/max/mean.
397
623
  UNREAL LANDSCAPE: export {path: "exports/terrain.png"} (png16) or ".r16" writes the heightmap plus terrain.json with
398
624
  height_min / height_max and the import settings. Pixel column = X, row = Z (row 0 at min Z); Unreal X = X,
399
625
  Unreal Y = Z, Unreal Z = Y, centimetres.
@@ -413,38 +639,105 @@ An image is a volume carried in the geometry (like a heightfield): a 2D grid of
413
639
  Values are written to PNG as value × 255 with no transfer curve: colours hold the numbers colour params give
414
640
  ("#a5462e" → 0.65, 0.27, 0.18), so files match the colours you typed; data maps (heights, masks, roughness, normals)
415
641
  are linear. Images merge, clone and cache like geometry; materials reference them as "image:<name>".
642
+ NAMES: every image is named after the node that made or last filtered it ("rust_mask" for the node rust_mask), unless
643
+ that node's name param says otherwise, so default names in a graph never collide and texture_to_material slots name
644
+ nodes: {base_color:"paint", normal:"detail_normal"}. A node whose input holds several images never picks one: it
645
+ stops and lists them; set image (foreground_image, mask_image, detail_image … for the other inputs) to the one to
646
+ use, or isolate it with tex_output {image, keep_only:true}. To edit one image of a stack in place (an atlas, a
647
+ material's maps), give the filter name = that image's name. merge (and every node that merges) keeps an image or
648
+ material several inputs carry (same name and content, e.g. textured LOD branches) once; when two inputs use a name
649
+ for different images or materials (two package outputs whose maps are all "basecolor"), the later one is renamed
650
+ ("<material>_basecolor", "paint_2") with its material table and prim "material", so each piece keeps its own maps
651
+ in renders, the viewer and every export.
416
652
  GENERATORS (no input, resolution [w, h], name): tex_noise (perlin/simplex/value/worley × fbm/ridged/turbulence,
417
653
  tileable default: whole cells per octave; simplex tiles on a 4D torus) · tex_pattern (bricks, tiles, checker, stripes,
418
- hex, dots, grid; gap = mortar, bevel, variation; layer "id" = random per cell) · tex_cells (Voronoi distance / edges /
419
- id / crackle) · tex_gradient · tex_shape (disc, square, polygon, star, ring; falloff; tile) · tex_splatter (blobs) ·
420
- tex_scratches (strokes) · tex_text.
421
- FILES: image_file {path:"inputs/brick.png"} loads a PNG (8/16-bit, grey or colour; the file node reads .png the same way)
422
- as an image named after the file ("brick"; name sets another); layers auto/grey/rgba; srgb (default on) keeps the stored
423
- values, which suits colour and data maps alike (off only for linear-light colour). Input 0 = a geometry to add it to,
424
- so image_file nodes chain. People drop their own textures and masks into inputs/.
425
- FILTERS (input 0 = an image; image/layer pick what to process, the result replaces that layer; name renames; every
426
- other image and the mesh pass through): tex_blend (normal, add, subtract, multiply, screen, overlay, min, max,
427
- difference, divide; opacity; input 2 = mask) · tex_levels · tex_curves (ramp) · tex_blur (gaussian/box, tileable
428
- keeps the mean) · tex_warp (directional/slope/vector by input 1) · tex_transform (offset, rotate, scale, tile) ·
429
- tex_edge_detect · tex_invert · tex_threshold · tex_histogram_scan (position + contrast: THE mask maker) ·
430
- tex_normal_from_height (Sobel; strength 1 = 45° for a rise of 1 over 1/64 width; opengl/directx) ·
431
- tex_height_to_ao · tex_colorize (gradient map) · tex_channel (pack inputs 0..3 into RGBA, e.g. ORM; or extract) ·
432
- tex_tile_sampler (stamp input 0 on a grid with jitter/rotation/scale; mask input 1) · tex_output (rename, or copy a
433
- layer out as a new image: {name:"brick_ids", layer:"id"}; keep_only drops the rest).
654
+ hex, dots: 1 on the cells, 0 in the gaps; grid is a line mask, 1 on the lines, 0 in the cells: for grooved cells use
655
+ tiles; gap = mortar or line width, bevel, variation; layer "id" = random per cell) · tex_cells (Voronoi distance /
656
+ edges / id / crackle / crystal: a tilted flat facet per cell) · tex_gradient · tex_constant (one grey value, or an
657
+ RGBA colour with channels:"rgba"; input 0 = an image to take the size from) · tex_shape (disc, square, polygon, star,
658
+ ring; falloff; tile) · tex_sdf_shape (the signed distance in metres to a disc, box, polygon, star, capsule or cross;
659
+ corner rounding; tile; see SHAPES below) · tex_grunge (dirt / leaks / spots with a coverage fraction and edge
660
+ contrast) · tex_splatter (blobs) · tex_scratches (strokes) · tex_text.
661
+ FILES: image_file {path:"inputs/brick.png"} loads a PNG (8/16-bit, grey or colour) as an image named after the node
662
+ (name sets another; the file node reads .png the same way, named after the file); layers auto/grey/rgba; srgb
663
+ (default on) keeps the stored values, which suits colour and data maps alike (off only for linear-light colour).
664
+ Input 0 = a geometry to add it to, so image_file nodes chain. People drop their own textures and masks into inputs/.
665
+ FILTERS (input 0 = an image; image/layer pick what to process, the result replaces that layer and takes the filter's
666
+ name; every other image and the mesh pass through): tex_blend (normal, add, subtract, multiply, screen, overlay, min,
667
+ max, difference, divide; opacity; input 2 = mask) · tex_levels · tex_curves (ramp) · tex_blur (gaussian/box, tileable
668
+ keeps the mean) · tex_directional_blur (motion blur, length in metres: brushed metal from noise; symmetric off = a
669
+ trail) · tex_slope_blur (smear input 0 along the slopes of input 1 for distance metres: blur, min = eroded ragged
670
+ edges, max = grown) · tex_warp (directional/slope/vector by input 1; nonuniform adds an angle map on input 2;
671
+ multi averages several directions) · tex_transform (offset, rotate, scale, tile) · tex_make_tile (blend with
672
+ half-shifted copies so a photo or non-tileable noise tiles; noise = a wandering patch edge) · tex_edge_detect
673
+ (sobel, or outline / inner / outer: a line line_width metres wide along a mask's outline, roundness 1 = a ridge) ·
674
+ tex_invert · tex_threshold · tex_clamp · tex_quantize (levels; round or floor = posterize) · tex_auto_levels (own
675
+ range to 0..1; clip ignores outliers; stats range_min/max) · tex_histogram_range (squeeze around position) ·
676
+ tex_histogram_select (a band position ± range/2, contrast = edge hardness) · tex_histogram_scan (THE mask maker:
677
+ coverage 0.3 = the brightest 30 % turn white, whatever the input's range; or position = a value cut; contrast =
678
+ hardness; stat coverage) ·
679
+ tex_normal_from_height (physical: depth = metres a value of 1 stands, size = metres the image spans, so the slope is
680
+ real and the same at any resolution; paint grain 0.0003, hammered metal 0.002, bricks 0.015; opengl/directx) ·
681
+ tex_normal_blend (detail normal map over a base, e.g. micro grain over a bake: mode rnm (default, reoriented: both
682
+ reliefs keep their depth) | udn | linear; strength scales the detail; input 2 = mask; never tex_blend overlay on
683
+ normals) · tex_normal_normalize (unit vectors again after blur/resize/blend) · tex_normal_invert (green = OpenGL ↔
684
+ DirectX; red; both) · tex_height_from_normal (integrates a normal map back to a height: same depth and size as
685
+ tex_normal_from_height round-trips; FFT when tileable; stat relief in metres) · tex_curvature (from a normal map:
686
+ 0.5 flat, radius = the bend radius in metres that reads full white/black; blur metres for broader curvature;
687
+ layers convex/concave, as bake_curvature) · tex_ao (ground-truth AO of a height in metres: depth, size, radius;
688
+ a plane stays white; same result at any resolution; prefer it to tex_height_to_ao, whose units are image widths)
689
+ · tex_colorize (gradient map) · tex_channel (pack inputs 0..3 into RGBA, e.g. ORM; or extract) · tex_tile_sampler
690
+ (stamp input 0 on a grid with jitter/rotation/scale; mask input 1 = keep probability; inputs 2/3/4 = scale,
691
+ rotation (0..1 = 360°) and intensity maps read at each instance; stamps:"random" picks among every image of input
692
+ 0; output id / color = a random value / colour per instance with layer mask; tileable off cuts at the borders) ·
693
+ tex_output (rename, or copy a layer out as a new image: brick_ids = tex_output {layer:"id"}; keep_only drops the
694
+ rest).
434
695
  To process a layer as its own image, copy it out first (tex_output layer:"id") and filter that.
435
696
  Inputs of different sizes are resized to the first input (bilinear up, area average down).
697
+ UNITS: nodes with a size param measure in metres like tex_normal_from_height: size = metres the image width covers
698
+ (1 by default, so metres = image widths); their widths, radii and distances are metres, so the same graph gives the
699
+ same maps at 512 and 4096. Give every node of a material the same size (the uv tile's span on the model). Filters
700
+ with tileable (default on) read across the borders exactly like anywhere else.
701
+ SHAPES AND REGIONS (metres): an SDF image holds the signed distance in metres in C (negative inside). tex_sdf_shape
702
+ makes one; tex_sdf_from_mask measures one from any mask (threshold; sub-pixel accurate) · tex_sdf_op (offset grows,
703
+ round / fillet round convex / concave corners, stroke = a band on the outline, invert, redistance) ·
704
+ tex_sdf_boolean (union, subtract, intersect, xor with smoothness metres; morph) · tex_sdf_to_mask (fill, outline,
705
+ bevel with profile linear/smooth/round/ramp, distance = the 0.5-at-the-edge encoding). From masks directly:
706
+ tex_bevel (distance metres, > 0 inward, < 0 outward; profile) · tex_distance (grow a mask: gradient falloff or a hard
707
+ grown edge; with input 1 its values bleed out from the mask, e.g. per-tile colours into the gaps) ·
708
+ tex_flood_fill (the separate tiles of a mask: random grey, random colour, a gradient across each tile (angle,
709
+ angle_random), bbox_size in metres, position; layer id; stat tiles; random values stay with a tile at any resolution).
710
+ Panels: plates = tex_sdf_shape {shape:"box", extent:[0.46,0.46], corner:0.025, tile:[2,2]} → tex_sdf_to_mask
711
+ {mode:"bevel", width:0.012, profile:"round"} → tex_normal_from_height {depth:0.006}; rivets near the edges =
712
+ tex_sdf_boolean(rivet grid, tex_sdf_op(tex_sdf_op(plates, offset -0.035), stroke 0.07)) {mode:"intersect"}.
436
713
  BAKES (input 0 = mesh with non-overlapping uv in 0..1: uv_unwrap; input 1 = optional high-res mesh): bake_ao
437
714
  (samples, max_distance; white = open), bake_curvature (edges' dihedral angles within radius: 0.5 flat, bright convex,
438
- dark concave; layers convex/concave), bake_thickness, bake_position (bbox/uniform/world), bake_world_normal,
715
+ dark concave; layers convex/concave; creases where separate parts cut into each other count as concave too),
716
+ bake_thickness, bake_position (bbox/uniform/world), bake_world_normal,
439
717
  bake_normal (tangent space from the high mesh along averaged-normal cage rays; cage distance), bake_height (high above
440
718
  low; layer distance in metres), bake_island_id (colour per uv island, layer id, stat islands), bake_mask
441
719
  (mask_group or a numeric attribute), bake_vertex_color (Cd + Alpha). Shared: resolution (default 1024), supersample
442
720
  (1..4), padding (texels of edge dilation, default 4), group (prims to bake), keep_mesh (output the mesh too).
721
+ With a high-res mesh: cage (search distance), cage_attrib (default "cage": a float prim/point attribute of the mesh
722
+ that sets the cage per part, e.g. attrib_create {name:"cage", class:"prim", group:"@name=grip", value:0.03}),
723
+ match_name (each named piece projects only onto the high prims of its name: parts sharing one atlas), and layer
724
+ "missed" (1 where no high surface was found within the cage; stat missed) to see where to raise the cage.
443
725
  Rays and curvature run on the worker pool. The output is only the image unless keep_mesh.
444
726
  MATERIALS: texture_to_material {material, base_color, normal, roughness, metallic, occlusion, orm} on input 0 (mesh
445
727
  with uv) + input 1 (merged images): writes "image:<name>" slots into the material table, assigns the material (all
446
728
  prims when new, else group) and carries the images. occlusion/metallic images are packed into "<material>_orm".
447
729
  The material node's *_map paths accept "image:<name>" as well.
730
+ CUTOUTS: tex_crop extracts a top-left pixel rectangle (all layers), optionally resizes. trace_image reads alpha
731
+ or a selected channel into closed XY curves, including holes; fill builds faces. Restore UVs after fill using
732
+ uv_project {method:"planar",axis:"z",scale:[width,width*imageHeight/imageWidth]} BEFORE deforming.
733
+ tex_pack items:[{name:"leaf",maps:{color:"leaf_color",normal:"leaf_normal"}}] creates aligned atlas images and
734
+ placement points: name, rect [x,y,w,h], uv_offset, uv_scale. In a vertex wrangle, read these from input 1:
735
+ atlasUV = localUV * uv_scale + uv_offset. Output points follow items order. No rotation or automatic downscale.
736
+ tex_dilate pads nearest valid pixels; alpha stays unchanged by default. For grey/data maps supply an explicit
737
+ validity mask (same size). Pack padding reserves empty gutters; dilate supplies the edge values.
738
+ material {alpha_mode:"mask",alpha_cutoff:0.5,double_sided:true} BEFORE texture_to_material enables cutouts.
739
+ Omitted/auto alpha mode retains legacy behaviour; explicit opaque/mask/blend overrides scalar/vertex auto mode.
740
+ Complete example: examples/image_cutouts.json; workflow and layout contract: docs/image-cutouts.md.
448
741
  SEE IT: render of a geometry holding only images shows the "texture" view; render {texture:"<image>"|"image/layer"|
449
742
  "<material>"} adds the view (a material shows its maps as a labelled strip); render {textures:true} samples base
450
743
  colour maps on the mesh (texture × Cd, like glTF). inspect lists every image with size and per-layer ranges.
@@ -452,11 +745,18 @@ EXPORT: glb/gltf embed the image textures as PNG (ORM = occlusionTexture + metal
452
745
  <name>_textures/<image>.png next to the file (ORM through orm_map r/g/b); format "textures" writes every image as
453
746
  <dir>/<image>.png (layers: ["id"] or ["*"] for extra layers); json keeps images losslessly; geo/obj/… skip them.
454
747
  RECIPE (brick wall + worn crate: examples/textures.json):
455
- bricks = tex_pattern {pattern:"bricks", count:[4, 12], bevel:0.15} · ids = tex_output(bricks) {name:"ids", layer:"id"}
748
+ bricks = tex_pattern {pattern:"bricks", count:[4, 12], bevel:0.15} · ids = tex_output(bricks) {layer:"id"}
456
749
  color = tex_blend(tex_colorize(grain mortar greys), tex_colorize(ids, brick reds), bricks as mask)
457
- normal = tex_normal_from_height(bricks) · crate: uv_unwrap → bake_ao + bake_curvature → tex_output layer "convex"
458
- → tex_blend subtract noise → tex_histogram_scan = edge wear → tex_blend(wood, paint, wear) → tex_channel(ao, rough)
459
- = ORM → texture_to_material {base_color, orm}.`,
750
+ normal = tex_normal_from_height(bricks) {depth:0.035, size:1.6} · crate: uv_unwrap → bake_ao + bake_curvature →
751
+ tex_output layer "convex" → tex_blend subtract noise → tex_histogram_scan {coverage} = edge wear →
752
+ tex_blend(wood, paint, wear) → tex_channel(ao, rough) = ORM → texture_to_material {base_color, orm}.
753
+ Detail on a bake: grain = tex_noise {scale:60} → grain_n = tex_normal_from_height {depth:0.0003, size:<uv span in m>}
754
+ → tex_normal_blend(baked_normal, grain_n) {mode:"rnm"}.
755
+ RECIPE (worn painted metal from texture nodes only: examples/texture_lab.json): SDF plates and rivets → height →
756
+ normal, tex_ao · edge wear = tex_curvature(normal) layer convex × tex_grunge chips → tex_slope_blur {mode:"max"}
757
+ (ragged) → tex_histogram_scan {coverage:0.07} · steel = tex_directional_blur(fine noise) under the paint · per-plate
758
+ paint = tex_flood_fill(plate mask) → tex_histogram_range → tex_colorize · rust runs = tex_directional_blur(rivet
759
+ mask) {angle:-90, symmetric:false} × tex_grunge {style:"leaks"} · ORM = tex_channel(ao, roughness, metallic).`,
460
760
  loops: `FOREACH LOOPS
461
761
  {"type": "foreach", "in": ["lots"], "params": {"mode": "prims", "body": {
462
762
  "nodes": {
@@ -466,7 +766,8 @@ RECIPE (brick wall + worn crate: examples/textures.json):
466
766
  "output": "bldg"}}}
467
767
  Modes: pieces (by piece_attrib or connectivity) · prims · points · count (N times; feedback:true chains results).
468
768
  Body input index 0 = current element/piece (or the previous result with feedback); 1 = whole input; 2 = foreach input 2.
469
- Vars in the body: iteration, numiterations, value, attr (the element's attributes, e.g. "=attr.height"), parent vars.
769
+ Vars in the body, by their bare name in "=expr" params and code: iteration, numiterations, value, attr (the element's
770
+ attributes, e.g. "=attr.height"), parent vars.
470
771
  Results are merged (or the last one with feedback). Identical iterations are cached.
471
772
  For feedback over animation frames (growth, accumulation) use solver instead (help topic "time").`,
472
773
  instancing: `PACKED PRIMITIVES (instances)
@@ -491,12 +792,18 @@ Every other node (boolean, subdivide, scatter, normal, measure, uv_*, …) gets
491
792
  unpack {group, transfer_attributes:"name Cd material piece", limit, piece_attrib, recursive}.
492
793
  Anchor attributes are copied onto the unpacked geometry only where the source has none (Cd: in any class), so a
493
794
  source's own colours win and an anchor Cd tints colourless sources.
795
+ Read them: primintrinsic(0, "bounds", pr) in a wrangle (or primintrinsic('n', pr, 'bounds') in an expression) is the
796
+ instance's world box [xmin, xmax, ymin, ymax, zmin, zmax], computed when read; "packedbounds" is the source's own box;
797
+ "transform" is the 3×3 rotation·scale and "packedfulltransform" the 4×4 with the anchor position as its last row, both
798
+ row-major for row vectors (p' = p · M + t); "typename" is "PackedGeometry". Sit every instance on the ground:
799
+ wrangle {run_over:"prims", code:"const b = primintrinsic(0, 'bounds', @primnum), pt = primpoints(0, @primnum)[0];
800
+ const p = point(0, 'P', pt); p[1] -= b[2]; setpointattrib(0, 'P', pt, p);"}
494
801
  See them: render draws instances (an evenly spread subset above 600k triangles, with a note "rendering 9.5k of 30k
495
802
  instances"); inspect/build summaries say "packed: N instances of K sources (M triangles expanded)".
496
803
  Export: glb/gltf → EXT_mesh_gpu_instancing (one mesh + node per source, named like the source's prim "name",
497
- TRANSLATION/ROTATION/SCALE per instance, anchor attributes as _NAME instance accessors (Cd → _COLOR); shear is
498
- approximated with a warning); usda → one PointInstancer (prototypes = sources, protoIndices, positions, orientations,
499
- scales, ids, velocities, primvars per instance); geo → Houdini PackedGeometry prims sharing embedded sources;
804
+ TRANSLATION/ROTATION/SCALE per instance, with custom_attribs:true the anchor attributes as _NAME instance accessors
805
+ (Cd → _COLOR); shear is approximated with a warning); usda → one PointInstancer (prototypes = sources, protoIndices,
806
+ positions, orientations, scales, ids, velocities, with custom_attribs:true primvars per instance); geo → Houdini PackedGeometry prims sharing embedded sources;
500
807
  csv / points.json → one row per instance (instance stream: Position/Rotation/Scale or P/orient/scale, Mesh column)
501
808
  + <name>.meshes.json + one GLB per source; json keeps them losslessly; obj/ply/stl expand them (warned).
502
809
  instancing:"expand" (export option) always writes real geometry (instances:"expand" for csv/points.json only).
@@ -584,7 +891,7 @@ Example: examples/forest.json (30k candidates → pruned packed forest) and exam
584
891
  straight_skeleton {mode skeleton|offset|roof, distance, pitch, pitch_attrib, height_cap, group}
585
892
  Closed XZ polygons with contained holes; skeleton outputs lines with prim kind (0 skeleton, 1 contour).
586
893
  offset uses positive distance inward and negative outward; roof uses degrees and prim edge provenance.
587
- WASM loads lazily through the host. roof_skeleton is the footprint-input shelf asset with overhang and thickness.
894
+ WASM loads lazily through the host. topotopo/architecture/roof_skeleton is the roof on a footprint input, with overhang and thickness.
588
895
  Polylines are open prims of points; closed curves are polygons (faces). Spline prims are Houdini's Bezier/NURBS curves:
589
896
  the prim's points are its CONTROL POINTS (CVs) and the curve is evaluated exactly wherever it is needed.
590
897
  bezier {points, order, closed, weights} segments of order CVs sharing their ends: 7 CVs of order 4 = 2 cubic segments
@@ -605,11 +912,20 @@ Nodes:
605
912
  nurbs is exact; polyline → spline uses the points as CVs, or passes through them with fit:true.
606
913
  spline_fit {tolerance | cv_count, smoothing, order, output nurbs|polyline} least-squares NURBS through ordered points:
607
914
  denoise GPS-like / jittered polylines, compress dense curves (prim fit_error = largest deviation).
915
+ curve {points, corner_radius, corner_segments} corner_radius rounds corners as you draw: one radius, or one per point
916
+ (0 = sharp), e.g. [0, 0.004, 0.004, 0]; a point that is not [x, y, z] (NaN, null) is an error naming it.
608
917
  fillet_curve {radius, type round|chamfer|bezier, segments, group (corner points), angle_min, clamp} rounds polyline
609
918
  corners in 3D (new points in point group "fillet").
610
919
  offset_curve_3d {distance, lift, frame rmf|plane, up, corner mitre|round|bevel, both} parallel curves in 3D:
611
920
  rails, kerbs, lanes (both:true = two rails, prim side ±1; frame "plane" keeps them level). offset_curve is the
612
- 2D (Clipper) grow/shrink of CLOSED flat shapes; use offset_curve_3d for open paths or anything not flat.
921
+ 2D (Clipper) grow/shrink of CLOSED flat shapes; on a flat OPEN path it makes a strap outline (width 2 × distance,
922
+ cap butt|round|square): offset_curve → extrude for a flat band; sweep {shape:"rect", size:[w, h]} for one that
923
+ follows a 3D path.
924
+ loft {sections, resample auto|length|none, caps} skins through the curves in prim order, or through copies of ONE
925
+ profile placed by sections [{offset, scale, rotate}, ...]; sections with the same point count join point to point
926
+ (insets keep their corners), closed sections are turned to the first one's winding; closed results face outward.
927
+ revolve {axis, origin, angle} lathe about any axis line; draw the profile in a plane that holds the axis.
928
+ shape2d capsule | slot a stadium (rect with half-circle ends) in size; extrude for a slot cutter.
613
929
  project_curve (curves, surface | heightfield) {mode direction|closest, direction, spacing, lift, misses} drapes a
614
930
  curve onto terrain; spacing resamples first so it follows the bumps; writes point hit and N (smooth normals).
615
931
  curve_attribs {curveu, arclength, tangent (tangentu), frame (N = tangent, up), curvature, segment, ramp_attrib + ramp}
@@ -651,45 +967,326 @@ Any graph with vars can be saved as a node type: assets {action:"save", name:"ro
651
967
  The graph's vars become parameters (add "params": {"var": {"desc": "...", "min": 0, "max": 1}} for docs/ranges).
652
968
  Inputs: put {"type":"input","params":{"index":0,"label":"surface"}} nodes in the graph.
653
969
  Then use it like any node: {"type": "rock_cluster", "in": ["terrain"], "params": {"count": 50}}.
654
- Assets are stored as JSON in workspace/assets and load on startup.
655
- SHELF: 35 shipped assets (catalog {category:"shelf"}; help {nodes:["stairs"]} for params), used like nodes:
656
- {"type": "stairs", "params": {"steps": 12, "style": "open"}} {"type": "wall_segment", "params": {"windows": 3, "door": true}}
657
- architecture: wall_segment window_frame door_frame stairs spiral_stairs railing fence pillar arch roof_gable roof_hip
658
- brick_wall tile_floor hex_grid_floor scaffold beam_truss
659
- props: crate barrel pallet log rock cliff_block tree_lowpoly bush lamp_post bollard bench sign_post sandbag_wall cable pipe_run
660
- terrain/PCG: road_strip scatter_rocks forest_patch grass_clumps
661
- Pivots sit at the base (y = 0, Y up, metres; walls start at x = 0, roofs at the wall top); every piece has prim name and
662
- material. Curve assets (railing, fence, pipe_run, road_strip) take the curve as input 0, surface assets (scatter_rocks,
663
- forest_patch, grass_clumps) the surface; unconnected they build a default one. The PCG ones output packed instances.
664
- To change one: assets {action:"fork", name:"stairs", to:"my_stairs"} copies its graph into the workspace; edit it, then
665
- assets {action:"save", name:"stairs", from_graph:"my_stairs"} overrides the shelf asset (delete restores the original).`,
970
+ Assets are stored as JSON in the package's assets/ folder and load on startup; list, get and delete work on them.
971
+ Ready-made generators are TopoTopo's own packages, used by full name (help topic "packages"): walls, houses, roofs,
972
+ stairs, rocks, trees, props and roads such as {"type": "topotopo/architecture/stairs", "params": {"steps": 12}}. To
973
+ change one: assets {action:"fork", name:"topotopo/architecture/stairs", to:"my_stairs"} copies the output's graph into
974
+ the package's assets as my_stairs (an output whose graph names the package's other outputs adds the built-in package to the package);
975
+ assets {action:"get", name:"my_stairs"} shows it, assets {action:"save", name:"my_stairs", graph} writes it back, and
976
+ {"type": "my_stairs"} uses it.`,
977
+ packages: `PACKAGES (a package uses another package's published outputs by name; help topic "workspace": the three words)
978
+ A published package has a full name and versions. Its author names it once in its manifest, <id>.topo, "name":
979
+ "owner/name" (lower-case letters, digits, - and _; the owner "topotopo" is reserved for TopoTopo's own), and publishes:
980
+ workspace {action:"publish", dry_run:true} CLI: topotopo publish [folder] --dry-run
981
+ workspace {action:"publish", note:"taller pines"} CLI: topotopo publish [folder] --note "taller pines" [--big]
982
+ Publishing is permanent: run the dry run, show it to the person, and publish when they say so.
983
+ A graph uses an output of a package as a node type; "owner/name" alone is the package's default output:
984
+ {"type": "studio/trees/pine", "in": ["ground"], "params": {"height": 6}} {"type": "studio/trees"}
985
+ Its params are the vars of the output's graph that its node reads, with their "params" declarations (ranges clamp,
986
+ options are checked), and its inputs that graph's input nodes. help {nodes:["studio/trees/pine"]} gives them with the
987
+ version and its note, also for an output search found in a place the package looks in but does not use yet (read there,
988
+ nothing copied); catalog {category:"package"} lists the outputs of the packages in use and TopoTopo's own.
989
+
990
+ WHAT A PACKAGE PUBLISHES: every named output ("outputs") of every graph in graphs/ but those marked "publish": false
991
+ (viewer-only previews), and the default output: the output node ("output") of the graph the manifest shows ("graph"),
992
+ which must be set. Output names follow the same rule as the package name and are unique in the package. A graph that
993
+ holds several outputs gives each the vars its node reads: publishing warns about an output that does not read some of
994
+ its graph's vars (they are not its params; give it a graph of its own for params of its own).
995
+
996
+ WHAT AN OUTPUT IS: its kind, its tags and its description, which search, the catalog and help show.
997
+ "outputs": {"pine": {"node": "out", "label": "Pine", "kind": "mesh", "tags": ["conifer", "low-poly"], "description": "…"}}
998
+ - kind: mesh, instances (packed), points, curves, terrain (heightfields), textures (images alone), material (materials
999
+ and their maps, no geometry: help topic "materials"), volume, or scene (several of these: a street with its lamp
1000
+ posts as instances). A mesh that carries scene_null sockets is a mesh: the
1001
+ sockets are part of a mesh asset, and scene means several kinds of geometry together. Publishing cooks every output
1002
+ and records the kind it cooks to. "kind" pins it: publishing blocks when the output cooks to another, and build, edit
1003
+ and the viewer warn before that. A kind not on the list is an error wherever the graph is read.
1004
+ - tags: free words search finds the output by: lower-case letters, digits and -, starting with a letter or digit, at
1005
+ most 64 characters, at most 16 per output, each once ("low-poly", "street-furniture"); a malformed one is an error. A
1006
+ package's own "tags" in its manifest stay the web app's; search matches both.
1007
+ - description: the output's "description", else its graph's "description" (a built-in package's outputs, one graph each, need no
1008
+ more). The default output carries the tags and description of the named output it is, if any.
1009
+ Every listing says an output's kind and tags the same way: mesh [conifer, low-poly].
1010
+
1011
+ OUTPUTS OF THE SAME PACKAGE: a package's graphs and assets name its own outputs by full name, as they name another package's: a built-in package
1012
+ whose pieces build on each other, a house of the package's walls ({"type": "studio/house/wall"} in the house's graph). They
1013
+ resolve to the same version, with no entry in "uses"; in the package that publishes versions, to its graphs as they are now
1014
+ (its working folder), and in a followed working folder to that folder. Outputs that name each other in a loop (a names
1015
+ b and b names a, or a names itself) do not resolve, and publishing refuses them.
1016
+
1017
+ VERSIONS: big.small from 1.0, each a folder versions/<version>/ in the package that is never written over: <id>.topo,
1018
+ graphs/, assets/, inputs/, the copies the package uses (packages/) and version.json (the note, the time, a hash of every
1019
+ other file, each output's graph, node, kind, tags, description, params and inputs). The hash reads text files with LF
1020
+ line ends, so a checkout that turns them into CRLF changes nothing; binary files count as they are. exports/,
1021
+ attachments/ and other files are not part of a version. The number comes from the version before: big (2.0) when
1022
+ something a user relies on goes away or means something else (an output removed, renamed or marked "publish": false;
1023
+ an output of another kind; a param removed, renamed or of another type; a narrower range; a removed option; an input
1024
+ removed or moved), small (1.4) for everything else (new outputs, params, options and inputs, wider ranges, other
1025
+ defaults, labels, tags, descriptions, a kind pinned or unpinned that stays the same, any change to the geometry).
1026
+ big:true (--big) marks a version big when its meaning changed in a way the tools cannot see (a model that now faces
1027
+ another way).
1028
+ PUBLISHING goes in steps and stops at the first that blocks, so each problem is said once, at its cause, and a version
1029
+ number only for what would publish: (1) what the package declares: its name, the note, its outputs (names, kinds,
1030
+ tags, descriptions, clashes, the default output), loops, files it cannot read, its copies (none missing or edited by
1031
+ hand), a package this session follows; (2) every output cooked as a package that uses this one cooks it, in the
1032
+ package's own scope: one that does not cook, cooks to nothing or to another kind than pinned blocks; a warning is said
1033
+ once, under the output it belongs to (not again under a line-up that cooks it); (3) nothing changed since the last
1034
+ version blocks; (4) the number, the changes and the warnings: an output without tags or a description, one that does
1035
+ not read some of its graph's vars, an output of another kind than before, URLs and files outside the package that its
1036
+ nodes read (a version holds no copy of them) and a version above 50 MB. A DRY RUN, workspace {action:"publish",
1037
+ dry_run:true, note?, big?} (CLI: topotopo publish --dry-run), goes through every step and writes nothing.
1038
+
1039
+ USING PACKAGES: the manifest's "uses" holds the version the package uses of each ({"studio/trees": "1.3"}), and packages/
1040
+ its own copy of each, and of the packages those use, flat: packages/<owner>/<name>/<version>/, each version once, with
1041
+ packages/lock.json (each copy's hash, where it came from, its own uses). The copies are committed with the package,
1042
+ so it cooks anywhere without the libraries, and what it uses never changes by itself; a copy edited by hand is warned
1043
+ about, and the warning goes once the copy is restored. init writes a .gitattributes that keeps versions/ and packages/
1044
+ byte for byte, and a .gitignore for packages/.cache.json (the hashes of the copies' files, kept between runs) and
1045
+ packages/.lock (held while a command, the viewer or an MCP server writes the manifest and the lock).
1046
+ IN A WORKSPACE (a folder tree with topotopo-workspace.json; CLI: topotopo workspace init): its packages share one copy
1047
+ of each package version, in topotopo-packages/ beside that file, whose "uses" names the version the whole workspace uses.
1048
+ A first use in any of its packages adds the package there; Update compares every place every package uses it and
1049
+ changes them all; remove is refused while a package still names it. A package that publishes versions keeps its own "uses"
1050
+ and copies, which are published with it. workspace init moves the copies of the packages inside that kept their own
1051
+ (two packages that used different versions get the newer, said).
1052
+ WHERE A PACKAGE LOOKS: in a workspace, in the workspace itself (every folder with a .topo file), then in the shared
1053
+ libraries the workspace's file lists ("libraries": ["props", "../shared/materials"]: registered names, or paths written
1054
+ from the workspace to folders outside it), in order; outside a workspace, in the library the package is in (read from
1055
+ its own checkout, so its siblings come from the same worktree), then in every other registered library. Then, always,
1056
+ in TopoTopo's built-in library, "topotopo" (no other library takes that name), which alone holds the packages named
1057
+ "topotopo/…": TopoTopo's own packages, which a package uses, copies and locks like any other; a newer version a
1058
+ TopoTopo release brings shows as an update. A name comes from the first place that has it, and the same name in a later
1059
+ place is not used (said); two folders of one place publishing one name leave it out, naming both. An entry of
1060
+ "libraries" that does not work (no such folder, a name not registered, a package's folder, a folder inside the
1061
+ workspace) is reported, and the others still count. The tools never list a library by themselves: workspace
1062
+ {action:"libraries", add} (CLI: topotopo workspace library add|remove) does it when the person names one. A package
1063
+ manifest lists no libraries ("libraries" there is refused, saying where each entry goes). Only a package's graphs use packages: in a folder that
1064
+ is none, naming one fails and says so, and workspace {action:"init"} (CLI: topotopo init) makes it a package, when the
1065
+ person says so.
1066
+ - First use: a build or edit whose graph names a package this package does not use yet adds its newest version once the
1067
+ graph validates (a graph they reject adds nothing and writes nothing), and the response says so. A dry run (build
1068
+ {dry_run:true}) checks the graph against that version, read where its place holds it, copies and writes nothing,
1069
+ and a note says what build or edit would add. A graph-file cook (topotopo graph.json) adds it too and says so;
1070
+ --locked fails instead, for a build machine. workspace {action:"use", package:"studio/trees", version?} (CLI: topotopo
1071
+ use studio/trees [--version 1.1]) adds one explicitly; workspace {action:"remove", package} (CLI: topotopo remove) drops
1072
+ one no graph of the package names any more, with the copies nothing else uses.
1073
+ - workspace {action:"packages"} (CLI: topotopo packages) lists what the package uses, one line each (version, outputs, up
1074
+ to date or "1.3 is out"), the other packages the places it looks in give (each with its place, and "also in …, not
1075
+ used"), the places, and what it could not check; at a workspace's root, the workspace's;
1076
+ {action:"packages", package:"studio/trees"} (CLI: topotopo packages studio/trees) shows one package: its versions and
1077
+ notes, its outputs with their kinds, tags, params and inputs.
1078
+ - A package output cooks in its version's own scope: its own assets, graphs (graph_ref) and files (relative paths read
1079
+ the version's folder) and the versions it uses. Nothing leaks either way, and two versions of one package (one the
1080
+ package uses, one another package uses) cook side by side. Its result names the version's texture files by paths
1081
+ relative to the package's folder (absolute only for a followed working folder outside the package), so exports name
1082
+ no folder of this machine.
1083
+ - Errors never guess: a package not in "uses" says how to add it, an unknown output lists the package's outputs, a
1084
+ missing copy says which and which package's use copies it again, and in a workspace a package found only in a
1085
+ registered library the workspace does not list names that library and the command that lists it.
1086
+
1087
+ SEARCH: workspace {action:"search", query?, kind?, tag?} (CLI: topotopo search [words] [folder] --kind k --tag t, the
1088
+ folder written as a path: ., ./forest, ../forest) looks through the newest version of every package in the places the
1089
+ package looks in and TopoTopo's built-in library, and in a workspace the registered libraries it does not list. Every word of query
1090
+ must start a word of an output's full name, label, description or tags, or of its package's title or tags
1091
+ ("tree" finds trees, not topotopo/street); kind and tag match exactly: {query:"conifer"}, {kind:"terrain"},
1092
+ {query:"brick", tag:"masonry"}. Results come by place, in the order a lookup takes them (TopoTopo's built-in library
1093
+ after them), each with its full name, kind, tags, label, version and description, and say whether the package can use
1094
+ it: those of a place it looks in, yes (a graph that names one adds it); in a workspace, a registered library it does not
1095
+ list only once the workspace lists it, and the result says the command that lists it.
1096
+
1097
+ TOPOTOPO'S OWN PACKAGES: four built-in packages in TopoTopo's built-in library, every one a package of the owner "topotopo"; their
1098
+ outputs are listed by the catalog (category "package") and help even where the package does not use them yet:
1099
+ topotopo/architecture wall_segment window_frame door_frame house stairs spiral_stairs railing pillar arch roof_gable
1100
+ roof_hip roof_skeleton brick_wall tile_floor hex_grid_floor scaffold beam_truss
1101
+ topotopo/nature rock cliff_block tree_lowpoly bush log forest_patch grass_clumps scatter_rocks
1102
+ topotopo/props crate barrel pallet sandbag_wall pipe_run
1103
+ topotopo/street road_strip lamp_post bollard bench sign_post fence cable
1104
+ {"type": "topotopo/architecture/stairs", "params": {"steps": 12, "style": "open"}} {"type": "topotopo/nature/rock"}
1105
+ A built-in package's name alone ("topotopo/nature"), or its output "lineup", is its default output: its outputs side by side. Every
1106
+ output has a pinned kind (mesh; instances for scatter_rocks, forest_patch and grass_clumps; the nature package's line-up a
1107
+ scene) and tags (search {tag:"street-furniture"}, {query:"conifer"}, {tag:"low-poly"}). Pivots sit at the base (y = 0,
1108
+ Y up, metres; walls start at x = 0, roofs at the wall top); every piece has prim name and material. Outputs that
1109
+ follow a curve (railing, fence, pipe_run, road_strip) take the curve as input 0, those that dress a surface
1110
+ (scatter_rocks, forest_patch, grass_clumps) the surface; unconnected they build a default one. Those three output
1111
+ packed instances. A built-in package's pieces build on each other (house is its own wall_segment and roof_skeleton).
1112
+ A first use copies the built-in package into the package that uses it, as for any other, and a newer version a
1113
+ TopoTopo release brings shows as an update. In an installed TopoTopo they have no working folder to follow;
1114
+ TopoTopo's repository publishes them.
1115
+
1116
+ FOLLOWING, for one session: workspace {action:"follow", package:"studio/trees", on:true} (CLI: --follow studio/trees on a
1117
+ graph cook or topotopo view) shows that package's working folder (where the package finds it) instead of its copy, until
1118
+ on:false or the end of the session; nothing about it is saved. Every edit there re-cooks. Following is for looking
1119
+ (the viewer, renders, inspect): exports and publishing use the published copy, and an export made while following
1120
+ says which published version it used. A workspace with "follow": true (topotopo workspace init --follow) follows its
1121
+ own packages this way, those whose working folder is inside it. Other packages' versions keep the copies they hold.
1122
+
1123
+ OUT OF DATE AND UPDATE: what a package uses changes only by an update, after a before/after.
1124
+ - workspace {action:"outdated"} (CLI: topotopo outdated) lists the packages in use that have newer versions:
1125
+ the newer versions with their notes (and their outputs of another kind), one line for those up to date, what it could
1126
+ not check, and the update to run for each.
1127
+ - workspace {action:"update", package:"studio/trees", to?} (CLI: topotopo update studio/trees [--to 2.0]) is the
1128
+ before/after: every place the package uses the updated package (each node of its type in graphs/, assets/ and the graph files
1129
+ in the package's folder, nested graphs included, with its params and inputs as they are) cooked with the version in
1130
+ use and with the new one; what changed in each (counts, size, attributes, the largest move) with an overlay render
1131
+ (grey the same, blue only with the new version, orange only with the old); the notes of the versions between. Without
1132
+ "to" it goes to the newest version with the same big number (none newer is no failure: it says so). A big version is
1133
+ named with "to", and the before/after then lists what the graphs must change, place by place: params they set that it
1134
+ no longer has (with did-you-mean), values its narrower range clamps, options it no longer has, outputs they use and
1135
+ inputs they wire that are gone. The new version is read where its place holds it: nothing is written. It says how
1136
+ far it is, stops when the call is cancelled (CLI: Ctrl+C) and reuses what was cooked before.
1137
+ - Show the before/after to the person and apply it only when they say so, naming the versions it showed:
1138
+ {action:"update", package, from, to, apply:true} (CLI: the command the before/after ends with, --from 1.3 --to 1.4
1139
+ --apply) copies the new version in with the versions it uses, sets "uses" and the lock, and deletes the copies
1140
+ nothing uses any more. It is refused when the manifest uses another version by then. After a big update the graphs
1141
+ report what they must change until they do.
1142
+
1143
+ IN THE VIEWER (preview, topotopo edit, topotopo view on a graph in a package): the Packages tab, in every package, has
1144
+ Find packages (the places the package looks in and TopoTopo's built-in packages) and a box per package used: the version in use with a badge (up to
1145
+ date, update available, live), the nodes that use it, its outputs with their kinds and tags (those in use marked), and
1146
+ Update only when a newer version exists. The Scene tree marks the nodes of a package with an update or a live folder.
1147
+ The card of an output that cooks to another kind than its "kind" says so. Update first compares every place with the
1148
+ version in use (a) and the new one (b), its progress in the cook line and Stop; a place shows alone in the view as a,
1149
+ as b or both overlaid, with what changed in a line; it applies only when the person confirms, and a big version whose
1150
+ graphs must change asks once more and gives the person a line to copy for you. "Source: Published | Live folder" shows
1151
+ a package's working folder for the viewer's session (never saved; not offered for TopoTopo's built-in packages outside TopoTopo's
1152
+ repository); results that use it are marked as showing unpublished edits, their exports and downloads write the
1153
+ published version, and a save in a working folder
1154
+ the session does not follow is offered in that package's box.
1155
+
1156
+ EXPORTS record the package versions their graph used in the source block: "packages": {"studio/trees@1.3": "<hash>"}.
1157
+
1158
+ THE CLI COMMANDS (a folder named must exist; without one, the current folder's package):
1159
+ ${PACKAGE_COMMANDS.map((c) => ` topotopo ${c.usage}\n ${c.what}`).join('\n')}`,
1160
+ godot: `GODOT (packages inside a Godot project, imported by the TopoTopo plugin)
1161
+ A package inside a Godot project imports as <id>.topo: the plugin (topotopo godot setup puts it in addons/topotopo/) cooks
1162
+ each published output into a plain GLB Godot imports itself, and keeps them current while graphs change (from the
1163
+ viewer, an agent over MCP, by hand). Levels place and load the GLBs, never the .topo.
1164
+
1165
+ WHAT IS COOKED: the package's published outputs, the rule publishing uses: every named output of every graph without
1166
+ "publish": false, plus the default output (named after the package id when it is no named output), minus the skip
1167
+ list; each at frame 1 with its graph's var defaults, from the working folder, the packages it uses from their pinned
1168
+ copies (working folders are never followed). Nothing of the package is written but its outputs and its record: a graph
1169
+ naming a package it does not use, or a missing or edited copy, fails that output (as --locked does).
1170
+ mesh, scene, instances, curves, points <folder>/<id>/<id>.glb (per-output folders) or <folder>/<id>.glb (--flat)
1171
+ textures one PNG per image in that folder
1172
+ terrain, material, volume not imported yet: listed as skipped, with why (a warning)
1173
+ The GLB: TopoTopo's glTF defaults (y up, metres, materials with embedded images, no compression or quantization),
1174
+ node names as authored (sockets from scene_null, _lod0/_lod1 pieces, Godot's -col/-colonly suffixes), packed instances
1175
+ as EXT_mesh_gpu_instancing (MultiMeshInstance3D in Godot; the instances' Cd as _COLOR), every required extension one
1176
+ Godot 4.7 reads, the source block in asset.extras.source with "package". No .source.json beside it.
1177
+
1178
+ OPTIONS come from <id>.topo.import [params] (the Import dock), and the flags override them:
1179
+ outputs/folder "outputs" (relative to the package, or res://…) --into <folder>
1180
+ outputs/per_output_folders true --flat
1181
+ outputs/skip "" (comma-separated output ids) --skip a,b
1182
+ instances/mode 0 MultiMesh (packed) | 1 Expand (real copies) --instancing packed|expand
1183
+
1184
+ WRITING: one cook per package at a time (<package>/.topotopo/cook.lock); only files whose bytes changed are written
1185
+ (through <file>.topotopo-part), so Godot reimports only those; a failed output keeps its last good files and the others
1186
+ still update; a file at an output path is replaced only when the record lists it or it was cooked for this package
1187
+ (--adopt takes one over once, keeping its .import); an output no longer published leaves its files as orphans.
1188
+ THE RECORD <package>/.topotopo/godot.json (commit it with the outputs and their .import files): canonical JSON, no
1189
+ times, no machine paths; per output its deps (every file it read), files with their SHA-256, state and errors.
1190
+ A package is current when its record matches: the options, every source's hash (text read with LF line ends), the
1191
+ listings of graphs/, assets/, inputs/ and the folders outputs listed, every output file, and a TopoTopo no newer than
1192
+ the one that cooked it. Only outputs whose own deps changed cook again; results are shared through the cook cache
1193
+ (~/.topotopo/cache/cook, or $TOPOTOPO_CACHE/cook) by every checkout and worktree.
1194
+
1195
+ EXIT CODES: 0 every output ok; 1 an output or package failed or timed out (records and reports still written);
1196
+ 2 usage, setup or protocol error, a published copy, a package outside a Godot project (nothing written).
1197
+ CI: godot --headless --path game --import, then topotopo godot status game --strict (where TopoTopo is not installed:
1198
+ godot --headless --path game --script res://addons/topotopo/tools/check.gd, which exits 1 the same way).
1199
+ IN THE EDITOR: the TopoTopo panel (bottom) shows each package's state, outputs, errors and orphans; right-click a .topo
1200
+ or an output: Open in TopoTopo (the live viewer), Recook, Show Cook Report. A failed output keeps its last good GLB and
1201
+ marks the .topo with Godot's ImportFail icon. integrations/godot/demo is a project to try it on.
1202
+ The plugin's contract (jobs file, progress lines, record schema, freshness): integrations/godot/PROTOCOL.md.
1203
+
1204
+ THE CLI COMMANDS:
1205
+ ${GODOT_COMMANDS.map((c) => ` topotopo ${c.usage}\n ${c.what}`).join('\n')}`,
666
1206
  uv: `UV TOOLKIT (uv = vertex attribute (u, v, 0); seams are edges where the corner uv differs)
667
1207
  Which node:
668
- uv_project planar/box/cylindrical/spherical projection. Fast, no packing; boxes and simple shapes.
1208
+ uv_project planar/box/cylindrical/spherical projection. Fast, no packing (uv = position / scale, over many tiles):
1209
+ tiling textures, boxes. box: each polygon along the axis its normal is closest to (X faces u = z, v = y;
1210
+ Y faces u = x, v = z; Z faces u = x, v = y); both sides of an axis share it, so faces looking along +X,
1211
+ +Y and -Z are MIRRORED (text reads backwards; inspect uv counts them) and -X, -Y, +Z read right.
669
1212
  uv_unwrap automatic (xatlas): cuts charts by angle/cost, flattens and packs into 0..1. Default for props and
670
- hard-surface. Keeps polygons; writes prim chart. use_seams:true keeps existing seams as chart borders.
671
- Big smooth meshes chart slowly: max_chart_area -1 (auto) caps chart size above ~1000 triangles.
1213
+ hard-surface. Keeps polygons; writes prim chart. Each connected piece is charted on its own; polygons
1214
+ xatlas cuts across charts become triangles (exact uv); faces with no area collapse onto a neighbour's
1215
+ chart (never to uv 0,0); folded charts are charted again or cut; thin charts (bevel strips) join a
1216
+ neighbour (merge_thin); charts longer than the tile, rings and arcs are cut when that packs denser
1217
+ (cut_long). The result is checked and warnings name the part. use_seams:true keeps existing seams.
1218
+ Big smooth meshes chart slowly: max_chart_area -1 (auto) caps chart size above ~1000 triangles; a higher
1219
+ max_cost makes fewer, larger charts (less space lost to padding).
672
1220
  uv_flatten LSCM (conformal) per chart, charts bounded by YOUR seams: uv discontinuities (use_seams), the
673
1221
  "seams" edge group, point pairs ({"seams": [[a,b],[b,c]]}), a prim chart attribute, the group border.
674
1222
  Closed charts / handles are cut open automatically (cut_closed). pins: [a,b] fixes orientation.
675
1223
  uv_autoseam experimental: proposes charts (xatlas or normal clustering) → prim chart + point seam; then uv_flatten.
676
- uv_layout (re)pack islands: min-area rotation, uniform texel density (scale_mode), padding in texels at
677
- resolution, udims N for UDIM tiles 1001.. ; island_attrib "chart" packs by chart. Writes prim island.
1224
+ uv_layout (re)pack islands without overlaps: island_attrib "chart" packs by chart; writes prim island. Islands that
1225
+ do not fit at any scale leave the uv unchanged, with a warning (never a silent overlap).
678
1226
  uv_transform translate/scale/rotate existing uv.
1227
+ Packing (uv_unwrap and uv_layout): islands on the texel grid of resolution, padding texels apart (half of it to the tile
1228
+ border), uniform texel density (uv area ∝ 3D area), every gap filled (inside rings, between arms).
1229
+ orient: min_rect (densest; 90° turns allowed) | world (world up +Y → +v, horizontal islands +X → +u; no turns) |
1230
+ keep (as it is; no turns). Rotations never mirror.
1231
+ texel_weight: a prim float attribute scaling density per island (2 = twice the texels per metre; <= 0 counts as 1):
1232
+ attrib_create {name:"texel_weight", class:"prim", value:2, group:"@name=sight"} gives the sight more texels.
1233
+ texels_per_unit (0 = largest that fits) with fit: atlas (default: everything in 0..1, the density lowered if needed,
1234
+ with a warning) | udim (keep the density, spill into tiles 1001, 1002 …; uv_layout up to udims) | stack (uv_unwrap:
1235
+ more atlases, all in 0..1, prim atlas).
1236
+ Rails, ladders, pipes (long thin parts): orient min_rect lays each strip along the tile and the packer stacks the strips
1237
+ side by side, filling the gaps with small charts; leave cut_long on (a chart longer than the tile is cut into parts)
1238
+ and merge_thin on (bevel strips join the face beside them). Every chart loses a padding border, so fewer, wider charts
1239
+ fill more: unwrap with a higher max_cost, or give a part your own seams (use_seams). inspect uv names the lowest and
1240
+ highest density charts: compare them to spot a part that came out too coarse.
679
1241
  Typical: geo → uv_unwrap → render {views:"quad_uv", checker:true}. Manual: delete uv → uv_flatten {seams:[...]} → uv_layout.
1242
+ LODs: decimate / lod after uv_unwrap keep the uv free of folds (keep_uv, default on: where a collapse would fold the uv
1243
+ they reduce in steps around it, so a level can stop above its target; the warning names the parts). The full
1244
+ reduction: reduce first, then uv_unwrap each level.
680
1245
  SEE IT: render views "uv" (or "quad_uv" = persp + uv): the 0..1 square with a 0.1 grid and UDIM labels, polygons filled
681
- by chart/island colour, island borders yellow, overlapping uv in RED (footer/notes give the overlap %).
1246
+ by chart/island colour, island borders yellow, overlapping uv in RED (footer/notes give the overlap %); overlap that is
1247
+ expected is amber: charts of a repeating texture (they run across tile borders: the label says TILING) and LODs that
1248
+ share the uv space (prim names ending _lod0, _lod1 …).
682
1249
  render checker:true shades 3D views with an 8×8 uv checker: squares should look square and equal-sized
683
1250
  (stretch = rectangles, density = cell size, mirrored charts flip the red/green gradient).
1251
+ MEASURE IT: inspect {detail:"uv", resolution:1024, json:true}: exact overlaps (triangle pairs with the part and world
1252
+ position of each, and their areas; folds inside one chart included; shared edges are not overlaps), split into
1253
+ overlap.inTile (between atlas charts, each inside one tile: what a bake suffers), overlap.tiling (a chart runs across
1254
+ tile borders, as uv_project over many tiles does: a repeating texture, flagged tiling:true; expected) and
1255
+ overlap.acrossLods (prims named _lod0 / _lod1 … share the uv space on purpose); collapsed / non-finite / out-of-tile
1256
+ triangles (the first one named with its position), UDIM tiles, charts, mirrored triangles, utilization (exact for a
1257
+ clean atlas in 0..1, else a labelled raster ESTIMATE; tileUtilization per UDIM tile), texel density (density: overall,
1258
+ per chart 5 % / median / 95 %, the lowest and highest chart and where; texels/m with a resolution) and per-piece
1259
+ (prim "name") surface, uv area and texel density. An analysis that hits its bounds says INCOMPLETE.
1260
+ CLI: --inspect uv --uv-resolution 1024 [--json].
684
1261
  Export: uv → glTF TEXCOORD_0 (v flipped), OBJ vt, USD primvars:st.`,
685
1262
  render: `RENDER (pick the overlay that answers your question; everything is off by default)
686
1263
  render {node?, views, …} returns a PNG; build/edit take the same options as render:{…}. The footer names the active
687
1264
  overlays and notes pieces, open edges and back-facing % (also returned as text notes).
688
1265
  VIEWS: "quad" (persp/front/right/top, default) · "turntable" (persp at azimuth 0/90/180/270) · "quad_uv" · a list of
689
- persp, front, back, left, right, top, bottom, uv, section, texture, persp@<azimuth>. azimuth/elevation/zoom, look_at [x,y,z],
690
- ortho_scale (world width of ortho views), size (pixels per view), scale 2 (a 2× image).
1266
+ persp, front, back, left, right, top, bottom, uv, section, texture, persp@<azimuth>, and the three-quarter views
1267
+ front_left, front_right, back_left, back_right (persp at azimuth -45, 45, -135, 135).
691
1268
  "texture" draws images flat (texture:"<image>" | "image/layer" | "<material>" picks; a geometry holding only images
692
1269
  renders as it by default); textures:true shows base colour maps on the mesh. Help topic "textures".
1270
+ FRAMING: every 3D view fits the bounds: the bbox corners fill the view with a small margin, so nothing is cropped.
1271
+ azimuth: degrees around +Y; 0 = the camera on +Z looking at the front, 90 = on +X (the right side), 180 = the back,
1272
+ -90 = the left; default 35. elevation: degrees above the horizon (default 25; 90 looks straight down).
1273
+ e.g. render {views:"persp", azimuth:-90, elevation:10} looks at the left side from just above.
1274
+ zoom: relative to the fit (1 = fit, 0.5 = half size). Above 1 it magnifies around look_at and crops, so it only
1275
+ applies with look_at (or ortho_scale); without them it is held at 1 and a note says so.
1276
+ look_at: [x, y, z] in world metres (x right, y up, z towards the front; Y-up like everything else); the view centres
1277
+ on it and still fits the bounds around it. e.g. render {views:"persp", look_at:[0.6, 0.15, 0], zoom:4} (a muzzle).
1278
+ ortho_scale: the world width in metres across an ortho or section view (default: fit the bounds).
1279
+ e.g. render {views:"front", ortho_scale:0.5} shows 50 cm across the front view, at any size.
1280
+ size: pixels per view, n or "WxH": size:"1600x600" gives wide views a long prop fills (the fit follows the aspect);
1281
+ scale 2 makes a 2× image.
1282
+ BACKGROUND: transparent:true gives a PNG with alpha (background pixels 0; no ground grid or axis gizmo; the footer
1283
+ stays). grid:false drops the persp ground grid. underlay:"inputs/side.png" draws a reference image (PNG, relative to
1284
+ the package) behind the 3D views at underlay_opacity (default 0.5); underlay_fit "bounds" (default: fitted into the
1285
+ rectangle the bounds cover in that view, keeping its aspect, so a reference cropped to the object lines up with it),
1286
+ "width" / "height" (its width or height spans the bounds'), "view" (the whole view). Pick the view that matches the
1287
+ picture: render {views:"front", underlay:"inputs/side.png", size:"1600x500"}.
1288
+ SOCKETS: sockets:true draws scene empties (scene_null: attachment points) as dots with their name and orient axes
1289
+ (X red, Y green, Z blue), through the surface. pbr renders hide empties unless sockets is set.
693
1290
  QUESTION → OPTION
694
1291
  How dense / clean is the topology? Where are the triangles, poles, slivers? wireframe:"all" (every edge, 1 px)
695
1292
  Which edges are creases? wireframe:"hard" (dihedral > hard_angle, default 30) + crease/hard/sharp edge groups
@@ -709,15 +1306,41 @@ QUESTION → OPTION
709
1306
  What do the colours mean? color_by + legend:true (gradient bar with min/max, or categorical swatches)
710
1307
  What shape is it? shading:"matcap" (clay, reads form) · "ao" (ambient occlusion: creases and
711
1308
  cavities darken; ao_radius px) · "flat" (facets, ignores N)
1309
+ How do the materials read? Roughness, metal, maps? shading:"pbr": the metallic-roughness material glTF export writes
1310
+ (base colour map × vertex colour, tangent-space normal map in the exported MikkTSpace frame, orm or
1311
+ roughness map, metallic, emissive, unlit) under a fixed camera-relative studio rig (key, fill, rim and a
1312
+ sky/ground environment), GGX specular, ACES, exposure (stops, default 0). Deterministic: the same graph
1313
+ gives the same PNG. Texture files are read from disk; transparency is not evaluated (shaded opaque,
1314
+ with a note), nor are missing or non-PNG maps (named in the notes). color_by and highlight tint
1315
+ the shaded material (the attribute colour lit by the material's brightness); checker is not shown.
1316
+ POLYGON EDGES: wireframe "auto" (the default) draws polygon edges on meshes under 6,000 polygons, never under shading
1317
+ "pbr" or textures:true (they would read as marks in the material); the footer says EDGES AUTO when it draws them.
1318
+ wireframe:false hides them, true draws them always.
712
1319
  Labels never overlap: ones without room are skipped (note says how many; raise size or lower max_labels).
713
- view_labels:false drops each view's name label and the persp axis gizmo (clean thumbnails, e.g. the shelf's).
1320
+ view_labels:false drops each view's name label and the persp axis gizmo (clean thumbnails, e.g. those of TopoTopo's own packages).
1321
+ Heightfields draw at most heightfield_res quads per side (default 256; "full" = every sample): a larger field is
1322
+ drawn decimated (a 513 × 513 field at 257 × 257) and the footer and a note say so. They show the mask in red;
1323
+ heightfield_layer:"flow" shows another layer (0..1 layers as they are, others from their min to their max, named
1324
+ in the legend) and "none" none.
714
1325
  Examples: render {views:["persp","section"], section_axis:"z", wireframe:"hard", label_groups:true}
715
1326
  render {views:"turntable", shading:"matcap"} · render {glyphs:"N", clip:{axis:"x", offset:0.5}}
1327
+ CLI: several renders per cook: the options after a --render apply to that render, up to the next --render; options before the
1328
+ first --render apply to every render. Example: both renders 1200x600; side.png the front view over the reference,
1329
+ beauty.png a pbr three-quarter view:
1330
+ topotopo g.json --size 1200x600 --render side.png --views front --underlay ref.png --render beauty.png --views front_left --shading pbr
716
1331
  CLI: --wireframe all --section y:0.5 --clip x:0.5 --glyphs N --labels groups,pieces --shading matcap --legend --size 1600 --scale 2
717
- --no-view-labels`,
1332
+ --shading pbr --exposure 0.5 --views front_left --size 1600x600 --transparent --no-grid --sockets
1333
+ --azimuth -90 --elevation 10 --look-at 0.6,0.15,0 --zoom 4 --ortho-scale 0.5
1334
+ --underlay ref.png --underlay-opacity 0.6 --underlay-fit width (CLI paths are relative to the current folder)
1335
+ --no-view-labels --heightfield-res full --heightfield-layer flow`,
718
1336
  export: `EXPORT
719
1337
  export {output:"crate"} / export {} (the default output) / export {all:true}: the graph's export targets (help topic
720
1338
  "graph": "export" on the graph or an output), written inside exports/, the same files the viewer's Export buttons write.
1339
+ PATHS: one rule for the CLI, the MCP server and the viewer: relative paths inside a graph (file nodes, material maps,
1340
+ image files) read from its package folder, the nearest folder with a .topo file at or above the graph file, else
1341
+ the graph file's folder (MCP: the server's folder); exports/ is that package's (a graph in <package>/graphs/ exports into
1342
+ <package>/exports/, never beside itself), and exports/.outputs.json records the files by their package paths. The
1343
+ CLI's own --render / --export / --underlay paths are relative to the current folder.
721
1344
  export {path:"exports/thing.glb"} — format from the extension:
722
1345
  glb / gltf glTF 2.0 via gltf-transform (recommended for Unreal, Blender, web)
723
1346
  geo Houdini JSON geometry: every attribute (all classes), group and polyline, lossless (precision 64 or 32)
@@ -726,20 +1349,53 @@ export {path:"exports/thing.glb"} — format from the extension:
726
1349
  obj usda ply stl json (lossless topotopo)
727
1350
  textures format:"textures", path = a folder: every image volume as <image>.png (help topic "textures")
728
1351
  Options: up_axis "y" (default) | "z", scale (100 = m → cm), split_by_name (one mesh per prim "name", default true),
729
- custom_attribs, materials (default true), compress "none" | "meshopt" (EXT_meshopt_compression + KHR_mesh_quantization,
1352
+ custom_attribs (extra numeric attributes: default off for glb / gltf / usda and the GLBs of instance rows and bundles,
1353
+ on for ply; below), materials (default true), vertex_colors (glTF, default false: prims with a named material are
1354
+ written in that material, their Cd dropped; true keeps Cd as COLOR_0 there too, below), compress "none" | "meshopt" (EXT_meshopt_compression + KHR_mesh_quantization,
730
1355
  ~3× smaller; for web engines such as three.js/Babylon.js) | "draco" (only with the optional draco3dgltf package),
731
- quantize (KHR_mesh_quantization alone), attributes ["P","pscale",…] (csv / points.json), pcg / pcg_struct (csv),
1356
+ quantize (KHR_mesh_quantization alone), tangents "auto" | "preserve" | "none" (glTF TANGENT, below), attributes ["P","pscale",…] (csv / points.json), pcg / pcg_struct (csv),
732
1357
  precision 64 | 32 (geo), instancing "packed" | "expand", instances "rows" | "expand" (csv / points.json of packed
733
1358
  prims), meshes (instance rows: also write one GLB per source, default true). For Unreal and Blender keep the default
734
1359
  uncompressed GLB.
1360
+ SOURCE: every export (export tool, export targets and the viewer's Export and Download buttons, the CLI's --export and
1361
+ --export-all) records how it was made, so it can be made again: a "source" block {graph, graph_sha256 (SHA-256 of the graph JSON as
1362
+ cooked: vars after overrides, keys sorted, no whitespace), output (a named output, else null), node, frame, fps, vars
1363
+ (all of them, after overrides), seeds (the seed params the graph sets, by node: "loop/pts" inside a body, as written),
1364
+ export: {format, options: every option the format reads, the given ones and the defaults of the rest}, topotopo (the
1365
+ version)}. png16 / r16 carry it in their .json sidecar, csv / points.json
1366
+ instance rows in <name>.meshes.json, unreal_landscape in landscape.json; every other export writes <file>.source.json
1367
+ next to the file ({format:"topotopo-export-source", version, files, source}; a textures folder: source.json inside
1368
+ it), and glb / gltf also carry it in asset.extras.source. Nothing in it depends on the time or the machine: the same
1369
+ graph, values and options give the same bytes, and a later version changing a default does not change what the
1370
+ record replays. Replay on the command line: topotopo <graph>.json --output <output> (or --node <node>) --frame <frame>
1371
+ --fps <fps>, one --var <name>=<value as JSON> per var, --format <format>, every option as its flag (up_axis "z" →
1372
+ --up-axis z, custom_attribs false → --no-custom-attribs, layers ["a","b"] → --layers a,b) and --export <path>. e.g.
1373
+ topotopo graphs/crate.json --node h --frame 1 --fps 24 --format glb --compress none --custom-attribs
1374
+ --instancing packed --materials --no-quantize --scale 100 --split-by-name --tangents auto --up-axis z --export crate.glb
1375
+ These sidecars and manifests are metadata of the file beside them: inputs list and the viewer show
1376
+ them with it (kind "metadata"), and a file node reading one says what to read instead.
735
1377
  glTF layout: one node+mesh per "name", one primitive per material. Polygons → TRIANGLES, polylines → one LINE_STRIP each
736
- (LINES above 256 curves), loose points → POINTS with pscale as _PSCALE. N → NORMAL (else computed, 60° cusp),
737
- uv/uv2 → TEXCOORD_0/1 (V flipped), Cd (+Alpha) → COLOR_0. Custom attributes: every other numeric point/vertex attribute
738
- of size 1-4 → _NAME (upper-cased, float or the smallest int type); mesh extras keep the original names and types.
739
- MATERIALS: the material node writes prim "material" + the detail table. Vertex colours win: prims whose Cd is not all
740
- white export baseColor white × COLOR_0 with the material's metallic/roughness/emissive; otherwise baseColor = the
741
- material colour. alpha < 1 → alphaMode BLEND; unlit → KHR_materials_unlit; emissive above 1 → KHR_materials_emissive_strength.
742
- TEXTURES: material {base_color_map, normal_map, roughness_map} (PNG/JPEG paths relative to the workspace/graph; the mesh
1378
+ (LINES above 256 curves), loose points → POINTS with pscale as _PSCALE. Scene empties (scene_null: isolated points with
1379
+ scene_empty 1, name, parent, orient, scale) → meshless nodes (sockets) under their parent: the scene, another empty or
1380
+ a uniquely named mesh, with the local TRS that keeps their geometry-space placement; set point attributes → node extras;
1381
+ missing, ambiguous or cyclic parents and GPU-instanced parents are errors; import brings them back. N → NORMAL (else computed, 60° cusp),
1382
+ uv/uv2 → TEXCOORD_0/1 (V flipped), Cd (+Alpha) → COLOR_0 (not on prims with a named material unless vertex_colors,
1383
+ MATERIALS below). TANGENT (tangents "auto", the default): MikkTSpace
1384
+ tangents (xyz + handedness w) for every primitive whose material has a normal map, computed per corner before
1385
+ vertices are welded (uv seams, hard normals and mirrored islands keep their own frames), the same frame bake_normal
1386
+ bakes in; a valid point/vertex "tangent" float[4] (from an import) is written on other primitives. "preserve" writes
1387
+ the supplied attribute wherever it exists (malformed = error), "none" never writes TANGENT. Collapsed uvs are
1388
+ reported. Import reads TANGENT back as point "tangent" (transforms keep it: xyz rotated, w flipped by mirrors).
1389
+ Custom attributes (custom_attribs true): every other numeric point/vertex attribute of size 1-4 → _NAME (upper-cased,
1390
+ float or the smallest int type), mesh extras keep the original names and types, and packed instances carry their
1391
+ anchor attributes as per-instance accessors. The attributes only scene empties use (scene_empty, parent, orient, scale,
1392
+ their extras) never become mesh channels.
1393
+ MATERIALS: the material node writes prim "material" + the detail table. A named material wins: its prims export in that
1394
+ material as it is and their Cd / Alpha are dropped (Cd left from colouring parts does not become COLOR_0 or a second,
1395
+ white or tinted copy of the material). Prims without a material, and every prim with vertex_colors:true, keep their
1396
+ Cd: not all white → baseColor white × COLOR_0 with the material's metallic/roughness/emissive (one constant Cd is
1397
+ folded into the factor). alpha < 1 → alphaMode BLEND; unlit → KHR_materials_unlit; emissive above 1 → KHR_materials_emissive_strength.
1398
+ TEXTURES: material {base_color_map, normal_map, roughness_map} (PNG/JPEG paths relative to the package folder; the mesh
743
1399
  needs uv). glb/gltf embed the images (baseColorTexture, normalTexture, metallicRoughnessTexture = roughness in green; a
744
1400
  map replaces its factor). usda: UsdUVTexture shaders reading primvars:st, asset paths relative to the .usda. geo/json
745
1401
  keep the paths in the material table. glTF import records texture paths (or "embedded:<name>") without decoding.
@@ -802,9 +1458,10 @@ HOUDINI: File SOP reads .geo (and glb/obj/usd); packed prims are written as Pack
802
1458
  stored once in sharedprimitivedata (layout not yet confirmed against a Houdini-written file: instancing "expand" is
803
1459
  the safe path). CSV points: Table Import SOP, map P.x/P.y/P.z → P (and other columns).
804
1460
  A material name becomes a Houdini material path with a wrangle: s@shop_materialpath = "/mat/" + s@material;
805
- BLENDER: File > Import > glTF 2.0 (custom attributes arrive as mesh attributes named _NAME).
806
- PACKED INSTANCES (help topic "instancing"): glb/gltf write EXT_mesh_gpu_instancing with per-instance attributes, usda a
807
- PointInstancer with per-instance primvars, geo PackedGeometry prims, csv/points.json the instance stream, json keeps
1461
+ BLENDER: File > Import > glTF 2.0 (custom attributes, exported with custom_attribs:true, arrive as mesh attributes
1462
+ named _NAME).
1463
+ PACKED INSTANCES (help topic "instancing"): glb/gltf write EXT_mesh_gpu_instancing (per-instance attributes with
1464
+ custom_attribs:true), usda a PointInstancer (per-instance primvars with custom_attribs:true), geo PackedGeometry prims, csv/points.json the instance stream, json keeps
808
1465
  them; obj/ply/stl expand them. Option instancing "expand" writes real geometry everywhere.
809
1466
  SPLINES (Bezier/NURBS prims, help topic "curves"): every format but json writes the evaluated polylines (closed curves as
810
1467
  polygons), with a note; json keeps the spline prims. convert_curve first to choose the resolution.
@@ -825,18 +1482,35 @@ IMPORT (file node): obj, stl, ply, glb/gltf (meshopt; Draco with draco3dgltf; ex
825
1482
  null), min_edge_length, no_degenerate (zero-area faces, coincident points within tolerance), no_self_intersections
826
1483
  (BVH, stops after max_tests candidate pairs and says so), attrib (must exist; attrib_min/attrib_max bound its first
827
1484
  component; attrib_class), group (exists and is non-empty), expr (JS over npoints nprims nvertices npolys nlines
828
- bbox.min/.max/.size/.center (.x .y .z) volume area pieces open_pieces genus closed boundary_edges).
1485
+ bbox.min/.max/.size/.center (.x .y .z) volume area pieces open_pieces genus closed boundary_edges, and the graph
1486
+ vars by their bare name: "npoints == count * 8").
829
1487
  on_fail: error (default) | warn | mark → detail assert_failed (count) + assert_report, groups assert_fail;
830
1488
  then render {highlight:"assert_fail"} shows where. Each assert records stats checks/failed in the cook report.
1489
+ Every failed check names its first offender: the part (prim "name", groups) and its world position.
1490
+ inspect {detail:"topology"} says whether the mesh is a closed solid and, when not, why: open edges (counted after
1491
+ welding the vertex splits of uv/normal seams, which a re-imported GLB has), non-manifold edges, flipped faces, pieces
1492
+ facing inward, degenerate faces, each with a count, where the first one is and the fix. Solid ops (boolean …) give
1493
+ the same causes when they refuse a mesh.
831
1494
  2. EXPLAIN AFTER A BUILD/EDIT: explain {graph, node?} describes the result in words, e.g.
832
1495
  "reads as: one closed piece, box-like, 2 × 1 × 1 m, 3 cm thin walls, mirror-symmetric in x, z", then pieces,
833
1496
  watertight/genus/boundary loops, flipped normals, symmetry planes, principal axis + aspect, sampled thickness,
834
1497
  degenerate faces, polygon mix, attributes, groups. Compare it with what you meant to build.
835
1498
  3. DIFF TO SEE WHAT A CHANGE DID: graphs {action:"duplicate", name:"main", to:"before"} → edit → diff {a:"before", b:"main"}:
836
- counts, bbox delta, topology/volume, attribute and group changes, Hausdorff + mean distance, per-point displacement
837
- (same point count), verdict. a/b: "graph", "graph/node" or {graph, node, frame} (two nodes or two frames work too).
1499
+ counts, bbox delta, topology/volume, attribute and group changes, heightfields, images and SDF grids (sample by
1500
+ sample), Hausdorff + mean distance, per-point displacement (same point count), verdict. a/b: "graph", "graph/node" or {graph, node, frame} (two nodes or two frames work too).
838
1501
  render:true overlays them: grey = unchanged, blue = only in b, orange = only in a.
839
1502
  4. RENDER for what text cannot tell (proportions, style); inspect for one attribute's numbers.
1503
+ 5. INSPECT {detail} (CLI --inspect <detail>):
1504
+ summary (default) one screen: counts and triangles, bbox in metres to the millimetre, parts (prim "name"),
1505
+ materials and their maps, images, uv state (charts, in-tile overlap, tiling, utilization), closed
1506
+ or open edges (after welding seam splits)
1507
+ budget triangles per part (prim "name": each exports as its own mesh), split per LOD when the names
1508
+ end in _lod0, _lod1 …, and per node (the triangles each node adds over its inputs), sorted, with
1509
+ totals; packed instances count expanded. json:true (CLI --json) appends it as JSON
1510
+ scene the glb export read back from its bytes: the node tree (meshes, sockets and their parents, world
1511
+ and local positions), triangles per mesh, materials with factors and maps, images with size;
1512
+ export_options (CLI: the export flags) as the export takes them
1513
+ topology / uv / attributes / elements / all (see above and help topic "uv")
840
1514
  MEASURE NODES (category measure) turn shape into attributes for masks and colour:
841
1515
  curvature type mean|gaussian|principal_min|principal_max|convexity (1/m; normalize → 0..1) — wear on convex edges
842
1516
  occlusion mode occlusion → ao 0..1 | cavity → cavity 0..1 | thickness → metres (rays inward; closed meshes);
@@ -898,20 +1572,30 @@ LIMITS: collision is per point plus sharp corners (a sharp collider edge can pas
898
1572
  chamfer; shape 1 = squarer, -0.5 = flat, -1 = cove). Only the rim of a slab: extrude → poly_bevel {group:"border:top"}.
899
1573
  13) Clean asset pipeline: imported/broken mesh → mesh_repair (fuse, winding, small holes; report in detail repair_report)
900
1574
  → remesh_isotropic {target_length, feature_angle:40} (even triangles before uv_unwrap or simulation; target_attrib for
901
- adaptive size) → uv_unwrap → lod {levels:4, ratios:[1,0.5,0.25,0.1]} (prim lod + name _LOD0…, export split_by_name) or
902
- decimate {ratio, attributes:"uv N"} for one level. remesh_quad {target_faces:2000, feature_angle:45} produces field-aligned
1575
+ adaptive size) → uv_unwrap → lod {levels:4, ratios:[1,0.5,0.25,0.1]} (prim lod + name {name}_lod0… from name_format,
1576
+ export split_by_name; group "@name=magazine" for one part; mode switch + level for one level, named the same way) or
1577
+ decimate {ratio, attributes:"uv N"} for one level. A level that stops short warns with what holds it (uv seams, hard
1578
+ normals, group / prim attribute borders): reduce before unwrapping and compute vertex normals after lod. remesh_quad {target_faces:2000, feature_angle:45} produces field-aligned
903
1579
  quad-dominant polygons with point/vertex/prim attributes; mode:"quads_only" conformingly subdivides all faces and can
904
1580
  exceed target_faces, especially along hard curves. crease_group aligns explicit edges; group keeps its border fixed.
905
1581
  Inspect detail quad_fraction and singularities, and the wireframe (examples/quad_remesh.json). remesh (voxel) only
906
1582
  when the input is beyond repair (it drops attributes).
907
- 14) Street from shelf assets (help topic assets): road_strip on a line → lamp_post packed onto points_along_curve
908
- {side_offset, both_sides}; a house = four wall_segment walls (the street-facing one rotated 180°, sides ±90°, door:true
909
- on the front) + roof_gable/roof_hip translated to the wall top; fence, bench, crate, tree_lowpoly placed with transform
910
- or copy_to_points; forest_patch on a grid for a park. Whole graph: examples/shelf_street.json.`,
1583
+ 14) Street from TopoTopo's own packages (help topic packages): topotopo/street/road_strip on a line →
1584
+ topotopo/street/lamp_post packed onto points_along_curve {side_offset, both_sides}; a house = four
1585
+ topotopo/architecture/wall_segment walls (the street-facing one rotated 180°, sides ±90°, door:true on the front) +
1586
+ topotopo/architecture/roof_gable or roof_hip translated to the wall top; topotopo/street/fence and bench,
1587
+ topotopo/props/crate and topotopo/nature/tree_lowpoly placed with transform or copy_to_points;
1588
+ topotopo/nature/forest_patch on a grid for a park. Whole graph: examples/street_block.json.`,
911
1589
  };
912
1590
  export function topicList() {
913
1591
  return Object.keys(TOPICS);
914
1592
  }
1593
+ /** A help topic's text ("overview" or "instructions": the operating guide), or null for a name that is not a topic. */
1594
+ export function topicText(name) {
1595
+ if (name === 'overview' || name === 'instructions')
1596
+ return INSTRUCTIONS;
1597
+ return Object.hasOwn(TOPICS, name) ? TOPICS[name] : null;
1598
+ }
915
1599
  function paramLine(name, pd) {
916
1600
  let d = pd.default;
917
1601
  if (pd.type === 'graph')
@@ -922,11 +1606,21 @@ function paramLine(name, pd) {
922
1606
  const al = pd.aliases?.length ? ` (aka ${pd.aliases.join(', ')})` : '';
923
1607
  return ` ${name} ${pd.type}${opts}${def}${range} — ${pd.desc}${al}`;
924
1608
  }
1609
+ /**
1610
+ * A package output's kind and tags (NodeDef.package) as every listing says them, "mesh [conifer, low-poly]" (a working
1611
+ * folder's output that pins no kind: "kind not pinned [...]"); '' for other node types.
1612
+ */
1613
+ export function kindTags(def) {
1614
+ const p = def.package;
1615
+ return p ? `${p.kind ?? 'kind not pinned'}${p.tags?.length ? ` [${p.tags.join(', ')}]` : ''}` : '';
1616
+ }
925
1617
  export function nodeDoc(def) {
926
1618
  const out = [`## ${def.type} (${def.category})${def.aliases?.length ? ` aka ${def.aliases.join(', ')}` : ''}`];
927
1619
  if (def.deprecated)
928
1620
  out.push(`DEPRECATED: ${def.deprecated}`);
929
1621
  out.push(def.summary);
1622
+ if (kindTags(def))
1623
+ out.push(`what it is: ${kindTags(def)}`);
930
1624
  if (def.description)
931
1625
  out.push(def.description);
932
1626
  if (def.usesTime)
@@ -943,6 +1637,7 @@ export function nodeDoc(def) {
943
1637
  out.push(`example: ${JSON.stringify(def.example)}`);
944
1638
  return out.join('\n');
945
1639
  }
1640
+ /** The catalog by category; `cli` ends it with the command line's help flags instead of the MCP help tool. */
946
1641
  export function catalogText(defs, filter) {
947
1642
  let list = defs;
948
1643
  const hidden = filter?.deprecated ? 0 : list.filter((d) => d.deprecated).length;
@@ -952,9 +1647,9 @@ export function catalogText(defs, filter) {
952
1647
  list = list.filter((d) => d.category === filter.category);
953
1648
  if (filter?.search) {
954
1649
  const s = filter.search.toLowerCase();
955
- list = list.filter((d) => (d.type + ' ' + (d.aliases ?? []).join(' ') + ' ' + d.summary + ' ' + (d.description ?? '')).toLowerCase().includes(s));
1650
+ list = list.filter((d) => (d.type + ' ' + (d.aliases ?? []).join(' ') + ' ' + d.summary + ' ' + (d.description ?? '') + ' ' + kindTags(d)).toLowerCase().includes(s));
956
1651
  }
957
- const cats = [...new Set([...CATEGORY_ORDER, 'shelf', 'asset', ...list.map((d) => d.category)])];
1652
+ const cats = [...new Set([...CATEGORY_ORDER, 'asset', 'package', ...list.map((d) => d.category)])];
958
1653
  const out = [];
959
1654
  for (const c of cats) {
960
1655
  const items = list.filter((d) => d.category === c);
@@ -962,9 +1657,11 @@ export function catalogText(defs, filter) {
962
1657
  continue;
963
1658
  out.push(`[${c}]`);
964
1659
  for (const d of items)
965
- out.push(` ${d.type}${d.inputs.length ? '' : ' ◦'}${d.deprecated ? ' (deprecated)' : ''} — ${d.summary}`);
1660
+ out.push(` ${d.type}${d.inputs.length ? '' : ' ◦'}${d.deprecated ? ' (deprecated)' : ''} — ${d.summary}${kindTags(d) ? ` (${kindTags(d)})` : ''}`);
966
1661
  }
967
- out.push('(◦ = generator, no inputs). Use help {nodes:[...]} for params. Help topics: ' + topicList().join(', '));
1662
+ out.push(filter?.cli
1663
+ ? '(◦ = generator, no inputs). --help-node <type> for a node\'s params; --help-topic <name> for a topic: overview, ' + topicList().join(', ')
1664
+ : '(◦ = generator, no inputs). Use help {nodes:[...]} for params. Help topics: ' + topicList().join(', '));
968
1665
  if (hidden)
969
1666
  out.push(`${hidden} deprecated node type(s) hidden (include_deprecated: true lists them).`);
970
1667
  return out.join('\n');