Nodes/radiance/◎ Radiance Color Matrix
ComfyUI Node

◎ Radiance Color Matrix

Radiance Color Matrix — the 3x3 math behind every 'make it look like this' filter

By fxtdstudios·Created 7 months ago·Updated 9 days ago· 242
◎ Radiance Color Matrix
  • image
  • image
presetCustom
matrix_typeRGB (3x3)
r_vector1.0, 0.0, 0.0
g_vector0.0, 1.0, 0.0
b_vector0.0, 0.0, 1.0
a_vector0.0, 0.0, 0.0, 1.0
offset0.0, 0.0, 0.0
clamp_outputfalse

Every color-grading plugin you've ever used - every sepia, every "fade", every Instagram filter - is secretly just a 3x3 matrix multiplying your RGB values, plus a tiny offset. Radiance Color Matrix puts that math on the table with your hands on it. It applies a 3x3 (RGB) or 4x4 (RGBA) color matrix to an image, on the GPU, and it's the node you reach for when you want a specific, repeatable color transform rather than another warm-temperature slider.

The name is a mild lie in the good direction - it's "GPU" in that it uses your graphics hardware, but there's no model, no download, no setup. It's pure linear algebra. If you've ever wanted to know exactly what a "look" is doing, this node shows you: each output channel is a weighted sum of the input channels, and the weights are right there in text fields.

How it works

For a 3x3 matrix, the red vector (r_vector) holds the three weights that compute the output red channel: output_R = r_vector · (R, G, B). Same for g_vector and b_vector. The 4x4 mode adds a_vector so you can also transform alpha - useful for comp work where the matte needs to shift with the color. The optional offset adds a constant after the multiply (the [1,1,1] that makes the Invert preset work: an inverted RGB image would be black without it).

The source ships five presets, and they're worth reading as a tutorial:

  • Identity - the 3x3 that does nothing. Copy it to start a custom matrix from a known baseline.
  • Sepia - the classic film-fade weights (0.393, 0.769, 0.189 on the red row, etc.).
  • B&W (Luminance) - every row is the Rec.709 luma weights (0.2126, 0.7152, 0.0722), so all three channels collapse to the same grayscale value.
  • Invert - a negative identity, which is why it ships a built-in [1,1,1] offset.
  • Custom - your vectors, your rules.

The inputs that matter

  • preset - start here. Pick Sepia or B&W, look at what the vectors contain, then switch to Custom.
  • matrix_type - RGB (3x3) or RGBA (4x4). The 4x4 also needs a_vector, which defaults to the identity alpha row 0,0,0,1.
  • r_vector / g_vector / b_vector - comma-separated weight triples. "1.0, 0.0, 0.0" means "output R = input R," i.e. the identity row. Mix channels by putting nonzero weights in the other slots.
  • offset - three comma-separated constants added after the multiply. This is the brightness shift, and the Invert preset needs 1.0, 1.0, 1.0.
  • clamp_output - off by default. Turn it on to clip results to 0–1; leave it off and you can push values past 1.0, which is the whole point if you're feeding an HDR pipeline.

Output: a single image, same shape as the input.

Why you'd reach for this over the presets

Because a matrix is the one color transform you can write down and hand to someone. Want a true cross-process look that a preset doesn't cover? Type the weights. Working in a pipeline that needs a specific camera matrix? Paste it in. The preset-vs-custom workflow is the honest way to learn: each preset is a worked example of matrix math you can read, and Custom is the blank sheet.

Installing

cd ComfyUI/custom_nodes
git clone https://github.com/fxtdstudios/radiance.git
cd radiance
pip install -r requirements.txt   # or requirements_windows.txt / requirements_linux.txt / requirements_mac_silicon.txt

Or search Radiance in ComfyUI Manager. Restart after; Linux needs libopenexr-dev first.

Gotchas

Two classic mistakes. First, typing a matrix and getting a black image - you almost certainly wrote the vectors as columns instead of rows, or forgot the offset on Invert. The vectors are the rows of the transform: r_vector is the output red row. Second, clamp_output is off by default, so negative values (from Invert without the offset, or aggressive rows) flow through as negative, and downstream 8-bit displays will do something ugly with them. If your result looks broken, flip clamp on and see if it behaves.

CategoryFXTD Studios/Radiance/Color

Inputs (9)

NameTypeDefaultDescription
imageIMAGE
presetCOMBOCustom5 options: Custom, Identity, Sepia, B&W (Luminance), Invert
matrix_typeCOMBORGB (3x3)2 options: RGB (3x3), RGBA (4x4)
r_vectorSTRING1.0, 0.0, 0.0
g_vectorSTRING0.0, 1.0, 0.0
b_vectorSTRING0.0, 0.0, 1.0
a_vectoroptSTRING0.0, 0.0, 0.0, 1.0
offsetoptSTRING0.0, 0.0, 0.0
clamp_outputoptBOOLEANfalseClamp to 0-1 range

Outputs (1)

NameTypeDescription
imageIMAGE