Use the Pixel Expression node to apply colour-based changes to a clip using the GLSL shading language. Contrary to Matchbox, it is not required to create a shader using .glsl and .xml files outside of the application, and then load the shader to use it.
What can achieved using the Pixel Expression node is more limited, but the commands are written inside the application and directly applied to the image, making it easier to apply simpler changes.
![]()
| Access | To access the Pixel Expression menu, use:
|
| Inputs |
|
| Outputs |
|
All the changes made to the images are processed using the Red, Green, Blue, and Matte channel expression fields. These fields use mathematical formulas written in the GLSL shading language to calculate the changes to be applied.
Built-in and custom variables, and formulas can be defined to allow values to be modified from the user interface.
Sets the GLSL mathematical formula to be applied to the pixels of the red channel from clips connected to the Front inputs.
Sets the GLSL mathematical formula to be applied to the pixels of the green channel from clips connected to the Front inputs.
Sets the GLSL mathematical formula to be applied to the pixels of the blue channel from clips connected to the Front inputs.
Sets the GLSL mathematical formula to be applied to the pixels from clips connected to the Matte inputs.
Click to add a GLSL Trigonometry, Exponential, Common Operator, or Generic Function command or one of the Inputs, Built-in Variables, Custom Variables, or Formulas to the corresponding channel expression field.
Use these options in the Inputs submenu to get pixel information from the clips connected to the node:
| Select: | To: |
|---|---|
front1.r or r1 |
Get information from pixels in the Red channel of the clip connected to the Front 1 input socket. |
front1.g or g1 |
Get information from pixels in the Green channel of the clip connected to the Front 1 input socket. |
front1.b or b1 |
Get information from pixels in the Blue channel of the clip connected to the Front 1 input socket. |
front2.r or r2 |
Get information from pixels in the Red channel of the clip connected to the Front 2 input socket. |
front2.g or g2 |
Get information from pixels in the Green channel of the clip connected to the Front 2 input socket. |
front2.b or b2 |
Get information from pixels in the Blue channel of the clip connected to the Front 2 input socket. |
matte1.a or m1 |
Get information from pixels of the clip connected to the Matte 1 input socket. |
matte2.a or m2 |
Get information from pixels of the clip connected to the Matte 2 input socket. |
Click to open the Expression Editor dialog window. When an expression has multiple lines, the icon on this button turns blue. The last line of the Text field is used to calculate the result of a channel's expression.
The following built-in variables can be used in the mathematical formulas set in the Channel expression fields:
| Variable: | Returns: |
|---|---|
| E | The Euler number: 2.718281828. |
| PI | The PI number: 3.14159265359. |
| centre.x | The value set in the Centre X field. |
| centre.y | The value set in the Centre Y field. |
| width | The width of the clip connected to the Front 1 input socket. |
| height | The height of the clip connected to the Front 1 input socket. |
| x | The position of the pixel along the X axis. |
| y | The position of the pixel along the Y axis. |
| frame | The current time of the Batch Group, in frames. |
Sets the value of the centre.x built-in variable.
Sets the value of the centre.y built-in variable.
Enable to display the on-screen manipulator used to modify the Centre X and Centre Y parameters in a viewport.
In addition to the built-in variables, it is possible to set 8 custom variables and 4 custom formulas. These custom parameters can be used to either make it possible to easily modify their values using fields in the user interface or to create more complex formulas that can be used in multiple channel expression fields.
Sets a custom name for a variable. This is the name to be used in the channel expression fields under the Channels section.
Sets a float value for the corresponding custom variable.
The values in these fields are normal floats and are incremented to the tenths value by default. In some mathematical expressions, the expected value is between 0.00 and 1.00, making adjustments to these fields too sensitive. In such a scenario, the following options are available:
All the variable numeric parameters can be animated and have a channel available in the Animation editor.
Select whether the formula returns a float, vec2, vec3, or vec4.
Sets a custom name for a formula. This is the name to be used in the channel expression fields under the Channels section.
Sets a mathematical operation or expression for the corresponding custom formula. Built-in variables, custom variables, and another formula can be used inside a formula.
No image is rendered by the Pixel Expression node when there is an error in the definition of a channel expression, custom variable, or custom formula.
When such an error is detected by the application, three visual cues can be observed:
An error is also added to the Message Console and to the application log files when the node cannot compile the content of the channel expression fields.
Pixel Expression setups can be saved as presets at the Shared or User levels.
To save a Pixel Expression setup on disk:
A preset containing the selected components is saved.
To load a Pixel Expression preset:
or
All Pixel Expression attributes are available through the Python API.