Home · Lab · Color Systems in 3D

CS1 The RGB cube: every pixel is a dot

Watch a grade move the whole cloud in 3D

Color Systems in 3D · ~7 min · Free

1 The idea

Every pixel has three numbers, r, g and b, so it can sit as a dot inside a cube. One corner is black (0,0,0), the opposite corner is white (1,1,1), and the diagonal joining them is the grey axis, where r = g = b.

So a whole picture becomes a point cloud. Gain stretches it away from the black corner, lift moves the dark end, and saturation pulls dots towards or away from the grey axis. Rotate it and see where our desert plate lives.

grade: lift + (gain − lift)·x, then x^(1/gamma) · saturation: L + s·(x − L)

2 Hands-on

Task: use lift and gain to fit the plate’s cloud across the whole cube without spilling out

The plate starts at only about 0.05 to 0.83, short of both corners: gain above 1 stretches the bright end up towards the top, and a small negative lift pulls the dark end down to the black corner. Watch the lowest and highest values and the number of dots outside

SkyVFX Lab · CS1interactive · 1001

3 Deep dive

How to read the cube

Position along the grey axis (the mean of R, G and B) is a rough brightness; Rec.709 luma is a different, weighted measure. Distance from the axis is saturation, and the direction a dot leans away from the axis is hue. A neutral-looking plate hugs the axis as a thin stick; a colourful image bulges out towards the walls.

Our desert plate is a thin stick almost all the way: only the sky leans a little towards blue and the sand a little towards orange. Rotating the cube shows which way it leans, which is hard to judge in a flat picture.

What you see in the cubeWhat it means in the picture
Thin stick along the grey axisNearly colourless image
Cloud leaning towards one wallA colour cast
Dots flattened against a wallA channel clipped at 0 or 1
Short cloud that reaches neither cornerLow contrast: lifted blacks, dull whites

What each knob does to the cloud

Gain multiplies every channel, so the cloud stretches away from the black corner along its own direction. Lift moves the dark end while 1 stays put (Nuke’s Grade pivots on 1). Gamma bends the middle without moving 0 or 1. Saturation pulls each dot towards, or pushes it away from, the point on the grey axis with the same Rec.709 luma, so luma stays the same.

  1. 1gain: stretch from black
  2. 2lift: move the dark end
  3. 3gamma: bend the middle
  4. 4saturation: to/from the axis

A negative lift that drives blacks below 0 is dots leaving through the bottom of the cube (in Nuke the Grade’s black clamp is on by default, so they clip to 0 instead; this figure leaves the clamp off so you can see them)

Why this figure uses sRGB axes

The Grade works in linear, like Nuke. But drawn with linear axes most of the plate would pile into the black corner and be hard to read, so this figure plots display (sRGB) values. The next lesson (CS2) flips between the two so you can see the difference.

“Filling the cube” isn’t automatically good

This task fits the plate to 0–1 as practice. In real comp we don’t force every shot to the full range. The job is to make the CG sit with the plate: if the plate’s blacks are lifted and soft on purpose, the CG’s must be too.

The CG’s cloud should overlap the cloud of the plate next to it

4 In real work

In Nuke

  1. PositionToPoints reads each pixel’s rgb as an xyz position, so an image becomes a point cloud in the 3D Viewer.
  2. CMSTestPattern makes an image that is a grid of cube colours; run it through a grade and view it with PositionToPoints to see how the grade bends the cube.
  3. Grade: blackpoint/whitepoint, lift, gain, multiply, offset and gamma (the figure uses only lift, gain and gamma).
  4. Saturation: Rec.709 luma by default; 0 collapses every pixel onto the grey axis.
  5. To plot display values, add a Colorspace (linear → sRGB) on a viewing branch only, never back into the comp.

Common mistakes → the fix

  • ✗ Pulling blacks with a negative lift until dark pixels go negative✓ Watch for dots leaving under the cube; use blackpoint, or stop before values go negative. In Nuke the Grade’s black clamp is on by default, so those values clip to 0 and show up as dots flattened on the wall instead, unless you turn it off. This figure leaves the clamp off so you can see them escape.
  • ✗ Using high saturation to “add life” to the whole frame✓ Strong saturation pushes dots into the walls and below zero. Go a little at a time and check the lowest channel.
  • ✗ Judging a grade from the picture alone✓ Check the numbers or the cloud as well; they show clipping and casts the eye misses.

Before you send the shot

  • No negative pixels created by the grade
  • The CG’s cloud overlaps the plate’s in the same area
  • No dots flattened against a wall unless intended
  • The grade happens in linear; display conversions live only on viewing branches

5 Check yourself

One question to check yourself

Set saturation to 0. What happens to the cloud?

What you learned

🔒 Answer the question above and this card opens

More questions

1. The whole cloud leans towards the blue corner. What does that mean?

2. Raising gain from 1 to 2: what happens to the cloud in linear?

Where the numbers come from: Colour maths comes from src/figures/colormath.ts (sRGB IEC 61966-2-1, ARRI LogC3 EI 800, sRGB/P3/Rec.2020/ACES AP1 primaries and Bradford, checked against reference numbers). Grade (lift, gain, gamma) and Saturation (Rec.709 luma) use the same maths as our engine, which is checked against Nuke 17.0v2. The cube’s axes are display (sRGB) values. The dots are every 3rd pixel across and down (25,680 dots), and the goal is measured on them (the plate starts at 0.05 to 0.83 with nothing outside; lift −0.005, gain 1.51 gives 0.01 to 1.00 with nothing outside).