Home · Lab · Comp Foundations

F4 Grading a premultiplied image

One lift, and the whole frame lights up

Comp Foundations · ~7 min · Free

1 The idea

Lift raises every dark pixel, including the alpha-0 pixels around the robot. Merge over then adds A straight on, so the whole plate gets brighter, not just the robot.

Pure multiplies (gain, multiply) are safe on a premultiplied image, but lift, gamma and offset need unpremult → grade → premult. Nuke’s Grade has an "(un)premult by" option that does it inside the node.

Grade (Nuke): y = A·x + (add + lift − A·blackpoint), A = multiply·(gain − lift)/(whitepoint − blackpoint)

2 Hands-on in the mini compositor

Task: make the lift affect only the robot, not the whole frame

Watch the sky: it should not get brighter at all

SkyVFX mini compositor · F4640×360 · float · 1001

3 Deep dive

What Grade really does

Before gamma, the whole Grade is one straight line: y = A·x + B, where A = multiply·(gain − lift)/(whitepoint − blackpoint) and B = offset + lift − A·blackpoint.

Then gamma is applied, and the black clamp, on by default, turns negatives into 0 (the white clamp is off).

  1. 1blackpoint / whitepoint
  2. 2lift / gain
  3. 3multiply
  4. 4offset
  5. 5gamma
  6. 6black clamp

Numbers worth remembering

Lift is not scaled by multiply: multiply 2 with lift 0.1 turns 0 into 0.1, not 0.2. Gamma bends only between 0 and 1; above 1 it is a straight line with slope 1/gamma.

SettingInOutNote
lift 0.100.1Black rises
lift 0.14.54.15Highlight pulled down
gamma 20.40.6325Curve below 1
gamma 22.51.75Straight line above 1

Why multiply is safe and lift is not

An edge pixel with true colour 0.25 and alpha 0.5 is stored as 0.125 in a premultiplied image. Graded straight on the premultiplied value, it differs from unpremult → grade → premult whenever the op is not a pure multiply.

A multiply commutes: k·(C·a) = (k·C)·a. Gamma, lift and offset do not. Lift also adds to the alpha-0 pixels around the robot, and over then adds that across the frame.

AdjustmentStraight on premultUnpremult → grade → premult
Gain 2 (edge)0.250.25
Gamma 2 (edge)0.354, too bright0.25
Lift 0.06 (outside, alpha 0)0.06, spreads over the frame0

The (un)premult by knob in Grade

Set (un)premult by to rgba.alpha and the Grade does unpremult → grade → premult inside itself. Handy for a single grade; for several colour nodes in a row, one Unpremult and one Premult around the group reads more clearly.

Watch out: pixels with alpha 0 come out 0 in every channel, so a light element with alpha 0 everywhere disappears. Light elements do not need this knob at all.

Nudge the lift and watch the sky away from the robot: if it moves, you are not unpremultiplied yet

4 In real work

In Nuke

  1. Gain / multiply only: a Grade straight on the premultiplied image is fine
  2. Lift, gamma or offset: set (un)premult by = rgba.alpha
  3. Several colour nodes: Unpremult → Grade → ColorCorrect → Premult
  4. Light elements with alpha 0: grade without (un)premult
  5. View the Merge and probe the sky before and after moving the lift

Common mistakes → the fix

  • ✗ Lift on the premultiplied robot, and the whole frame brightens✓ Turn on (un)premult by, or wrap it in Unpremult/Premult.
  • ✗ Expecting multiply to scale the lift too✓ Lift sits in B and is not multiplied; black stays at the lift value. Adjust them separately.
  • ✗ Using gamma to bend highlights above 1 the way it bends the darks✓ Above 1 gamma is a straight line. To tame highlights use a multiply or a SoftClip.
  • ✗ Turning on (un)premult by on an alpha-0 light element✓ The light becomes 0 everywhere. Leave it off for light.

Before you send the shot

  • Every Grade with lift/gamma/offset on a premultiplied image is unpremultiplied
  • The sky outside the robot does not change when you move the robot’s grade
  • The robot’s edge is no brighter or darker than its body
  • Light elements do not use (un)premult by

5 Check yourself

One question to check yourself

Which one is safe on a premultiplied image without unpremult?

What you learned

🔒 Answer the question above and this card opens

More questions

1. A Grade has multiply 2 and lift 0.1. What does an input of 0 become?

2. Gamma 2 on the premultiplied robot without unpremult. What happens at the edge?

Where the numbers come from: Merge, Grade, Premult and Unpremult here match Nuke 17.0v2 in all 109 test cases (numbers sampled from real Nuke). Blur and Transform are simplified: close, not identical to Nuke. All images are Blender renders of our own scene: a code-built layout with hills made as Gaea 2.3 terrains (Community edition, built headless), a Poly Haven CC0 HDRI sky, Poly Haven (CC0) rocks and dry grass, Quixel sand and cliff textures, and a robot on a Mixamo rig (Quixel and Mixamo are used in the renders only; no source files ship).