Primatte

Primatte keys are created incrementally by sampling single pixels, or a range of pixels, from a blue or greenscreen image. This controls the polyhedron in colorspace that determines what pixels are in or outside the matte. To use Primatte, click Auto-Compute to automatically sense the backing screen color, eliminate it, and even get rid of some of the foreground and background noise. Alternatively, you can set operation to how you want to use the color samples, or use the left and right arrow buttons to step through all the operations. Then, use Ctrl+click or Ctrl+Shift+drag to select a single color or a range of colors from the Viewer. Primatte then uses these to adjust the polyhedron. Nuke provides unlimited Undo during this process.

Primatte is a trademark of IMAGICA Corp. Primatte patent is held by IMAGICA Corp.

Inputs and Controls

Connection Type

Connection Name

Function

Input

bg

The background image to replace the blue/green screen in the foreground.

fg

The foreground, or subject, image to key.

mask

An optional image to use as a mask. By default, the Primatte effect is limited to the non-black areas of the mask.

At first, the mask input appears as triangle on the right side of the node, but when you drag it, it turns into an arrow labeled mask. If you cannot see the mask input, ensure that the mask control is disabled or set to none.

Control (UI)

Knob (Scripting)

Default Value

Function

Primatte Tab

foreground

foreground

rgb

Channels from the fg input containing the image to key and composite.

background

background

rgb

Channels from the bg input to composite over, and to calculate the spill suppression.

crop

crop

N/A

The area of the input image you want to keep. Anything outside this box is cropped.

You can adjust the following:

x - the distance (in pixels) between the left edge of the original image and the left side of the crop box.

y - the distance (in pixels) between the bottom edge of the original image and the bottom edge of the crop box.

r - the distance (in pixels) between the left edge of the original image and the right side of the crop box.

t - the distance (in pixels) between the bottom edge of the original image and the top edge of the crop box.

w - the width of the crop box. This is only available if you click the wh button.

h - the height of the crop box. This is only available if you click the wh button.

You can also adjust the crop box in the Viewer by dragging its edges.

mask

N/A

disabled

Enables the associated mask channel to the right. Disabling this checkbox is the same as setting the channel to none.

mask

none

The channel to use as a mask. By default, the Primatte effect is limited to the non-black areas of this channel.

invert

invert_mask

disabled

Inverts the use of the mask channel so that the Primatte effect is limited to the non-white areas of the mask.

Initialize

algorithm

algorithm

Primatte

Choose which algorithm Primatte uses to calculate your keying result:

Primatte - The Primatte algorithm delivers the best results and supports both the solid color and the complement color spill suppression methods. It is the algorithm that uses three multi-faceted polyhedrons (as described further down in the this chapter) to separate the 3D RGB colorspace. It is also the default algorithm mode and, because it is computationally intensive, it may take longer to render.

PrimatteRT - is the simplest algorithm and therefore, the fastest. It uses only a single planar surface to separate the 3D RGB colorspace (as described further down in this chapter) and, as a result, does not have the ability to separate out the foreground from the backing screen as carefully as the above Primatte algorithm. Other disadvantages of the Primatte RT algorithm is that it does not work well with less saturated backing screen colors and it does not support the complement color spill suppression method.

Primatte RT+ - this is in between the above two options. It uses a six planar surface color separation algorithm (as described further down in this document) and delivers results in between the other two in both quality and performance. Other disadvantages of the Primatte RT+ algorithm is that it does not work well with less saturated backing screen colors and it does not support the complement color spill suppression method.

Reset

Reset

N/A

Resets all of the Primatte properties to their initial values.

Auto-Compute

Auto-Compute

N/A

This can be used as the first step in the Primatte operation. Its purpose is to automatically detect the backing screen color, remove it, and do some clean-up on the foreground and background noise. If the clip was shot with an evenly lit, well-saturated backing screen, the Auto-Compute button leaves you with an image that may only need some spill removal to complete your keying operation.

viewer

viewer

disabled

Opens a Primatte Viewer that displays a graphical representation of the Primatte algorithms and allows you to see what is happening as the various Primatte tools are used. It is a passive feature that has no adjustment capabilities, but it may prove useful in evaluating an image as you operate on it.

Degrain

type

graintype

none

Select the type of degrain to use:

none - you get the color of the exact pixel sampled.

small - gets the average color of a small region of the area around the sampled pixel. Use this when the grain is very dense.

medium - gets the average color of a medium-sized region of the area around the sampled pixel. Use this when the grain is less dense.

large - gets the average color of a larger region of the area around the sampled pixel. Use this when the grain is very loose.

tolerance

graintolerance

0.2

Increases the effect of the Clean BG Noise tool without changing the edge of the foreground object. This allows you to tell the Primatte algorithm what brightness of pixels you think represents grain. You should try not to use too high of a value; otherwise, it affects the overall matte.

Actions

operation

mode

Smart Select BG Color

What the colors you sample in the Viewer do:

Smart Select BG Color - gets the sampled backing screen color, analyzes the original foreground image, and determines the foreground areas using the Primatte foreground detection routine. Then, using the newly determined foreground areas, performs a Clean FG Noise operation internally and renders the composite image.

Clean BG Noise - removes noise from the background. Any pixels you sample in the Viewer are known to be 100% background. White noisy areas in the 100% background region become black.

Clean FG Noise - removes noise from the foreground. Any pixels you sample in the Viewer are known to be 100% foreground. The color of the sampled pixels is registered by Primatte to be the same color as in the original foreground image. This makes dark gray areas in the 100% foreground region white.

operation (continued)

   

Matte Sponge - sets the sampled color in the image to be 100% foreground. However, if the sampled color is already keyed out and removed, it leaves the current suppressed color. It only affects the key or matte information. This tool is usually used to quickly remove stray transparent pixels that have appeared during the chroma keying procedure.

Make FG Trans. - suppresses spill in foreground transparency. When this mode is selected, the opaque foreground color region sampled in the Viewer becomes slightly translucent. This operation is useful for the subtle tuning of foreground objects that are otherwise completely covered with smoke or clouds.

Restore Detail - brings back detail to the foreground. The completely transparent background region sampled in the Viewer becomes translucent. This operation is useful for restoring lost hair details, thin wisps of smoke and so on.

Spill Sponge - removes spill from a composite image. When this mode is selected, the background color component in the pixels sampled in the Viewer is keyed out and removed for the color region selected.

operation (continued)

 

 

Spill(-) - removes color spill from the sampled pixel color (and all colors like it) in the amount of one Primatte increment. If spill color remains, another click using this tool removes more of the color spill.

Spill(+) - returns color spill to the sampled pixel color (and all colors like it) in the amount of one Primatte increment. This tool is used to move the sampled color more in the direction of the color in the original foreground image. It can be used to nullify a Spill (-) step.

Matte(-) - reduces the opacity of the matte for the sampled pixel color (and all colors like it) in the amount of one Primatte increment. If the matte is still too opaque, another click using this operational mode tool makes the sampled color region even more translucent. This can be used to thin out smoke or make a shadow thinner to match shadows in the background imagery.

Matte(+) - increases the opacity of the matte for the sampled pixel color (and all colors like it) in the amount of one Primatte increment. If the matte is still too translucent or thin, another click using this operational mode tool makes the sampled color region even more opaque. This can be used to thicken smoke or make a shadow darker to match shadows in the background imagery. It can only make these adjustments to the density of the color region on the original foreground image. It can be used to nullify a Matte (-) step.

operation (continued)

 

 

Detail(-) - reduces foreground detail for the sampled pixel color (and all colors like it) in the amount of one Primatte increment. If detail is still missing, another click using this operational mode tool makes detail more visible. This can be used to restore lost smoke or wisps of hair.

Detail(+) - increases foreground detail for the sampled pixel color (and all colors like it) in the amount of one Primatte increment. If there is still too much detail, another click using this operational mode tool makes more of it disappear. This can be used to remove smoke or wisps of hair from the composite. Sample where detail is visible and it disappears. This is for moving color regions into the 100% background region. It can be used to nullify a Detail (-) step.

Fine Tuning Sliders - provides finer control over the removal of spilled background color. The color of the sampled pixel is registered as a reference color for fine tuning. To perform the tuning operation, select a Fine Tuning slider and move it to achieve the desired effect.

3D Sample - When viewer is enabled in the Primatte properties, the sampled colors are displayed as a spray of white pixels in the Primatte Viewer. This allows you to see where the selected backing screen colors reside within the 3D RGB colorspace.

Simple Select BG Color - gets the sampled backing screen color, projecting a line in the opposite direction on the hue wheel and generating artificial pixels that may represent the FG object. Then, using the artificially generated foreground pixels, it performs a Clean FG Noise operation internally and renders the composite image.

currentColor

black

To sample colors from the Viewer, make sure this is pushed in (displaying an eyedropper), then Ctrl/Cmd+click in the Viewer to pick single pixels, or Ctrl/Cmd+Shift+drag to pick a rectangle of pixels.

adjust lighting

adjustLighting

disabled

When enabled, based on the currently selected BG color, Primatte generates a clean, evenly lit backing screen to use in the keying operation. This can improve the results if you have a very unevenly lit backing screen.

hybrid render

hybridRender

disabled

When enabled, Primatte internally creates two keys from the same image:

core - This matte has the transparency removed, but suffers from the bad edges on the foreground object.

edge - This matte has a clean edge on the foreground, but suffers from transparency within the foreground object.

The core matte with the bad edges is then blurred and eroded before it is composited over the edge matte that has the transparency, resulting in a composite with the best of both options.

This can help you deal with foregrounds that contain a color that is close to the backing screen color.

Adjust Lighting

threshold

lightingSPoly

10

When adjust lighting is enabled, determines if a grid pixel should be treated as a pure background sample, a simulated background sample, or a foreground sample. Increasing the value brings more of the foreground into the adjusted lighting.

grid size

lightingGridSize

12

When adjust lighting is enabled, sets the grid size used. Increasing this value increases the grid resolution used in the adjusted lighting calculation.

Hybrid Matte

erode

hybridErode

5

When hybrid render is enabled, sets the amount of erosion performed on the core matte. To view the results, set output mode to hybrid core and view the alpha channel.

blur radius

hybridBlurRadius

0.5

When hybrid render is enabled, sets the blur radius used when blurring the core matte. To view the results, set output mode to hybrid edge and view the alpha channel.

Fine Tuning

L-poly (spill)

spill

0

Adjust boundary between spill-suppressed opaque foreground and no-change opaque foreground. The more to the right the slider moves, the more spill is removed. The more to the left the slider moves, the closer the color component of the selected region is to the color in the original foreground image.

M-poly (trans)

matte

0

Adjust boundary between partially transparent foreground and fully opaque foreground. Moving this slider to the right makes the registered color region more transparent. Moving the slider to the left makes the matte more opaque.

S-poly (detail)

detail

0

Adjust boundary between completely transparent background and partially translucent foreground. Moving this slider to the right makes the registered color region more visible. Moving the slider to the left makes the color region less visible.

Spill Process

replace with

spillProcess

complement

The color spill replacement method to use:

no suppression - no spill suppression is applied.

complement - replaces the spill color with the complement of the backing screen color.

solid color - replaces the spill color with a solid color of your choice. Use replace color below to choose the color.

defocused background - replaces the spill color with colors from a defocused version of the background image. Use defocus to adjust the amount of defocus applied to the background buffer image.

replace color

replaceColor

0.18

When replace with is set to solid color, allows you to select a solid color to use to replace the spill.

defocus

defocus

10

When replace with is set to defocused background, sets the amount to defocus the background for spill process.

Output

output mode

output_mode

composite

Determines what the output from the node should be:

composite - premultiplies the foreground with the background based on the matte created. This is your final result.

premultiplied - outputs the premultiplied result of the Primatte node, along with the calculated matte. This can be useful if you want to do your compositing using a Merge node (with operation set to over) rather than Primatte. This allows you to color correct, transform, and otherwise process your image before compositing it over the background. Note, however, that Primatte works within the sRGB colorspace, whereas Nuke works within a linear colorspace. This means you need to add a Colorspace node after both Primatte and your original background image to convert their colorspaces to sRGB, then do your color corrections or transforms, merge the images together, and, finally, use another Colorspace node to convert the result back to linear.

unpremultiplied - outputs the unpremultiplied result of the Primatte node, along with the calculated matte. This can be useful if you want to do your compositing using a Merge node (with operation set to matte) rather than Primatte. This allows you to color correct, transform, and otherwise process your image before compositing it over the background. Note, however, that Primatte works within the sRGB colorspace, whereas Nuke works within a linear colorspace. This means you need to add a Colorspace node after both Primatte and your original background image to convert their colorspaces to sRGB, then do your color corrections or transforms, merge the images together, and, finally, use another Colorspace node to convert the result back to linear.

output mode (continued)

   

notpremultiplied - outputs the original foreground pixels (instead of the result of the Primatte node), along with the calculated matte.

adjust lighting FG - outputs the light-adjusted foreground that the adjust lighting mode creates (this has a more even shade of the backing color with the foreground object). If adjust lighting is disabled, this option simply displays the un-optimized, original foreground image.

adjust lighting BG - outputs the optimized artificial backing screen that the adjust lighting mode creates (a clean backing screen that has no foreground object).

hybrid core - outputs the internally generated core matte, used when hybrid render is enabled.

hybrid edge - outputs the internally generated edge matte, used when hybrid render is enabled.

output

output

rgba

The channels to write the output image to.

Step-by-Step Guides

Keying with Primatte (User Guide instructions)

Keying with Primatte (a written tutorial)

Video Tutorials