# Operator Stacking

Operator Stacking is a powerful modular technique that lets users create complex structures intuitively, completely non-destructively and with every single step available at any point of a project.

Why stacking and not a more conventional approach with cable connections (as seen in many packages)? For one thing, stacking allows you to see much more of a tree than cable connections. It also structures all trees top-down, which makes them easier to read than a free layout. Finally, it's most convenient not having to create or delete connections while editing your tree. Move an operator away, and it is disconnected. Append it to a tree, and it is connected. Simple as that.

Like in every modular system, there are two basic parts to Operator Stacking: The elements you can use and the rules for their combination.

## Operators

Operators are the modules that make up a project. They represent bits of code that create, handle or alter data. By stacking them, you impose the order in which data is processed.

There are four basic kind of operators:

### Texture Operators

These Operators create and modify 2D images which can later be exported to be used in your productions.

### MinMesh Operators

These Operators create and modify 3D meshes. This capabilty of .werkkzeug3 is provided as a minimal environment in which to test your texture creations. It is not exportable and very basic.

### Structural Operators

Three operators help you structure your project: Load, Store and Nop can be used to bring transparency and clarity to your constructions.

### The Material 2.0 Operator

In conjunction with the MinMesh Operators, Material 2.0 dresses 3D meshes in your textures. A full-featured Blinn-Phong shader, it includes not just straight texturing but also environment maps, reflections maps, bump maps and alpha maps. Please note that the Material 2.0 Operator cannot be exported.

## Stacking rules

Operators are organised in trees. Each tree must have at least a root and a leaf in order to be complete and exportable. There is only one valid root, the Export Operator. There are a number of leaves, which are generators, i.e. operators that do not take any input.

Between the root and the leaf, any number of intermediate operators can be used. The tree can branch off to various other leaves when an operator takes more than one input, or when the output of an operator is piped into more than one recipient. Each upper end of a branch, however, must begin with one leaf, and only trees with a root are exported.

Operators produce output at their underside. An operator will try to give its output to any operator stacked under it. This way, you can easily send the output of an operator to any number of others simply by stacking them side by side under the output.

If an operator is handed an input it does not understand, or if a necessary input is missing, it will be painted red to show you quickly where difficulties may arise.