Home · Lab · Case Files: real comp problems

CF7 Case 7: grain on top of grain

Regrain only what changed, but the mask was inverted

Case Files: real comp problems · ~6 min · Free

1 The idea

Symptom: the sand looks noisier than the raw plate, while the robot looks perfectly smooth, like plastic. Here the plate already has camera grain (the "Camera grain" node stands in for it) and the CG has none, so only the pixels replaced by CG should be regrained.

The Keymix applies grain through a mask, but someone inverted the mask. The new grain lands on the plate (two equal layers of grain are about 1.41× stronger) and none on the robot. Check r, g and b on the sand, comparing "Merge over" with "Keymix (regrain)".

two equal, independent grains: √2 ≈ 1.41× stronger

2 Hands-on in the mini compositor

Task: make the new grain land only on the robot (and its shadow), not again on the plate

SkyVFX mini compositor · CF7640×360 · float · 1001

3 Deep dive

Regrain only what changed

If the plate still carries its camera grain (no denoise), untouched plate pixels already have the right grain. Grain is needed only where new pixels replaced them: CG, painted areas, or areas blurred until their grain disappeared.

Another common approach: denoise the plate, comp everything clean, then regrain once over the whole frame at the end. Both approaches are right; just never mix them so the plate gets grain twice.

ApproachPlateRegrain
Keep original grainNot denoisedOnly new pixels, through a mask
Denoise firstDenoisedWhole frame, once, at the end

How much stronger stacked grain gets

Two independent noises combine as √(a² + b²), not a + b, so two equal grains are about 1.41× stronger. In this lesson the blue channel’s spread on the sand measures 0.027 (plate) vs 0.038 (after the misplaced regrain): about 1.38×, close to that 1.41×.

On a real job an element ended up with about 3× the plate’s grain: grain baked into the element plus another Grain on top. Measure the spread on flat areas, per channel; aim for comp ÷ plate at about 0.9–1.1.

The inverted mask

An inverted mask is one of the quietest mistakes: nothing breaks, the effect just lands in the wrong place. Every time you wire a mask, view the mask itself and ask "is white where I want the effect?", and check the invert box on the node receiving it.

Grain: last, once, per channel, and only where things changed

4 In real work

In Nuke

  1. Keymix: B = comp, A = the grained comp, mask = alpha of what changed (CG, paint)
  2. Check the mask invert box on Keymix and Merge every time
  3. DasGrain (a free community gizmo) does the same: it takes grain from the plate and adds it only where the comp differs from it
  4. Grain2: intensity differs per channel, blue usually strongest; beware maskgrain, on by default, which adds no grain where the input alpha is 0 (so graining an element before the merge leaves its empty area alone, and before graining a full frame, check that frame’s alpha). The Grain in this lab is a teaching version that grains every pixel, whatever the alpha

Common mistakes → the fix

  • ✗ Graining the whole frame while the plate still has grain✓ Regrain through a mask of what changed, or denoise the plate first.
  • ✗ Lowering the amount to fix heavy grain✓ If the cause is stacking, lowering the amount still leaves the CG too clean; fix the mask.
  • ✗ Blurring or defocusing after the grain✓ Grain always comes after blur and defocus.
  • ✗ Measuring grain on detailed or moving areas✓ Measure on flat, static areas, per channel.

Before you send the shot

  • The plate doesn’t carry two layers of grain
  • CG and painted areas match the plate’s grain, per channel
  • The regrain mask isn’t inverted
  • Grain is the last step, with no blur after it

5 Check yourself

One question to check yourself

The background grain got heavier while the CG is clean. What is the cause?

What you learned

🔒 Answer the question above and this card opens

More questions

1. Two equal, independent grains together are about how much stronger?

2. The plate isn’t denoised. How do you grain the CG?

Where the numbers come from: Keymix matches Nuke 17.0v2; Grain is a teaching version (per-channel noise added to every pixel, unlike Nuke’s Grain2, which by default adds none where alpha is 0). Two independent grains combine as √(a² + b²), so two equal ones are √2× stronger: standard noise maths.