Unpremultiplying an image – Apple Shake 4 User Manual

Page 426

Advertising
background image

426

Chapter 15

Image Processing Basics

The result is exactly the same as the Over node.

By punching a hole in the background, the alpha determines what is transparent when
the two plates are added together. The key concept is that because you are adding,
anything that is black (a value of 0) does not appear in the composite.

The KeyMix and Over nodes do this math for you, saving you from having to create four
nodes to do a simple composite. The difference between Over and KeyMix is that Over
assumes that the foreground is premultiplied (identical to IMult1). KeyMix is only for
non-premultiplied images (identical to munch_unpremult). Strictly speaking, the math
breaks down like this:

KeyMix

= (Fg * A) + ((1-A)*Bg)

Over

= Fg + ((1-FgA)*Bg)

In these formulas, the foreground of Over is already multiplied by the foreground alpha
channel, thus the term premultiplied—it isn’t multiplied in the composite because it
was previously multiplied, usually by the 3D renderer.

Unpremultiplying an Image

With this knowledge, you can go back and start to understand the errors that occur
when the ContrastLum and Add functions are used with the Over node.

An Add node was originally attached to the premultiplied Munch.

IMult1

IMult2

Advertising