About Color Correction Nodes

Shake's color is typically described in an RGB range between 0 and 1. The Color nodes are generally either mathematical corrections to color (i.e., Add .5 to the red channel), or rearrange the channels in different ways (switch the image from an RGB to an HSV color model with ColorSpace, or simply place the red channel into the alpha channel with Reorder, etc).

Many of the color-correction nodes can have identical results. For example, Mult and Brightness are the same command, except Brightness affects all three RGB channels the same, and Mult allows you to adjust each individual channel. Additionally, other functions like Lookup and ColorX can also duplicate most of the other color nodes. While ColorX is the most powerful node in the Color tab, it is also the slowest, as it acts on each individual pixel.


Basic Color Correction Tools

Shake's color correctors are split up into atomic nodes which can be re-arranged in macros to fit your working style. The basic nodes are as follows:

Function Example Image Notes
Ramp (unmodified)
 
Add
Add values of .5 on RGB: black values disappear, highlights gets washed away.
ContrastLum
Contrast of 2: higher contrast, the range is compressed. You can also move the contrast center to adjust the overall brightness of the image.
ContrastRGB
As ContrastLum, but you have individual RGB channel control.
Gamma
Gamma of .5 on RGB: Low areas are darkened, highlights are relatively untouched, pure white remains pure white.
Mult
Mult values of .5: Entire image is darkened, dark areas are less affected than highlights.
Lookup

Arbitrary curves are a applied to RGB channels. To see curves, click on "load curves" button in Parameter Window. Then look at the curve in the Curve Editor.




Premultiplied elements and correcting CG elements

One problem you may have seen is on your edges when you color correct an image coming from a 3D render. For example, here we have color corrected the blimps and composited them over the sky. You can see some white edges along the bottom edge of the blimp. This is bad.

Bad Edges Tree

This is happening because we are color correcting a premultiplied element. Pre-multiplied means that the RGB channels are multiplied by the alpha mask. Elements must be pre-multiplied when you do a standard Over operation, Shake's primary compositing node. However, if you color-correct a premultiplied element, you will get problems along your anti-aliased edges, as the above example shows.

The solution is to unpremultipy the image, which means you divide the RGB by the mask. This is done with the Color - MDiv ("Mask Divide") node. Place this before any color corrections you have done. You then must premultiply the image when it goes into the Over node. You can either insert a Color - MMult before the Over, or turn on preMultiply in the Over node. Note this only applies to the foreground element.

Good Edges Tree

The use of MDiv/MMult will also help you when you are raising your blacks with functions like Color - Add or Compress.

 

About Color Correction Concatenation and Float Calculations

A unique aspect of Shake's color handling is that it concatenates color corrections. This means if you have 10 Color operations in a row, it will internally compile them into one big Lookup table, and execute it. You don't have to spend the time processing the ten nodes, just one. An important second benefit is that if you multiply a channel by five (i.e., Brightness = 5) and then divide by 5 (i.e., Brightness = .2), they will cancel each other out, leaving no change. Without this functionality, you would be loosing four-fifths of the color information on that image.

Another important aspect of this correction is that they are evaluated in what we call float. Normally, color is determined by a range of 0 to 1. However, when calculated in float, these numbers can drop below 0 or go beyond 1. Visually, the range is still 0 to 1, but you may have multiple mathematical operations which will make use of these float values. When the color calculations are finished, the numbers are maintained if the image is a 32-bit float image, but are clipped at 0 and 1 if the image is in 8- or 16-bits.

Here is an example of how this affects your workflow.

Tree Ramp1
Add1 Mult1

 

I take a black-and-white Ramp, and Add -1 to the green channel and 1 to the blue. This leaves us with blue on the left edge, as its new value moves from 0,0,0 to 0,-1,1, which is visually interpreted as 0,0,1. The right edge is magenta, as it moves from 1,1,1 to 1,0,2, which is visually interpreted as 1,0,1. I then append a Mult command, and multiply the green channel by -1, and the blue by .5. Because Shake knows that the left edge has a value of 0,-1,1, this results in 1,1,.5. The right edge, which has a value of 1,0,2, results in 1,0,1. If they didn't work internally in float space, you would have a value of 1,0,.5, loosing half of your blue channel's information. That would be what we call "bad".

This behavior occurs at all bit depths. If you want to turn off this float behavior, simply insert a Clamp operator to clamp the values at 0 and 1. You will only get this behavior with other operations (IMult and IAdd, for example) if you are working at 4 bytes (float) per channel.

The following functions concatenate together:

Add,
Brightness,
Clamp,
Compress,
ContrastRGB (but not ContrastLum),
DelogC,
Expand,
Fade,
Gamma,
Invert,
LogC,
Lookup,
Mult,
Set,
Solarize

Furthermore, AdjustHSV and LookupHSV concatenate only with each other.

Another benefit of this concatenation is when you are dealing with logarithmic elements, as you would expect to get from a Cineon file. Because you get inaccurate results when you Mult to a log image, you should convert the color to a linear space, do the Mult, and then reconvert back to log space. Because of Shake's concatenation, and because log/delog conversions are merely color-corrections, these 3 operations are concatenated into one pass. The user can additionally encapsulate these 3 functions into a macro to hide the log/delog parameters, allowing the user to concentrate simply on the Mult values.

The concatenation occurs only on adjacent nodes. If you attach a different class of node in between two Gamma nodes, it will break the concatenation, ensuring the accuracy of the in-between node.


Color Corrections with the Infinite Workspace

Because Shake will effect the image outside of the frame due to the Infinite Workspace, you may have surprising results when color correcting and then applying a transformation or layering it on a larger background. As an example, we take a 200x200 pixel ColorWheel, and then Add 1 to the blue channel. This is then placed Over a 400x400 pixel black background. Because the Add added color to the area outside of the original 200x200 pixel frame, we see blue across the entire frame in the 400x400 pixel Over. Sometimes this is what you want, sometime it isn't. To turn off this behavior, insert a Crop before doing the Over. This keeps the color correction to within the small frame.

 

Although all color nodes will effect the image outside of the frame, many nodes will not have any effect, since they are working with pixels with a value of 0. For example, Gamma won't effect a 0-value pixel. The commonly-used nodes you particularly have to watch out for are Add, Invert, and Set.


Using PlotScanline to understand color-correction functions

Author's Note: This part is messy because Brinkmann wrote it.

In order to better understand some of the color-correction functions that are in Shake, a useful operator called PlotScanline has been included. It is designed to look at a single horizontal scan-line of an image and plot the the brightness of pixel for each X location. The most basic example of this is shown below. We start with a source image that is a simple horizontal gradient, varying linearly from 0 to 1.

(This gradient is 256 pixels wide, to give us a one-to-one correspondence between the range of possible values in an eight-bit image.)

Applying the PlotScanline operator to this image gives the following result:

As you can see, the curve indicates the fact that this is a linear ramp. Now insert a color-correction operator, such as Contrast into the chain, after the gradient and before the PlotScanline

This will modify the gradient, and the plot will reflect this.

As you can see, the image is effectively a plot of the Contrast function. If you adjust the values of your contrast, you will see the plot update to reflect any changes. PlotScanline is capable of graphing the different channels of an image separately as well, so that if your color-correction operator treats each channel with a different function...

...the graph will reflect this.