# Node catalog

> Every node of Pyzed's shader graphs, by category: what it does, its inputs, outputs and settings, and a small example you can paste.

Source: https://albakore.github.io/pyzed/shading/nodes/

A shader graph is made of **92 node types** (and 137 entries in the Shader view's sidebar, since many
nodes come in several flavors: *Add*, *Multiply* and *Step* are all the **Math** node). This catalog describes each
one: what it is for in plain words, its ports and settings, and an example in Python.

## How to read a node

```mermaid
flowchart LR
    in1["inputs (left)"] --> node["Node<br/>settings inside"] --> out1["outputs (right)"]
```

- **Inputs** are on the left of a node and **outputs** on the right. A wire goes from an output to an input.
- An input that is not wired uses its **default**: a number, a vector, a color, or a *context* value such as
  *UV* (the pixel's position) or *Time*. You can type another value right on the node.
- **Settings** are not ports: an operation, a noise kind, a blend mode, the stops of a gradient. Change them in the
  Properties panel (or as keyword arguments in Python).

### Types

| Type | What it holds | Example |
| --- | --- | --- |
| `float` | One number | `0.5`, a brightness, a time |
| `int` | A whole number | `5` octaves |
| `bool` | True or false | is the mouse over the shader? |
| `vec2` | Two numbers | a position `(x, y)`, a size |
| `vec3` | Three numbers | a color `(r, g, b)` from 0 to 1 |
| `vec4` | Four numbers | a color with alpha `(r, g, b, a)` |
| `texture` | An image | a `texture` variable |
| `T` | Any of the number types | Math nodes: the widest type wired to them |

Values convert on the way: a `float` fills every component of a vector (`0.5` becomes `(0.5, 0.5, 0.5)`), and a
`vec3` becomes a color with alpha 1. A wire that can never work, such as a texture into a number, is refused.

**Numbers from 0 to 1:**

In shaders, colors and most masks go from **0 to 1**, not 0 to 255: `(1, 0.5, 0)` is orange, `0` is black and `1`
is white. Many nodes return 0..1 so you can multiply them together, like stacking stencils.

## Every node

|  |  |
| --- | --- |
| **Input** | [UV](https://albakore.github.io/pyzed/shading/nodes/inputs/#uv), [Pixel](https://albakore.github.io/pyzed/shading/nodes/inputs/#pixel), [Size](https://albakore.github.io/pyzed/shading/nodes/inputs/#size), [Time](https://albakore.github.io/pyzed/shading/nodes/inputs/#time), [Mouse](https://albakore.github.io/pyzed/shading/nodes/inputs/#mouse), [Centered UV](https://albakore.github.io/pyzed/shading/nodes/inputs/#centered-uv) |
| **Parameters** | [Parameter](https://albakore.github.io/pyzed/shading/nodes/inputs/#parameter) |
| **Constants** | [Float](https://albakore.github.io/pyzed/shading/nodes/inputs/#float), [Int](https://albakore.github.io/pyzed/shading/nodes/inputs/#int), [Bool](https://albakore.github.io/pyzed/shading/nodes/inputs/#bool), [Vector2](https://albakore.github.io/pyzed/shading/nodes/inputs/#vector2), [Vector3](https://albakore.github.io/pyzed/shading/nodes/inputs/#vector3), [Vector4](https://albakore.github.io/pyzed/shading/nodes/inputs/#vector4), [Color](https://albakore.github.io/pyzed/shading/nodes/inputs/#color), [Math constants](https://albakore.github.io/pyzed/shading/nodes/inputs/#math-constants) |
| **Math** | [Math](https://albakore.github.io/pyzed/shading/nodes/math/#math-1), [Function](https://albakore.github.io/pyzed/shading/nodes/math/#function), [Mix](https://albakore.github.io/pyzed/shading/nodes/math/#mix), [Clamp](https://albakore.github.io/pyzed/shading/nodes/math/#clamp), [Smoothstep](https://albakore.github.io/pyzed/shading/nodes/math/#smoothstep), [Remap](https://albakore.github.io/pyzed/shading/nodes/math/#remap), [Multiply add](https://albakore.github.io/pyzed/shading/nodes/math/#multiply-add) |
| **Vector** | [Compose](https://albakore.github.io/pyzed/shading/nodes/vectors-uv/#compose), [Decompose](https://albakore.github.io/pyzed/shading/nodes/vectors-uv/#decompose), [Swizzle](https://albakore.github.io/pyzed/shading/nodes/vectors-uv/#swizzle), [Dot](https://albakore.github.io/pyzed/shading/nodes/vectors-uv/#dot), [Cross](https://albakore.github.io/pyzed/shading/nodes/vectors-uv/#cross), [Length](https://albakore.github.io/pyzed/shading/nodes/vectors-uv/#length), [Distance](https://albakore.github.io/pyzed/shading/nodes/vectors-uv/#distance), [Normalize](https://albakore.github.io/pyzed/shading/nodes/vectors-uv/#normalize), [Reflect](https://albakore.github.io/pyzed/shading/nodes/vectors-uv/#reflect), [Polar](https://albakore.github.io/pyzed/shading/nodes/vectors-uv/#polar) |
| **UV** | [Tiling and offset](https://albakore.github.io/pyzed/shading/nodes/vectors-uv/#tiling-and-offset), [Scroll](https://albakore.github.io/pyzed/shading/nodes/vectors-uv/#scroll), [Rotate](https://albakore.github.io/pyzed/shading/nodes/vectors-uv/#rotate), [Twirl](https://albakore.github.io/pyzed/shading/nodes/vectors-uv/#twirl), [Pixelate](https://albakore.github.io/pyzed/shading/nodes/vectors-uv/#pixelate), [Barrel](https://albakore.github.io/pyzed/shading/nodes/vectors-uv/#barrel), [Kaleidoscope](https://albakore.github.io/pyzed/shading/nodes/vectors-uv/#kaleidoscope), [Flip](https://albakore.github.io/pyzed/shading/nodes/vectors-uv/#flip), [Repeat](https://albakore.github.io/pyzed/shading/nodes/vectors-uv/#repeat) |
| **Noise** | [Noise](https://albakore.github.io/pyzed/shading/nodes/noise-patterns/#noise-1), [Fractal noise](https://albakore.github.io/pyzed/shading/nodes/noise-patterns/#fractal-noise), [Voronoi](https://albakore.github.io/pyzed/shading/nodes/noise-patterns/#voronoi), [White noise](https://albakore.github.io/pyzed/shading/nodes/noise-patterns/#white-noise), [Random](https://albakore.github.io/pyzed/shading/nodes/noise-patterns/#random) |
| **Patterns** | [Checker](https://albakore.github.io/pyzed/shading/nodes/noise-patterns/#checker), [Stripes](https://albakore.github.io/pyzed/shading/nodes/noise-patterns/#stripes), [Grid](https://albakore.github.io/pyzed/shading/nodes/noise-patterns/#grid), [Dots](https://albakore.github.io/pyzed/shading/nodes/noise-patterns/#dots), [Linear gradient](https://albakore.github.io/pyzed/shading/nodes/noise-patterns/#linear-gradient), [Radial gradient](https://albakore.github.io/pyzed/shading/nodes/noise-patterns/#radial-gradient), [Wave](https://albakore.github.io/pyzed/shading/nodes/noise-patterns/#wave) |
| **Shapes** | [Circle](https://albakore.github.io/pyzed/shading/nodes/shapes/#circle), [Box](https://albakore.github.io/pyzed/shading/nodes/shapes/#box), [Ring](https://albakore.github.io/pyzed/shading/nodes/shapes/#ring), [Segment](https://albakore.github.io/pyzed/shading/nodes/shapes/#segment), [Polygon](https://albakore.github.io/pyzed/shading/nodes/shapes/#polygon), [Star](https://albakore.github.io/pyzed/shading/nodes/shapes/#star), [Combine shapes](https://albakore.github.io/pyzed/shading/nodes/shapes/#combine-shapes), [Fill](https://albakore.github.io/pyzed/shading/nodes/shapes/#fill), [Stroke](https://albakore.github.io/pyzed/shading/nodes/shapes/#stroke), [Glow](https://albakore.github.io/pyzed/shading/nodes/shapes/#glow) |
| **Color** | [HSV to RGB](https://albakore.github.io/pyzed/shading/nodes/color-effects/#hsv-to-rgb), [RGB to HSV](https://albakore.github.io/pyzed/shading/nodes/color-effects/#rgb-to-hsv), [Hue shift](https://albakore.github.io/pyzed/shading/nodes/color-effects/#hue-shift), [Saturation](https://albakore.github.io/pyzed/shading/nodes/color-effects/#saturation), [Brightness and contrast](https://albakore.github.io/pyzed/shading/nodes/color-effects/#brightness-and-contrast), [Luminance](https://albakore.github.io/pyzed/shading/nodes/color-effects/#luminance), [Grayscale](https://albakore.github.io/pyzed/shading/nodes/color-effects/#grayscale), [Invert](https://albakore.github.io/pyzed/shading/nodes/color-effects/#invert), [Gamma](https://albakore.github.io/pyzed/shading/nodes/color-effects/#gamma), [Posterize](https://albakore.github.io/pyzed/shading/nodes/color-effects/#posterize), [Blend](https://albakore.github.io/pyzed/shading/nodes/color-effects/#blend), [Palette](https://albakore.github.io/pyzed/shading/nodes/color-effects/#palette), [Gradient](https://albakore.github.io/pyzed/shading/nodes/color-effects/#gradient), [RGBA](https://albakore.github.io/pyzed/shading/nodes/color-effects/#rgba), [Layer](https://albakore.github.io/pyzed/shading/nodes/color-effects/#layer) |
| **Effects** | [Vignette](https://albakore.github.io/pyzed/shading/nodes/color-effects/#vignette), [Scanlines](https://albakore.github.io/pyzed/shading/nodes/color-effects/#scanlines), [Film grain](https://albakore.github.io/pyzed/shading/nodes/color-effects/#film-grain) |
| **Texture** | [Sample texture](https://albakore.github.io/pyzed/shading/nodes/color-effects/#sample-texture) |
| **Logic** | [Compare](https://albakore.github.io/pyzed/shading/nodes/logic-utility/#compare), [Select](https://albakore.github.io/pyzed/shading/nodes/logic-utility/#select), [Logic](https://albakore.github.io/pyzed/shading/nodes/logic-utility/#logic-1) |
| **Variables** | [Set value](https://albakore.github.io/pyzed/shading/nodes/logic-utility/#set-value), [Get value](https://albakore.github.io/pyzed/shading/nodes/logic-utility/#get-value) |
| **Utility** | [Reroute](https://albakore.github.io/pyzed/shading/nodes/logic-utility/#reroute), [Expression](https://albakore.github.io/pyzed/shading/nodes/logic-utility/#expression), [Shader function](https://albakore.github.io/pyzed/shading/nodes/logic-utility/#shader-function), [Comment](https://albakore.github.io/pyzed/shading/nodes/logic-utility/#comment) |
| **Output** | [Output](https://albakore.github.io/pyzed/shading/nodes/logic-utility/#output-1) |

**Try a node:**

Each node is shown as it looks in the Shader view, with the preview of its default settings. To play with one, add
it from the Shading sidebar and wire it to the Output, or paste its example into a Python file and run it.
