Knowledge / Animation / VFX / Game Design / VFX: compositing, rotoscoping and matchmoving

VFX: compositing, rotoscoping and matchmoving

Animation / VFX / Game Design (B.Sc / B.Des) · VFX and games · free study notes for exams, placements and interviews

In short

Compositing is the craft of combining separately created images - live-action plates, CG renders, matte paintings, particles - into one seamless frame that looks as though a single camera shot it. Rotoscoping (hand-drawn, animated mattes) and matchmoving (recovering the real camera's motion and lens so CG sits in the plate) are the two support disciplines that make compositing possible when a key or an automatic solve will not do. These three skills are the entry gate to the Indian VFX industry - roto/paint and prep are the standard first jobs at DNEG India, MPC, Technicolor, Framestore Mumbai, Red Chillies VFX, Prime Focus, NY VFXWaala, Phantom FX and Makuta, and university B.Sc/B.Des papers on "Visual Effects" and "Digital Compositing" examine keying theory, alpha maths, matte generation and camera solving. Practically every Indian feature, OTT series and ad today passes through a compositing script, so a graduate is judged on edge quality, colour maths and shot-to-shot consistency more than on software menus.

Explained

1. The compositing model: alpha, over and premultiplication

2. Keying, despill and prep

3. Rotoscoping

4. Matchmoving, camera tracking and 3D solving

5. Colour management, formats and the linear workflow

6. Pipeline, roles and the Indian production context

Key points

Formulas and examples

Over (premultiplied): C_out = C_fg + (1 − α_fg) · C_bg ; α_out = α_fg + (1 − α_fg) · α_bg
C = colour channel value (0-1 for display range, >1 allowed in float), α = alpha (0-1), dimensionless.
Over (straight/unpremultiplied Fg): C_out = α_fg·C_fg + (1 − α_fg)·C_bg
Premultiply / Unpremultiply: C_premult = C_straight × α ; C_straight = C_premult ⁄ α (α > 0)
Add: C_out = C_fg + C_bg Multiply: C_out = C_fg × C_bg Screen: C_out = 1 − (1 − C_fg)(1 − C_bg)
In: C_out = C_fg·α_bg Out: C_out = C_fg·(1 − α_bg) Mix/dissolve: C_out = m·C_fg + (1 − m)·C_bg, m = mix 0-1
Colour-difference key (green screen): α = 1 − k · [ G − max(R, B) ] , clamped to 0-1
k = gain/tolerance constant set by the artist (dimensionless).
Pinhole projection: x = f · X ⁄ Z , y = f · Y ⁄ Z
X, Y, Z = 3D point in camera space (mm or m), f = focal length (mm), x, y = image-plane position (mm); divide by pixel pitch for pixels.
Horizontal field of view: FOV_h = 2 · arctan( w ⁄ (2f) )
w = filmback/sensor width (mm), f = focal length (mm), FOV in degrees.
Reprojection (solve) error: E_rms = √[ (1/N) · Σ ( (u_i − û_i)² + (v_i − v̂_i)² ) ]
u, v = tracked feature position (pixels), û, v̂ = reprojected position of the solved 3D point, N = number of observations; E in pixels.
Planar homography (corner pin): x′ = (h₁x + h₂y + h₃)/(h₇x + h₈y + 1) ; y′ = (h₄x + h₅y + h₆)/(h₇x + h₈y + 1)
8 unknowns h₁…h₈ - which is why four tracked corners (8 equations) define it.
Gamma/encode: C_linear = C_encodedγ (γ ≈ 2.2 for a simple sRGB approximation)
Motion blur from shutter: blur length (px) = object image-plane speed (px/frame) × shutter angle ⁄ 360
Shutter angle in degrees (180° is the film standard, giving half a frame of blur).

Example 1 - over with premultiplied values. A foreground pixel has α = 0.4 and premultiplied RGB = (0.20, 0.12, 0.08) over a background (0.50, 0.60, 0.70), α_bg = 1.

Example 2 - why you must unpremultiply before a grade. Same pixel, α = 0.4, premultiplied RGB (0.20, 0.12, 0.08). The object's true colour is (0.20/0.4, 0.12/0.4, 0.08/0.4) = (0.50, 0.30, 0.20). Apply a 1.5× gain:

Example 3 - green-screen key by hand. Plate pixels, with k = 2.0:

PixelRGBG − max(R,B)α = 1 − 2(G − max)Reads as
Clean screen0.100.600.120.481 − 0.96 = 0.04transparent
Skin0.550.400.32−0.15 → clamp 01.00opaque
Hair edge0.180.330.200.131 − 0.26 = 0.74soft edge
Green shirt0.200.550.220.331 − 0.66 = 0.34wrongly keyed - needs a garbage/holdout matte

The green shirt shows why wardrobe colour matters and why a holdout matte is drawn by hand over it.

Example 4 - field of view and a matchmove sanity check. An ARRI ALEXA Mini with a 4:3 sensor region, filmback width 28.25 mm, 32 mm prime lens, plate 2,880 px wide.

Example 5 - roto budget and reprojection error. A 120-frame shot of a walking actor needs roto of the torso, both arms (2 shapes each) and head = 6 shapes. The artist keys shapes on every 4th frame.

# Typical Nuke script shape for a green-screen shot (read as a graph, top to bottom)
Read plate.exr (log) -> Colorspace/IDT to scene-linear
  -> Denoise -> Keylight/IBK ------------------\
  -> Despill ---------------------------------- Merge(over) <- Read bg_cg.exr (premultiplied)
  -> RotoPaint (garbage + holdout mattes) ----/
Merge -> Grade (match blacks/whites) -> Defocus -> LightWrap
      -> ReGrain -> LensDistortion(re-apply) -> Write dpx/exr (ODT Rec.709 for review)

Where it is used

Interview questions

Common mistakes

Related topics

3D animation and rigging · Lighting, shading and rendering · Colour grading and digital intermediate · Game engines: Unity and Unreal · Virtual production and LED volumes · Motion graphics and title design

Open in the Knowledge reader →Find jobs →