Graph file format

Graphs are saved as JSON files with the extension .ktgraph.json.

{
  "format": "klartraum-studio-graph",
  "version": 1,
  "nodes": [
    {
      "id": 1,
      "kind": "scene",
      "title": "Scene",
      "position": [0.0, 0.0],
      "params": { "path": "3rdparty/spz/samples/racoonfamily.spz", "flipY": false }
    },
    {
      "id": 2,
      "kind": "camera",
      "title": "Orbit Camera",
      "position": [0.0, 150.0],
      "params": { "azimuth": 0.9, "elevation": -0.5, "distance": 1.0, "target": [-0.5, 0.0, 0.5], "up": "y" }
    }
  ],
  "links": [
    { "from": [1, 0], "to": [4, 0] }
  ]
}

Top level

Key

Meaning

format

Always "klartraum-studio-graph"; other files are rejected.

version

Format version, currently 2 (meta node definitions). Files from a newer version are rejected; older ones load.

nodes

The nodes of the authoring graph.

links

The connections between node pins.

definitions

The graph’s meta node definitions (optional), those used by others first.

Nodes

Key

Meaning

id

Unique integer ID within the file.

kind

The node kind (see below).

title

The title shown in the editor.

position

Position on the canvas, [x, y].

params

The node’s parameters; which keys exist depends on the kind. Missing keys take their defaults.

Node kinds: scene, image_file, number, time, sine, upload_number, transform_gaussians, merge_gaussians, upload_gaussians, make_transform, transform_gaussians_gpu, merge_gaussians_gpu, camera, swapchain_target, offscreen_target, gaussian_splatting, image_to_tensor, tensor_to_image, resample, onnx_model, add, subtract, multiply, divide, relu, sigmoid, sqrt, softmax, sd_prompt, sd_latent_noise, sd_ddim_sampler, present, preview, image_file_writer, meta. See the Node reference for what they do. Files with the former kinds sd_text_encoder and sd_vae_decoder load them as the built-in meta nodes.

A meta node’s parameters name its definition and the values it sets for exposed parameters:

"params": { "definition": "sd15_vae_decoder", "values": { "Model": "data/onnx/sd15_denoiser_256/sd15_vae_decoder.onnx" } }

Definitions

Each definition has a name (unique among the graph’s and the built-in definitions), a title, a group and a description for the add-node menu, the inner graph’s nodes and links (as above), and its interface:

Key

Meaning

inputs

Exposed inputs: name and targets, the inner input pins [node id, pin index] it feeds.

outputs

Exposed outputs: name and targets, the one inner output pin it is.

params

Exposed parameters: name, and the inner node and parameter key it stands for.