ColorCorrect

Function
This function combines Add, Mult, Gamma, ContrastRGB, ColorReplace, Invert, Reorder, and Lookup all into one node, also giving you the ability to tune the image in only the shadow, midtone or highlight areas. It is primarily designed for the Tremor-style layout, but can also be used in Shake with a lot of tab-activity.

Note: At this time ColorCorrect will break concatenation with connecting color corrections.

 

The Sub-Tabs

The ColorCorrect node is organized into seven sub-tabs:

Sub-tab Notes
Master Applies the same correction to the entire image.
Low Controls Applies the correction primarily to the darkest portion of the image, with the correction falling off as the image gets brighter.
Mid Controls Applies the correction primarily to the middle range of the image.
High Controls Applies the correction primarily to the highlights of the image, with falloff as the image gets darker.
Curves Manual correction of the image using curves
Misc Secondary color correction, as well as invert, reorder and premultiplication control
Range Curves Display of the different image ranges (shadows, midtones, highlights), their control curves, and the final concatenated curve of the color correction.

In the Tremor-style layout, you can look at two tabs at once, with one tab being the Master, Low, Mid, High Controls or Curves, and the second tab being either Misc or Range Curves. In the classic Shake layout, you can only view a tab at a time. Time to upgrade that monitor and graphics card...

 

The Master, Low, Mid, High Controls Tabs

The first four tabs are identical except for the portion of the image you are modifying. Each has the same matrix inside of it to Add, multiply (Gain), and apply a Gamma to the RGB channels, as well as apply contrast on a per-channel basis (Contrast, Center, SoftClip):

When tuning the color with the matrix, you can choose several methods:

For example, hold down the R key and drag right over the Add line. This will add to the red channel. When it is bright red, hold down the H key and drag left and right, and you will shift the Hue of the color. Modifying using this manner only modifies the color that is Added, Multiplied, etc, meaning, by dragging a color with S (for saturation) down will not decrease the saturation on the image, only the saturation of the color that we are adding (or whatever) to the image.

At the bottom of the tab is a display toggle to switch the channels from R G B display to a different color space model. You can modify it to display RGB, HSV, HLS, CMY, and TMV. For example, the snapshot two images previously displays the numbers in the RGB color model. Hit the button at the bottom to HSV, and the numbers are converted to HSV space. Notice the Add color doesn't change at all, just the numerical value.

TMV stands for Temperature/Magenta-Cyan/Value, by the way.

When ColorCorrect is saved into a script, the values are always stored in RGB space.

Each color picker has an AutoKey and View Curves button associated with all three channels for that parameter. All three channels are treated equally.

 

Working with Low/Mid/High Ranges

Here is the difference when working with Low, Mid and High. This is the original image, courtesy of our friends at UCLA:

Original Image

 

In the following examples, I have applied a Gain (multiply) of 2 on each channel. The first example applies multiplies all pixels by two. The pure blacks stay black, the whites flare out. However, when I apply it to the Low areas (the shadows), although the pure blacks stay black, the areas just above 0 are raised into the mid range, reducing the apparent contrast. If I used a higher value, solarizing would occur.

Master Tab Gain of 2 Low Tab Gain of 2
Mid Tab Gain of 2 High Tab Gain of 2

You can control what range of the image is considered to be in the shadows, midtones and highlights by going to the Range Curves tab. This tab displays your final color lookup operator as a curve, your mask ranges (turn on the display by hitting the Ranges button at the bottom), and controls for the center of the low and high curves, as well as a display toggle to switch the output from the Normal, corrected image to a display of the Low areas boosted to 1 and all else black, the Mid areas boosted to 1 and all else black, or the High areas boosted to 1 and all else black. We used a colored display rather than one based on luminance since different channels will have different values.

Range Display toggle View L
View M View H

To control the mask areas, turn on the Ranges curve display at the bottom of the Range Curves tab. The left image below shows the default ranges. There is a curve of our final lookup, displayed in this illustration as a yellow line for clarity. Notice the Low and High range curves (grey curves sloping in from left and right) have their centers at .5. If you adjust the low or high values, you will modify that range and the mid range curve as well. For example, the second image shows what happens when low is put down to .1. Notice the Low and Mid curves shift left but the High curve remains unaffected.

Normal Ranges Low curve is set to .1

 

 

The Curves tab

This tab allows you to apply manual modifications to the lookup curve. Although this is generally used for manual adjustments, you can also apply functions in here using the standard Lookup expressions.

To insert a new knot, hit Shift+click on a segment.

Curves Tab Effect

 

The Misc tab

This tab has several functions in it:

 

Invert. This is done with the formula 1-x, so float values may have odd results.

reorderChannels. By entering a string, you can swap or remove your channels as per the standard Reorder method. For more information, see Commands - R - Reorder.

preMultiplied. Toggle this on if your image is premultiplied (typically, an image coming from a 3D render), and it will automatically insert a MDiv before the calculations and an MMult afterwards. See Overview - About Premultiplication for more information.

Color Replace. Use this for secondary color correction, as per the ColorReplace node. In this example, I have selected her skin tone and replaced it with red. I set my Sat Falloff to .3, Val Range to 0 and Val Falloff to .8

Vanilla Pudding Before Vanilla Pudding After

 

Order of Calculation

Calculations are made in this order:

MDiv (optional)
ColorReplace
Invert
Lookup Curves
Gamma
Mult
Add
Contrast
Reorder
MMult (optional)

 

Parameters

Not all parameters are exposed in the interface.

Parameters
Type
Defaults
Function
version
string
"v1.0" a placeholder for us to ensure compatibility in later versions. Does not affect the image.
r,g,b,aExpr
string
"x" lookup expressions as per the Lookup node.
r,g,b,aContrast
float
1 Global contrast values on a per-channel basis.
r,g,b,aCenter
float
.5 Global centers of the contrast curve. Shifting it down increases the brightness of the curve. Shifting it above .5 increases the darkness of the image. This only has effect if a contrast value other than 1 has been entered.
r,g,b,aSoftClip
float
0 Global roll-off value for the contrast curve
r,g,b,aGamma float 1 Global gamma values. 1 means no change.
r,g,b,aGain float 1 A Global multiplier on the color.
r,g,b,aAdd float 0 Global values added to the color channel.
r,g,b,alContrast float 1 Low contrast values
r,g,b,alCenter float .5 Low contrast center
r,g,b,alSoftClip float 0 Low softclip value
r,g,b,alGamma float 1 Low gamma values
r,g,b,alGain float 1 Low multiplier values
r,g,b,alAdd float 0 Low offset values
r,g,b,amContrast float 1 Medium contrast values
r,g,b,amCenter float .5 Medium contrast center
r,g,b,amSoftClip float 0 Medium softclip value
r,g,b,amGamma float 1 Medium gamma values
r,g,b,amGain float 1 Medium multiplier values
r,g,b,amAdd float 0 Medium offset values
r,g,b,ahContrast float 1 High contrast values
r,g,b,ahCenter float .5 High contrast center
r,g,b,ahSoftClip float 0 High softclip value
r,g,b,ahGamma float 1 High gamma values
r,g,b,ahGain float 1 High multiplier values
r,g,b,ahAdd float 0 High offset values
r,g,b,aInvert int 0 Inversion of the channels, i.e., 1-x
low,highWeight float .5 The center points of the two mask curves. Shifting lowWeight down from .5 will mean that less range is considered to be in the Low range. lowWeight adjustments will not affect the High area of the image.
tOrder string "GMAC" The Gamma/Mult/Add/Contrast calculation order.
affectAlpha int 0 ColorReplace's affectAlpha parameter. Not in the interface.
r,g,bSource float 0 The source color for replacement.
r,g,bReplace float r,g,bSource The color to replace r,g,bSource
low, rolllow float .1 The hue range and falloff for replacement.
high, rollhigh float .1 The saturation range and falloff for replacement.
lum, rolllum float 1 The luminance range and falloff for replacement.
channels string "rgba" The reorder channels.
preMult int 1 If the input image is premultiplied or not. 1 indicates that it is not premultiplied, 2 indicates that it is premultiplied.
viewRange int 0 The output of the node:
0 = Normal mode
1 = The image low-range is viewed, regardless of correction.
2 = The image mid range is viewed.
3 = The image high range is viewed.


Synopsis

image ColorCorrect(
   image in,
   const char* version = "v1.0",
   float rExpr="x",    
   float gExpr="x",     
   float bExpr="x",     
   float aExpr="x",
   float rContrast=1.0,
   float gContrast=1.0, 
   float bContrast=1.0, 
   float aContrast=1.0,
   float rCenter=0.5,   
   float gCenter=0.5,   
   float bCenter=0.5,   
   float aCenter=0.5,
   float rSoftClip=0.0,
   float gSoftClip=0.0, 
   float bSoftClip=0.0, 
   float aSoftClip=0.0,
   float rGamma=1.0,   
   float gGamma=1.0,    
   float bGamma=1.0,    
   float aGamma=1.0,
   float rGain=1.0,    
   float gGain=1.0,     
   float bGain=1.0,     
   float aGain=1.0,
   float rAdd=0.0,     
   float gAdd=0.0,      
   float bAdd=0.0,      
   float aAdd=0.0,
   float rlContrast=1.0,
   float glContrast=1.0,
   float blContrast=1.0,
   float alContrast=1.0,
   float rlCenter=0.5, 
   float glCenter=0.5,  
   float blCenter=0.5,  
   float alCenter=0.5,
   float rlSoftClip=0.0,
   float glSoftClip=0.0,
   float blSoftClip=0.0,
   float alSoftClip=0.0,
   float rlGamma=1.0,   
   float glGamma=1.0,   
   float blGamma=1.0,   
   float alGamma=1.0,
   float rlGain=1.0,    
   float glGain=1.0,    
   float blGain=1.0,    
   float alGain=1.0,
   float rlAdd=0.0,     
   float glAdd=0.0,     
   float blAdd=0.0,     
   float alAdd=0.0,
   float rmContrast=1.0,
   float gmContrast=1.0,
   float bmContrast=1.0,
   float amContrast=1.0,
   float rmCenter=0.5,  
   float gmCenter=0.5,  
   float bmCenter=0.5,  
   float amCenter=0.5,
   float rmSoftClip=0.0,
   float gmSoftClip=0.0,
   float bmSoftClip=0.0,
   float amSoftClip=0.0,
   float rmGamma=1.0,   
   float gmGamma=1.0,   
   float bmGamma=1.0,   
   float amGamma=1.0,
   float rmGain=1.0,    
   float gmGain=1.0,    
   float bmGain=1.0,    
   float amGain=1.0,
   float rmAdd=0.0,     
   float gmAdd=0.0,     
   float bmAdd=0.0,     
   float amAdd=0.0,
   float rhContrast=1.0,
   float ghContrast=1.0,
   float bhContrast=1.0,
   float ahContrast=1.0,
   float rhCenter=0.5,  
   float ghCenter=0.5,  
   float bhCenter=0.5,  
   float ahCenter=0.5,
   float rhSoftClip=0.0,
   float ghSoftClip=0.0,
   float bhSoftClip=0.0,
   float ahSoftClip=0.0,
   float rhGamma=1.0,   
   float ghGamma=1.0,   
   float bhGamma=1.0,   
   float ahGamma=1.0,
   float rhGain=1.0,    
   float ghGain=1.0,    
   float bhGain=1.0,    
   float ahGain=1.0,
   float rhAdd=0.0,     
   float ghAdd=0.0,     
   float bhAdd=0.0,     
   float ahAdd=0.0,
   int rInvert=0,       
   int   gInvert=0,     
   int   bInvert=0,     
   int aInvert=0,
   float lowWeight=0.5, 
   float highWeight=0.5,
   const char *tOrder = "GMAC",
   int affectAlpha = 0,
   float rSource = 0,
   float gSource = 0,
   float bSource = 0,
   float rReplace = "rSource",
   float gReplace = "gSource",
   float bReplace = "bSource",
   float low = 0.1,
   float rolllow = 0.1,
   float high = 0.1,
   float rollhigh = 0.1,
   float lum = 1,
   float rolllum = 1,
   const char *channels = "rgba", 
   int preMult=1,
   int viewRange=0
);


Script

image ColorCorrect(
    in,
    "version",
    "rExpr",    
    "gExpr",     
    "bExpr",     
    "aExpr",
    rContrast,
    gContrast, 
    bContrast, 
    aContrast,
    rCenter,   
    gCenter,   
    bCenter,   
    aCenter,
    rSoftClip,
    gSoftClip, 
    bSoftClip, 
    aSoftClip,
    rGamma,   
    gGamma,    
    bGamma,    
    aGamma,
    rGain,    
    gGain,     
    bGain,     
    aGain,
    rAdd,     
    gAdd,      
    bAdd,      
    aAdd,
    rlContrast,
    glContrast,
    blContrast,
    alContrast,
    rlCenter, 
    glCenter,  
    blCenter,  
    alCenter,
    rlSoftClip,
    glSoftClip,
    blSoftClip,
    alSoftClip,
    rlGamma,   
    glGamma,   
    blGamma,   
    alGamma,
    rlGain,    
    glGain,    
    blGain,    
    alGain,
    rlAdd,     
    glAdd,     
    blAdd,     
    alAdd,
    rmContrast,
    gmContrast,
    bmContrast,
    amContrast,
    rmCenter,  
    gmCenter,  
    bmCenter,  
    amCenter,
    rmSoftClip,
    gmSoftClip,
    bmSoftClip,
    amSoftClip,
    rmGamma,   
    gmGamma,   
    bmGamma,   
    amGamma,
    rmGain=,    
    gmGain,    
    bmGain,    
    amGain,
    rmAdd,     
    gmAdd,     
    bmAdd,     
    amAdd,
    rhContrast,
    ghContrast,
    bhContrast,
    ahContrast,
    rhCenter,  
    ghCenter,  
    bhCenter,  
    ahCenter,
    rhSoftClip,
    ghSoftClip,
    bhSoftClip,
    ahSoftClip,
    rhGamma,   
    ghGamma,   
    bhGamma,   
    ahGamma,
    rhGain,    
    ghGain,    
    bhGain,    
    ahGain,
    rhAdd,     
    ghAdd,     
    bhAdd,     
    ahAdd,
    rInvert,       
    gInvert,     
    bInvert,     
    aInvert,
    lowWeight, 
    highWeight,
    "tOrder",
    affectAlpha,
    rSource,
    gSource,
    bSource,
    "rReplace",
    "gReplace",
    "bReplace",
    low,
    rolllow,
    high,
    rollhigh,
    lum,
    rolllum,
    "channels", 
    preMult,
    viewRange
);
 


Command Line

Yeah, right.