Digital compositing

related topics
{system, computer, user}
{math, number, function}
{@card@, make, design}
{film, series, show}

Digital compositing is the process of digitally assembling multiple images to make a final image, typically for print, motion pictures or screen display. It is the evolution into the digital realm of optical film compositing.

Contents

Mathematics

The basic operation used is known as 'alpha blending', where an opacity value, 'α' is used to control the proportions of two input pixel values that end up a single output pixel.

Consider three pixels;

  • a foreground pixel, f
  • a background pixel, b
  • a composited pixel, c

and

  • α, the opacity value of the foreground pixel. (α=1 for opaque foreground, α=0 for a completely transparent foreground). A monochrome raster image where the pixel values are to be interpreted as alpha values is known as a matte.

Then, considering all three colour channels, and assuming that the colour channels are expressed in a γ=1 colour space (that is to say, the measured values are proportional to light intensity), we have:

Note that if the operations are performed in a colour space where γ is not equal to 1 then the operation will lead to non-linear effects which can potentially be seen as aliasing artifacts (or 'jaggies') along sharp edges in the matte. More generally, nonlinear compositing can have effects such as "halos" around composited objects, because the influence of the alpha channel is non-linear. It is possible for a compositing artist to compensate for the effects of compositing in non-linear space.

Performing alpha blending is an expensive operation if performed on an entire image or 3D scene. If this operation has to be done in real time video games there is an easy trick to boost performance.

By simply rewriting the mathematical expression one can save 50% of the multiplications required.

Algebraic properties

When many partially transparent layers need to be composited together, it is worthwhile to consider the algebraic properties of compositing operators used. Specifically, the associativity and commutativity determine when repeated calculation can or cannot be avoided.

Consider the case when we have four layers to blend to produce the final image: F=A*(B*(C*D)) where A, B, C, D are partially transparent image layers and "*" denotes a compositing operator (with the left layer on top of the right layer). If only layer C changes, we should find a way to avoid re-blending all of the layers when computing F. Without any special considerations, four full-image blends would need to occur. For compositing operators that are commutative, such as additive blending, it is safe to re-order the blending operations. In this case, we might compute T=A*(B*D) only once and simply blend T*C to produce F, a single operation. Unfortunately, most operators are not commutative. However, many are associative, suggesting it is safe to re-group operations without changing their order. In this case we may compute S=A*B once and save this result. To form F with an associative operator, we need only do two additional compositing operations to integrate the new layer C: F=S*(C*D). Note that this expression indicates compositing C with all of the layers below it in one step and then blending all of the layers on top of it with the previous result to produce the final image in the second step.

Full article ▸

related documents
Extended Binary Coded Decimal Interchange Code
International Mobile Subscriber Identity
Z-machine
Line code
Alpha compositing
Multicast address
Turbo Pascal
Konqueror
Executable and Linkable Format
Interleaf
Μ-law algorithm
Single UNIX Specification
Control unit
Berkeley DB
Instructions per second
Arcadia 2001
MIRC
NeWS
Automatic callback
Williams tube
Motorola 56000
Multiple document interface
IBM 650
Microsoft Groove
Hitachi 6309
Connection Machine
Bit stuffing
Computing platform
Basic rate interface
IBM 7030 Stretch