Reference / Effects / Utility
Updated
Custom shader
Custom shader is a Utility effect.
What it does
Section titled “What it does”Runs a program you write. Edit shader… opens a code editor, or
Load from file… reads a .wgsl file. The
program is one WGSL function, fn shade(uv: vec2<f32>) -> vec4<f32>. uv runs from 0 to
1 across the frame. On a box in a node graph whose picture reaches past the frame, it runs
below 0 and above 1 there.
Parameters the shader declares become ordinary rows in Effect controls, with sliders, keyframes and expressions like any built-in effect’s.
The effect also holds an inner node graph. The effect’s box on the Graph panel carries a small picture of it, and so does the Node panel, or Click to open when the shader has no graph yet. Click the picture and the graph opens the way a precomp does. In Effect controls, Open graph opens it. So does a double-click on the box, or on the effect’s heading in Effect controls. A Custom shader box in a node graph composition carries the picture and opens the same way. The panel draws three kinds of graph on the one canvas: a layer’s stack, this inner graph, and a node graph composition.
Parameters
Section titled “Parameters”| Parameter | Control | Range | Default | Unit |
|---|---|---|---|---|
| Second input | Layer | Any layer in the composition | None | - |
| Edit shader… | Button | - | - | - |
| Load from file… | Button | - | - | - |
| Mix | Slider | 0 to 100 | 100 | Per cent |
| Blend | Dropdown | Normal · Darken · Multiply · Colour burn · Linear burn · Darker colour · Add · Lighten · Screen · Colour dodge · Lighter colour · Overlay · Soft light · Hard light · Linear light · Vivid light · Pin light · Hard mix · Difference · Exclusion · Subtract · Divide · Hue · Saturation · Colour · Luminosity | Normal | - |
| Matte | Layer | Any layer in the composition | None | - |
| Invert | Checkbox | On or off | Off | - |
| Channel | Dropdown | Luminance · Alpha · Red · Green · Blue | Luminance | - |
In the Effect Controls panel:
- Matte is an input to an effect, scaling the strength. Invert inverts the mattes for calculating strength.
What each control does
Section titled “What each control does”- Second input: one extra layer the shader can sample. A shader that needs three inputs is two shaders in a stack.
- Edit shader…: opens the code editor.
- Load from file…: reads the shader text from a file.
- Mix: how much of the result replaces the original.
- Matte and Invert drive the strength of the effect from another layer; see Effects.
Rows the shader declares appear below these, and are the shader’s own.