Home · Lab · Comp Foundations

F2 A double premult in a real graph

One node makes the dark edge: find it and switch it off

Comp Foundations · ~6 min · Free

1 The idea

Merge over assumes A is already premultiplied. The robot from Blender already is, but someone added another Premult in this graph, so the edge colour is multiplied by alpha twice and the edge goes darker than it should.

Push the Viewer gain up or look at the arm edges, and compare the probe values node by node.

over: A + B·(1 − a)

2 Hands-on in the mini compositor

Task: make the result match the target (clean edges) without deleting any node

Switch a node off with "Disable" in Properties, like D in Nuke

SkyVFX mini compositor · F2640×360 · float · 1001

3 Deep dive

The three states of an element

Take one edge pixel: true colour 0.8, alpha 0.5, over a plate at 0.2. The result depends entirely on the state of A.

StateA at the edgeOver a 0.2 plateLooks like
Not premultiplied0.80.9Glowing rim
Premultiplied once0.40.5Clean edge
Premultiplied twice0.20.3Dark rim

Double premult leaves C·α² at the edge while the hole stays the same size, so the edge goes dark

Who premultiplies, and when

Most CG from a 3D app arrives premultiplied. A key or roto gives you an unpremultiplied plate plus an alpha, so you add one Premult after the colour work.

The short rule: each branch is premultiplied once. If the image already arrived premultiplied, every Premult must follow an Unpremult, as a pair.

  1. 1Read CG (premult)
  2. 2Unpremult
  3. 3Grade
  4. 4Premult
  5. 5Merge over

Hunting down the bad node

Pick one edge pixel and step the Viewer down node by node. At a healthy edge, rgb ÷ alpha stays close to the robot’s inner colour. Where that number suddenly drops, that node is the extra premult.

Quick test: select the suspect node, press D to disable it and look at the edge again.

Over white, a dark rim shows; over black, a glowing rim shows

Nodes that keep premult intact

Premult never changes alpha; it only multiplies rgb. Unpremult divides rgb by alpha and leaves alpha-0 pixels as they are.

Merge mask (B·a) keeps B only inside A’s alpha; stencil (B·(1−a)) cuts A’s shape out of B (more in lesson 01). Both scale rgb and alpha together, so the image stays correctly premultiplied. Blur, Transform and Defocus should run on the premultiplied rgba, all four channels together.

4 In real work

In Nuke

  1. Unpremult → Grade/ColorCorrect → Premult, a pair around the colour work
  2. Or set (un)premult by: rgba.alpha in the Grade to do that pair inside it
  3. Blur / Transform run on the premultiplied image: keep Blur’s channels on rgba (Transform moves all channels anyway)
  4. Merge over: element into A, plate into B
  5. Debug: select a node, press D and compare the Viewer

Common mistakes → the fix

  • ✗ Adding a Premult after a CG Read “just in case”✓ Check first. If it is already premultiplied, the extra Premult gives a dark rim.
  • ✗ Unpremult → Grade, then forgetting the Premult✓ Edge pixels keep their full colour and glow over the plate (and any lift outside the alpha is added too). Always close the pair with a Premult.
  • ✗ In a key branch, premultiplying first and grading lift afterwards✓ Move every Grade and despill above the single Premult.
  • ✗ Blurring rgb only, not alpha✓ Colour and alpha no longer line up. Blur rgba together.

Before you send the shot

  • Each branch is premultiplied exactly once
  • Every Unpremult has a matching Premult
  • No dark or glowing rim over white and over black
  • Every filter works on rgba

5 Check yourself

One question to check yourself

How do most CG renders saved as EXR from a 3D app arrive?

What you learned

🔒 Answer the question above and this card opens

More questions

1. A key branch reads Keyer → Premult → Grade (lift) → Merge over. What is the fix?

2. Under the robot Read, a colleague adds an Unpremult followed straight away by a Premult, with nothing between. Does the robot image change?

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).