Semen Klenov

Home / Journal / 3D & CGI

Compositing Theory: a practical CGI guide

The over operation: result = foreground + background × (1 − foreground alpha) for premultiplied images.

CGIBy Semen Klenov26 November 2026

A foreground with alpha composited over a background: color, alpha, and the result of the Over operation

Compositing is where passes become a picture. Done well, it saves re-renders, fixes problems and adds the final polish; done badly, it produces dark edges, color shifts and flicker that no one can explain. A few ideas — alpha, premultiplication, linear light and the Over operation — explain nearly everything.

Key points

  • The over operation: result = foreground + background × (1 − foreground alpha) for premultiplied images.
  • Renders are premultiplied; mixing straight and premultiplied alpha creates dark or bright edges.
  • Composite in linear light.
  • The beauty can be rebuilt from passes, and each pass can be adjusted.

Layers, Alpha and Over

  • Alpha channel: A fourth channel (A) that stores coverage: 1 = fully opaque, 0 = fully transparent, in between = soft edges, glass or motion blur.
  • Over: The basic operation that puts a foreground on a background: result = foreground + background × (1 − foreground alpha) when the foreground is premultiplied.
  • Merge operations:
    • Over: Layer in front.
    • Plus / Add: Add light values (the right way to combine light passes, emission, glows).
    • Multiply: Darken; shadows, ambient occlusion.
    • Screen: Soft addition for glows and flares.
    • Minus / Difference: Subtract; checking changes between versions.
    • Mask / Stencil: Cut one layer with another’s alpha.
  • Matte: An alpha-only image used to select or cut.
  • Holdout: An object that shows nothing but cuts a hole in what is behind it.

Premultiplied and Straight Alpha

  • Premultiplied: Color values are already multiplied by alpha; an edge pixel at 50 % alpha has half the color. This is how renderers write images.
  • Straight (unpremultiplied): Color values are stored independently of alpha.
  • Why it matters: Color corrections applied to a premultiplied image also change the edge in the wrong way, causing a dark or bright rim.
  • Rule: Unpremultiply → color correct → premultiply. Many compositors do it for you when you use the right node or a checkbox; know which.
  • Mismatch symptoms: A dark halo around objects on a bright background; light halo on a dark one.
  • Check: View the alpha and zoom into edges at 400 %.

Linear Compositing

  • Work in linear float: light adds linearly; blur, glow and motion blur only look correct in linear values.
  • View with the display transform only for viewing; do not bake it into the working image.
  • Operations that need linear light: Merge/Plus of light, defocus, glow, motion blur, exposure changes.
  • Operations done in a display or log space: Some grading tools (curves, contrast pivots) work better in log; use the tool’s stated working space.
  • Consistency: Check that every Read node interprets its file in the right color space (EXR linear, PNG/JPG sRGB).

Rebuilding from Passes

  • Reconstruct: Add the light component passes (diffuse + glossy + transmission + emission + volume) and compare to the beauty. A difference image should be black.
  • Adjust by component: Brighten reflections, tint the diffuse, reduce glow, without touching the other layers.
  • Light groups: Change the intensity or color of each light after rendering.
  • Cryptomatte / ID mattes: Select an object or a material for an isolated correction.
  • Data passes:
    • Depth: Add fog, depth-of-field blur or atmospheric perspective.
    • Normals and position: Relight with a fake light or add rim light.
    • Motion vectors: Apply motion blur in post (cheaper than rendering it).
  • Keep a “gold” version: The beauty-only version; compare your composite against it to detect errors.

Finishing Effects in Comp

  • Glow and bloom: Blur the brightest parts and add them back (Plus).
  • Depth of field: Defocus based on depth with the right blur shape (bokeh).
  • Lens effects: Chromatic aberration, vignette, flare, subtle distortion.
  • Grain and noise: Add after all other steps and match to real footage when integrating.
  • Sharpening: A small amount at the end; avoid halos.
  • Atmosphere: Haze, dust and light rays add depth.
  • Clean-up: Remove fireflies, wires, rig, stickers; patch by cloning or paint.
  • Rule: Every effect must serve the story. If an effect is the first thing you notice, it is too strong.

In the tools

  • Nuke: Node-based, the industry standard: Read, Merge, Shuffle, Grade, ColorCorrect, Premult/Unpremult, Defocus, ZDefocus, VectorBlur, Cryptomatte, Roto.
  • DaVinci Resolve Fusion: Free, node-based; excellent for motion graphics and CG compositing.
  • After Effects: Layer-based, widely used for motion design; use Linear Light blending and 32-bit float mode (and the right color management) for CG work.
  • Blender Compositor: Free; enough for simple pass rebuilds and glow.

Common mistakes

  • Color correcting a premultiplied image with no unpremult step.
  • Compositing in 8-bit or display space.
  • Using Over to combine light passes (should be Plus).
  • Adding grain before glow or blur.
  • Too many effects with no reference for the real look.