How Do Graph State Variables Work?

When evaluating scene graph data at any node, Katana follows a recursive process of asking the node to describe its inputs, then following those inputs and repeating the procedure on any nodes above. This process has the effect of identifying the nodes that contribute to the scene, which can be evaluated later to produce the scene graph. Many nodes always identify the same inputs, but a few use conditional logic. For example, a Switch node uses a parameter to choose its input; sub-graphs above non-active inputs are never evaluated.

Katana also maintains a Graph State data structure when traversing up the node graph. This contains information such as the current frame and the shutter timings. As part of identifying their inputs, nodes can read from and write to the Graph State. For example, a TimeOffset node reads the current frame time and increments or decrements it by some amount. The modified Graph State is then passed to the node above. It is important to realize that the Graph State information flows up the node graph, rather than down, as scene data does.

Graph State Variables essentially allow us to define key-value pairs within the Graph State, and can be set at the project or node level. They can then be referenced and manipulated by other nodes, allowing for a powerful workflow feature, where groups of nodes and entire node graph branches can be enabled and disabled with ease.