Procedural Node Graph Interface
Relevant source files
The following files were used as context for generating this wiki page:
- website/content/learn/_outline_draft.md
- website/content/learn/introduction/features-and-limitations.md
- website/content/features.md
- tools/node-docs/src/page_node.rs
- website/content/blog/2024-01-01-looking-back-on-2023-and-what's-next.md
- website/content/blog/2022-05-12-distributed-computing-in-the-graphene-runtime.md
The Procedural Node Graph Interface is the core architectural component of Graphite that enables a nondestructive, generative workflow for 2D graphics. It allows users to describe "how" a creative decision becomes a visual outcome by defining operations as a sequence of interconnected nodes rather than performing destructive alterations to pixel data. This hybrid approach combines traditional layer-based compositing with visual scripting, where the layer panel and node graph serve as interchangeable views of the same document structure.
Sources: website/content/features.md, website/content/learn/introduction/features-and-limitations.md:15-20, website/content/blog/2024-01-01-looking-back-on-2023-and-what's-next.md:150-160
Node Graph Architecture
The interface represents artwork as a Directed Acyclic Graph (DAG) where graphical data flows from left to right through various processing units. The system is powered by Graphene, a node-based engine that functions as a programming language, compiling the graph into executable programs for rendering.
Core Components
- Nodes: Entities with input connectors (left) and output connectors (right) that perform specific functions or operations.
- Links: Wires that connect outputs to inputs, directing the flow of data.
- Layers: Specialized nodes that composite data in a vertical stack (bottom-to-top).
- Connectors: Specific ports on nodes where links are attached.
Sources: website/content/learn/_outline_draft.md:46-55, website/content/blog/2022-05-12-distributed-computing-in-the-graphene-runtime.md:30-45
Data Flow Diagram
The following diagram illustrates how geometry data is processed through the node graph to produce a final rendered output.
Node Interface and Metadata
Each node in the graph follows a strict interface definition involving inputs, outputs, and context dependencies. The interface is defined by metadata that determines how the node is exposed to the user and how it interacts with the Graphene runtime.
Input and Output Structure
Nodes possess primary inputs and outputs, as well as parameters that can be adjusted manually or exposed to the graph for procedural control.
| Component | Description |
|---|---|
| Primary Input | The main data stream (e.g., Geometry, Image) entering the node. |
| Parameters | Specific settings (e.g., Radius, Instances, Color) that modify the node's operation. |
| Primary Output | The result produced by the node operation, typically labeled as "Result". |
| Exposed Fields | Parameters that have been converted into graph connectors to be driven by other nodes. |
Sources: tools/node-docs/src/page_node.rs:90-130, website/content/learn/introduction/features-and-limitations.md:55-60
Type System
The node graph utilizes a type-safe system where connectors only accept valid data types.
- Valid Types: Nodes can handle vector shapes, numbers, strings, colors, and large data tables.
- Type Inference: The Graphene engine ensures that variables of unknown types satisfy the constraints of later usages in the graph.
Sources: website/content/blog/2022-05-12-distributed-computing-in-the-graphene-runtime.md:50-55, tools/node-docs/src/page_node.rs:20-35
User Interaction and Controls
The node graph interface provides several controls for managing node behavior and visibility directly within the graph view.
Node Controls
| Action | Description |
|---|---|
| Visibility Toggle | Toggles a node's active state. Hidden nodes are bypassed in the data flow. Shortcut: Ctrl+H. |
| Preview Mode | Temporarily shifts the graph output to the selected node, bypassing the standard Output node. Shortcut: Alt+Click. |
| Expose Parameter | Converts a static property in the Properties panel into an input connector on the node. |
Sources: website/content/learn/_outline_draft.md:65-75, website/content/learn/introduction/features-and-limitations.md:60-65
Interface Logic Sequence
The following sequence diagram shows the interaction between the user interface and the backend when a parameter is adjusted.
Procedural Workflow Example
The power of the interface is best demonstrated through procedural generators like the "Circular Repeat" node. Instead of manual duplication, the node uses parameters to calculate the final layout.
- Input Geometry: A base shape (e.g., an arch) is provided by a Path node.
- Styling: A Fill node applies color data.
- Transformation Procedure: The Circular Repeat node takes inputs such as Radius, Instances, and Angle Offset.
- Generation: The engine calculates the position of every instance based on these parameters and outputs a combined geometry.
Sources: website/content/learn/introduction/features-and-limitations.md:40-55
Summary
The Procedural Node Graph Interface is the foundation of Graphite's nondestructive mission. By treating artwork as a set of instructions (Graphene programs) rather than static data, it enables rapid iteration, parametric animation, and automated content pipelines. The system’s architecture ensures that any creative decision can be adjusted via node parameters at any point in the workflow without loss of quality.
Sources: website/content/blog/2022-03-12-graphite-a-vision-for-the-future-of-2d-content-creation.md, website/content/features.md