About Compositing |
Shake's compositing nodes are in the Layer menu, with your primary nodes being Over, KeyMix, and LayerMacro. To show you how these work, assume we have the following elements:
Foreground (with mask) | Foreground Mask (part of Foreground) | Background |
![]() |
![]() |
![]() |
The Over node places a foreground with an alpha channel over a background. The foreground RGB channels must be pre-multiplied by the alpha channel.
Tree with Over node | Result |
![]() |
![]() |
If the image is not pre-multiplied, (see About Color Corrections) it can be done before the Over node with a Color - MMult, or inside the Over node itself with the preMultiply toggle.
The LayerMacro node has the identical expectations, but you can select other layering operations like multiplying, adding, Screen, etc. In addition, you can easily control foreground and background opacity, and select to work on specific channels. An important difference between the LayerMacro node and all of its normal counterparts (i.e, Over, IMult, Atop, etc) is that the Foreground elements is the second input, and the Background element is the first input. This allows you to use side input masks properly. See About Keying for more information on masking a node.
Tree with LayerMacro node | Result (identical to Over) |
Extra Layer parameters
|
![]() |
![]() |
![]() |
The last primary node, KeyMix, inputs a foreground and background, and mixes them through a third input image, the mask. You can select which channel of the third image works as the mask, as well as invert the mask or control its intensity.
Tree with KeyMix | Mask for KeyMix (result of DepthKey) | KeyMix result |
![]() |
![]() |
![]() |
As mentioned, a successful Over composite requires an alpha channel for the foreground, and the RGB channels are pre-multipled. 3D-rendered elements are almost always pre-multiplied. Scanned elements or other 2D-generated plates require an added alpha channel (also called the matte or mask channel), which is then used to pre-multiply that image with the MMult command. To get that alpha channel, you can pull a key with Shake's keying functions, or you can pull keys in a different package, read them in, and then copy those into a foreground image's alpha channel with either Copy or SwitchMatte. Apply the MMult, and then composite. In this example, the mask is drawn using the QuickShape node and copied in as the alpha channel for the bus with SwitchMatte. Because we haven't done any color corrections, so we use the preMultiply toggle in SwitchMatte to pre-multiply the foreground.
Tree with KeyMix | Bus (no alpha) | QuickShape |
![]() |
![]() |
![]() |
Background | Pre-multiplied result of SwitchMatte | Over result |
![]() |
![]() |
![]() |
In this example, I am color-correcting the bus, so I leave preMultiply off in the SwitchMatte, and turn it on in the Over. I could instead insert a Color - MMult node between Mult1 and Over2.
Color Correcting | Result |
![]() |
![]() |
In this example, I am explicitly placing the MDiv and MMult, because I am color correcting a 3D-rendered element. Again, I could omit the MMult, and turn on preMultiply in the Over node.
Color Correcting | Result |
![]() |
![]() |
For an example of color-correcting pre-multiplied elements, see the Blimp Tutorial.
You can view an image's alpha channel at any time simply by hitting A
in the Viewer window or the flipbook image, or by toggling the View Channel
button at the bottom of the Viewer from Color
to Alpha
.
Shake has a set of mathematical and Boolean layering operators as well. IAdd, IDiv, IMult, ISub, and ISubA add, divide, multiply, or subtract two images together. The second subtracting node, ISubA, returns the absolute value of the image. This means if you places a dark grey image in the first input (value .2, .2, .2) and then a white image (1,1,1), it will return a light grey image (.2 - 1 = -.8, which we take the absolute value of, returns .8, .8, .8). This is quick way of seeing if two images are different. The more flexible tool for generating difference mattes is the Layer - Common node, which can be used to isolate common or different elements between two images. The other mathematical operators are Min and Max, which return the the lower or higher values of two images respectively. The Boolean operators Inside, Outside and Xor are also useful for masking images. The first will place the foreground image only inside of the background alpha, the second places the foreground outside of the background alpha, and Xor only reveals areas that don't have a common alpha area.
Shake also contains some effect operators, namely ZCompose to do Z-based compositing, Screen, which is used to composite light elements and preserve highlights, and Atop, which is used to place something only on the foreground. This is used to do things like putting a smoke element on a CG character to match smoke in the background plate.
You can easily composite any resolution element over another image of any resolution. With the compMode toggle, you can choose foreground or background resolution as the output resolution. This applies to all layering commands. Comping an element over a different sized background is one way of setting your output resolution. For more information on setting resolution, jump to About Resolution.
As outlined in About Channels, you
can easily combine 1, 2, 3, 4, or 5-channel images together, for example compositing
a luminance image with an alpha channel (2 channels) over a 5-channel image
with an Over command.
If you were stuck on a desert island and had only one Layer node, it would have to be LayerX, since it can be used to mimic all of the other functions. We have included the math for most of the operators, both in general notation, and in LayerX syntax. The LayerX syntax only has the expression for the red channel. You can easily extrapolate the additional equations for the other channels (i.e., change r to g for the green channel).
A = foreground RGBA
B = background RGBA
Aa = foreground Alpha
Ba = background Alpha
Shake Layer Function | Commonly Used for | Math | LayerX syntax |
Atop | Add effects to foreground elements, like smoke over a CG character to match the bg. | A*Ba+(B*(1-Aa)) |
r2+(r*a*a2) |
Common | Difference masks | ||
IAdd | Fire effects, adding mattes together. | A+B | r+r2 |
IDiv | A/B | r2==0?1:r/r2 | |
IMult | Masking elements | A*B | r*r2 |
Inside | Masking elements | A*Ba | r*a2 |
ISub | A-B | r-r2 | |
ISubA | Finding the difference between elements | absolute(A-B) | fabs(r-r2) |
KeyMix | Mixing two images through a third mask. | A*(1-M*C)+ (B*M*C) | M stands for the percentage mix. |
Layer | Duplicates most other Layer operations, but has fg/bg opacity, masking and channel controls. | ||
Max | Combining Masks | If (A > B) then A, else B |
r>r2?r:r2 |
Min | If (A < B) then A, else B | r<r2?r:r2 or min(r,r2) |
|
Mix | Cross-fades | A*(1-Mix)+(B*Mix) | r*(1-mix)+r2*mix |
Outside | Masking elements | A*(1-Ba) | r*(1-a2) |
Over | Primary compositor. | A + (B*(1-Aa)) | r+(1-a)*r2 |
Screen | Adding reflections and light elements without losing highlight detail. | 1-(1-A)*(1-B) | 1-(1-r)*(1-r2) |
Under | A reverse of Over | B + (A*(1-Ba)) | r2+r*(1-a2) |
Xor | Finding areas that are mutually exclusive. | A*(1-Ba) + B*(1-Aa) | r*(1-a2) + r2*(1-a) |
ZCompose | Z-depth compositing. |
If(Aa == 1) then If (Az == Bz) then ((A + (B*(1-Aa))) + B + (A*(1-Ba)) ) / 2 else If(Az < Bz) then A else B else A + (B*(1-Aa))Or in other words, if foreground alpha doesn't equal 1, an Over is performed. Otherwise, if the Z values are not equal, the lower Z is taken. If the Z values are the same, the result is a 50% mix of an Over and an Under. |