The Node Menu
When you click Add Node in the Shader Editor menu bar, you will be shown the Node Menu.
Inputs and Outputs
To connect nodes you drag the output of one node to the input of another node. The data types are color coded and must match for the two end points to connect.
| Color | Data Type |
|---|---|
| int | |
| float | |
| vec2 | |
| vec3 | |
| vec4 | |
| rgba | |
| hsla | |
| sampler2D |
By far the most commonly used types are float and rgba.
The sampler2D type corresponds to texture values.
Both rgba and hsla are vec4 types internally, but to prevent mistakes, they are type checked as if they were separate types.
There are converter nodes that can convert from int to/from float, and rgba to/from hsla.
Default Values
Many nodes rely on environment parameters, and rather than having to connect them each time, they use default values (that you can override). The environment parameters that often are defaulted are:
| Variable | Default Value |
|---|---|
| t | The running time. This is important for animated objects. |
| position | The current 3D position. |
| uv | The default mapping from 3D coordinates to 2D coordinates. |
We will go through the sections in the Node Menu below. You can click on any node to go to its documentation.