Aller au contenu

Color Matrix Node

By Kriss Norde

Color Matrix applies a 4×4 linear transformation matrix to the RGBA channels. Each output pixel is a weighted combination of the input channels + an additive offset. A mathematical tool for channel swaps, sepia, weighted monochrome, and any color transform the other nodes do not provide.

Overview

Color Matrix exposes an editable 4×4 matrix - the same kind shaders use for color transformations. The identity matrix changes nothing; by editing the coefficients, you build effects such as sepia, weighted B&W, channel swaps or inversions.

Powerful for people who think in coefficients. Less intuitive than a Color Corrector for classic grading - prefer it for "exotic" or reproducible transformations (a matrix is easy to copy/share).

Where to find this node

  • Effects Library: Tools > Color > Color Matrix
  • Quick add: right-click in the Node Editor → Add Tool > Color > Color Matrix

Inputs

  • Input (orange) - required. The 2D image to transform.
  • Effect Mask (blue) - optional. Limits the transformation to an area.

Setup

MediaIn → Color Matrix → Merge 2D → Saver

How the matrix works

Each output channel is computed as:

[R out] = cRR × [R in] + cRG × [G in] + cRB × [B in] + cRA × [A in] + offsetR
[G out] = cGR × [R in] + cGG × [G in] + cGB × [B in] + cGA × [A in] + offsetG
[B out] = cBR × [R in] + cBG × [G in] + cBB × [B in] + cBA × [A in] + offsetB
[A out] = cAR × [R in] + cAG × [G in] + cAB × [B in] + cAA × [A in] + offsetA

Structure of the matrix in the Inspector:

  • Rows = output channels: R, G, B, A.
  • Columns = input channels: R, G, B, A + an Add column (constant offset).

The identity matrix (default):

        R   G   B   A   Add
R out:  1   0   0   0    0     → R out = R in (unchanged)
G out:  0   1   0   0    0     → G out = G in
B out:  0   0   1   0    0     → B out = B in
A out:  0   0   0   1    0     → A out = A in

This matrix copies each input channel to the matching output channel, without any change.

Controls tab

Update Lock
Temporarily disables rendering while you edit the matrix. Useful if every change triggers a heavy recalculation. Turn it back on once the matrix is set.
Matrix
A 4-row × 5-column grid (RGBA + Add) to edit. All the coefficients are floats - negative values are possible (to subtract), > 1 is possible (to amplify).
Invert
Inverts the matrix (computes the inverse matrix). Lets you cancel the effect of a Color Matrix downstream, the equivalent of a chained undo. Warning: if the matrix is singular (not invertible, e.g. all zeros on a row), the inversion fails.

Classic matrix recipes

Weighted B&W (standard Rec.709 luminance)

Each output channel is a weighted combination of the source RGB, giving a perceptually correct luminance:

        R      G      B      A   Add
R out: 0.2126 0.7152 0.0722  0    0
G out: 0.2126 0.7152 0.0722  0    0
B out: 0.2126 0.7152 0.0722  0    0
A out:  0      0      0      1    0

The 3 RGB rows are identical → each output pixel has R=G=B → a grayscale image. The coefficients 0.2126 / 0.7152 / 0.0722 reflect human sensitivity (green dominates).

Sepia

        R      G      B      A   Add
R out: 0.393  0.769  0.189   0    0
G out: 0.349  0.686  0.168   0    0
B out: 0.272  0.534  0.131   0    0
A out:  0      0      0      1    0

Channel swap (Red ↔ Blue)

        R   G   B   A   Add
R out:  0   0   1   0    0   (Red out = Blue in)
G out:  0   1   0   0    0   (Green unchanged)
B out:  1   0   0   0    0   (Blue out = Red in)
A out:  0   0   0   1    0

Negative (color inversion)

        R   G   B   A   Add
R out: -1   0   0   0    1   (1 - R)
G out:  0  -1   0   0    1
B out:  0   0  -1   0    1
A out:  0   0   0   1    0

Global tint (warm cast)

        R   G   B   A   Add
R out:  1   0   0   0   0.1   (+10% red everywhere)
G out:  0   1   0   0   0.05  (+5% green)
B out:  0   0   1   0    0
A out:  0   0   0   1    0

Use cases

  • Channel swap - swap R and B to debug a shot that arrives with inverted channels (typical of badly made BMP imports).
  • Scientific B&W - Rec.709 weighted luminance instead of a naive desaturation. Preserves the correct tonal hierarchy.
  • Faithful sepia effect - a recognized mathematical formula (used in Photoshop, After Effects).
  • Reproducible stylized look - a custom matrix can be saved and reapplied identically to other shots (more reliable than a Color Corrector with many parameters).
  • Full negative - negative coefficients + offsets = a pure inversion.
  • Uniform color cast - the Add column lets you add a uniform color to every pixel (≠ a tint, which multiplies).

Tips & pitfalls

  • Matrix thinking vs slider thinking - if you do not naturally think in coefficients, Color Matrix is intimidating. For standard grading, prefer Color Corrector.
  • Perfect reproducibility - a matrix is 20 coefficients, easy to store as a preset or share between projects. It is the tool of choice for signature looks.
  • Invert is fragile - if a row is all zeros, the matrix is no longer invertible. For a real "undo", save your state and restore it instead.
  • Update Lock on complex scenes - turn it on when you edit several cells and the render recalculates on every change.
  • Matrix = linear transformation - it cannot do non-linear operations (gamma, S-curve). For that, use Color Curves.
  • To extract a perceptual luminance somewhere in a flow, the B&W Color Matrix is faster than a Color Corrector in desaturation mode.