Skip to content

Project file format ​

A project is one JSON document named <name>.treegen.json. It holds the whole graph, the materials and the export defaults. Textures stay outside, referenced by relative paths. You can read it, diff it in Git and edit it in any text editor; askrgarden-cli validate checks it.

Why one JSON document ​

NeedOne JSON documentJSON LinesZip as working file
One schema version and migrationsone schema_version at the topper line, awkwardinside, fine
Git diffssmall line diffsfine for logs, not for a grapha binary blob
Texturesoutside, by relative pathsameembedded
AI agentsread and write it whole, check it with JSON Schemamust reassemble recordsmust unzip

The double suffix keeps .json tooling working and still says what the file is. A zip (.treegenz) is only for sharing (Saving and files).

Shape ​

json
{
  "format": "treegen",
  "schema_version": 1,
  "generator": "treegen 1.0.0",
  "name": "Oak sample",
  "units": "meters",
  "up_axis": "+Y",
  "seed": 1234,
  "graph": {
    "nodes": [
      {"id": "trunk", "type": "trunk", "params": {"length": 6.0, "base_radius": 0.25}},
      {"id": "boughs", "type": "branches", "params": {"count": 9, "angle": 55}},
      {"id": "bark", "type": "pbr_material", "params": {"name": "bark", "pbrgen_manifest": "textures/oak_bark_manifest.json"}},
      {"id": "bark_mesh", "type": "bark_mesher", "params": {"radial_segments_max": 10}},
      {"id": "out", "type": "tree_output", "params": {"lods": [1.0, 0.5, 0.2]}}
    ],
    "edges": [
      {"from": "trunk.skeleton", "to": "boughs.parent"},
      {"from": "boughs.skeleton", "to": "bark_mesh.skeleton"},
      {"from": "bark.material", "to": "bark_mesh.material"},
      {"from": "bark_mesh.mesh", "to": "out.meshes"}
    ]
  },
  "export": {"default_format": "glb"},
  "editor": {"positions": {"trunk": [0, 0], "boughs": [260, 0]}}
}

Rules ​

  • format and schema_version are required. The version goes up only when an old reader would misread a new file.
  • Node ids are stable strings (trunk, branches_2…). They seed the node's random stream, so renaming a node re-rolls it.
  • Edges use "<node id>.<port>" strings. Port names are in the Node reference.
  • params holds every parameter when the editor saves, not only the changed ones, so the file builds the same tree after a later version changes a default. A hand-written file may leave params out: they take the default.
  • Varying values use the forms in Numbers that vary.
  • Materials are nodes, so the whole tree is one graph.
  • Editor-only state (node positions, the graph view) lives under editor. It never changes the geometry, and tools may drop it.
  • Paths are relative to the document, with forward slashes. Absolute paths are refused on save.
  • Saved files have sorted keys inside params, 2-space indent, UTF-8 and floats rounded to 6 significant digits, so diffs stay small.

Versions and migration ​

Opening an older file upgrades it in memory through a chain of migrations; saving writes the current version. A file newer than the program is refused with a clear message.

Checking a file ​

powershell
.\askrgarden-cli.cmd validate my.treegen.json          # errors with the node id and the field
.\askrgarden-cli.cmd validate my.treegen.json --json   # the same, as JSON for tools
.\askrgarden-cli.cmd nodes --json                      # the node catalog with a JSON Schema per node

Problems on nodes that do not reach the Tree output are warnings, not errors (Detached nodes).