This page describes the basic mechanics of the plugin and several suggestions on how to use it. However, it is recommended to also read About Keying and Spill Suppression to learn how to maximize the effectiveness of this node by combining it with other functions.
There are two example images in pix/primatte in the doc directory distributed with the software, woman.iff and bg.jpg. Join these together with the Primatte function, making sure woman.iff is the first image.
Primatte works by picking a Center value, meaning the average color of the key you want to pull. With the Primatte parameters visible in the Parameter View, make sure the Color Picker labeled center is active, and drag across the bluescreen in the background.
Initially, nothing will happen, because Primatte's output is set to the alpha only by default, meaning only the alpha channel is processed. If you toggle the Viewer to the alpha channel, you will see that an initial alpha channel has been created. If the majority of the background is medium grey, the Color Picker wasn't active when you dragged - go back to it, press it, and re-scrub. The majority of the background should be black. If you want to select a different bluescreen color, make sure the Picker is active and re-scrub on the Viewer. By looking at the alpha channel, we can see there are problems with the key - settle down and put the ammo away, we will fix it in a moment. One of the first parameters in Primatte is called output - it determines what gets passed out of the node. Toggle it over to comp mode, and you will see the composite.
So, what the heck is this puppy doing all over your images? Whereas Keylight keys are based on modeling of light and it's properties, Primatte hammers its key out by assigning color to one of four different zones through a series of color scrubs. Each zone has it's own qualities. These zones are constructed in a 3D space created with the three RGB axes. Here is a 2D representation of this 3D space: So, we would expect most of the pure blue to fall inside zone 1, colors near blue would be in zone 3, and the rest of the colors would be in zone 4. Zone 2 isn't used yet because we haven't assigned any pixels to it. We can see what pixels are in what zones by toggling the output over to status - black is zone 1 (bg), red is zone 4 (fg), and blue is zone 3 (transparent fg). When you are done, toggle back to comp. To assign color to different zones, you pick one of the operator buttons and then scrub. For example, we see her shirt is transparent in some places (that's not a line we see very often in technical documentation, is it?). Click on the foreground operator button - this will assign the the foreground operator and automatically activate a new Color Picker, so just scrub on the shirt area:
If you need to get more areas of foreground, hit the foreground button again and scrub again. If you want to re-scrub, make sure the Color Picker is active and re-scrub. Here's a tip: You aren't going to get the bit under her arm. How do I know? Try scrubbing on it and it won't disappear. This is a clue to you that this particular color is buried way down in zone 1. If you try to assert it as foreground, you are going to upset the entire keying model. That would be bad. Therefore, if you tried to get it with a foreground operator and miserably failed, delete this operator by hitting the delete op button near the end of the parameters. When you see an area like this, you should just mask it out with a holdout matte. Getting to know when to cut your losses and start doing a roto is a sign of maturity and true inner spiritual growth.. We'll do this in a bit.
Meanwhile, the background needs work, especially on the left side of the screen. Hit the background operator and scrub across it.
We have used the foreground and background operators, as well as possibly the delete op button to delete them. By using these operators, we have been assigning pixels to either zone 1 or 4. Picking any of the eight operators will assign color to a different zone. Here is a chart of the operator/zone assignments. Note that decolor all scales the entire 3D space, scaling the shells separating the zones either towards or away from the center point (as determined by your first center scrub), and therefore does not involve picking a color, only moving a slider. Additionally, to make fine tuning effective, you pick a color and then adjust the sliders. This illustration kind of shows how each operator will dimple the surface of the shells through the use of successive color picks.
One swell thing about our implementation of Primatte is that you can go back and review, modify, or delete each operation you have applied at any time. You do not have to start over from scratch if screwed up.
The currentOperation slider scrolls from 0 to whatever number of operations you have done. Each operation can be accessed by using the slider. The center pick is always 0 and cannot be deleted. When you move the slider, the operation type will appear in the Color Picker. To re-scrub it, hit the Color Picker and scrub. To delete the operator, hit the delete op button. You can also insert a new operator at any time. To temporarily deactivate an operator to see if it has done anything useful, toggle the active button on or off. The evalToEnd will evaluate all of your operators when on, or only up to the current operator if it is off. For example, if you have 10 operators and your currentOperation is 3, only operations 0 through 3 will be in the Primatte calculation when evalToEnd is off.
We will now get rid of the bit under her arm, as well as the "image courtesy of Photron", which your client probably doesn't want unless your client is Photron. Garbage Mattes: We will first get rid of the picture credit with a garbage mask. Go to the Image tab and create a QuickPaint node. A good way to create a non-attached node is to hit Ctrl+Shift when you click on it. Attach it to the third input of Primatte. The main brush should be active, but you might want to increase your falloff parameter to 1. Paint across the text, and it should disappear:
You can put in any masking node you would like here - RotoShape, Keylight, RGrad, etc. To select the channel you want, use the gMatteChannel parameter. Holdout Mattes: We now want to get rid of the line under her arm. Attach another QuickPaint node (or RotoShape or whatever...) and attach it to the fourth input. In this illustration, I am looking at the alpha channel. Using the brush, I paint out a holdout matte:
To select the channel you want, use the hMatteChannel parameter. A final parameter to help you with multiple masks: the arithmetic parameter can add the key pulled by Primatte to your foreground's mask by toggling it over to add. You can also subtract or multiply the two masks.With this technique, you can pull several masks and combine them inside of Primatte. In our example here, there is no incoming mask, so it won't do anything.
Primatte has tools to help you with spill suppression. Spill suppression is the removal of reflected light on the foreground material coming from blue screen itself. In our example, blue spill is immediately evident on her white shirt. While the suppression tools in Primatte are interesting and useful, as a general principle, you may want to consider doing the suppression outside of Primatte with nodes like HueCurves and ColorReplace. As one client put it, "Why would you want to tackle two difficult tasks at once?". For information on this process, jump to About Keying and Spill Suppression. With that chilling little preamble, let's continue. There are three primary areas where we see blue spill - the edge of her hair, the shadows on her shirt, and possibly the little transparent bit of her skirt at her knees. The more foreground operators you use on blue areas, the more areas you will have to spill suppress. On the flip side, the fewer foreground operators you use, the more roto or paint touch up you will have to do. Isn't keying fun? There is also a third option, which is to pull two keys with two separate nodes, feeding one into the other. This option is also described in About Keying and Spill Suppression. Let's tackle the hair first. Hitting the spill sponge operator, drag along the purplish edge of her hair. You may have to do two or three spill sponge operators. Each time you do so, it will apply a pre-caculated amount of spill suppression, replacing the blue color with an alternative color. I bet these illustrations look great in a black-and-white printing.
Now the shirt. We could use more spill sponge
operators, but I am instead going to use the fine tuning
operator. This is the same as using spill sponge, restore
detail and make fg trans - the last two either bring back
fine details like individual hair strands or push foreground material
into the slightly transparent zone. The difference is that you are also
given sliders to tune how much of any of those particular effects you
want. Drag along the particularly blue-ish part of her shirt, and then
move the spillSponge slider that appears under the Color Picker.
The more you slide, the greater the range of suppressed area. If you
want to see exactly what is affected, toggle output over to status
and adjust the slider up and down. You will see the green zone (spill
suppression) increase in size.
If you look at the spill-suppressed image, it actually looks a little transparent. This is because Primatte pulls in background color to replace the blue color. Here is the logic. If you are standing in front of a bluescreen and you are getting blue spill, then conceivably if you are standing in front of a red wall, you would get red spill. Therefore, Primatte sucks in the background image color. This will sometimes be sufficient, but often needs a little help. Since the definition of the background is too sharp, for example we can see the black top of the chair through her shirt, it would be more useful to blur the background. We can do this, and then pipe the result into the last input of Primatte, the replaceImage. To send off a branch, select the bg node and Shift+click on Filter - Blur. Then connect the Blur into the Primatte node. You can specifically see that the black chair backing has lost its definition, making the shirt seem less transparent:
Another popular hit with the kids these days is to place a Color - Monochrome node off of the foreground image and feeding it as the replaceImage. Other useful nodes are Key - SpillSuppress, Color - AdjustHSV, Blur and Monochrome, all on the foreground image. Here is a generic example: You have one more alternative for the spill suppression color. If you toggle replaceMode to use color, it will use the Replace Color. In our example, you might select the Replace Color from the color of the wall. This is sometimes helpful, but often as not, will provide a glowing edge around your image, which probably isn't what you are after. Sometimes, the spill color can be successfully isolated from the bluescreen color, and you can get rid of it before feeding it into the Primatte node with a Color - ColorReplace node. Here, I have carefully selected the blue on her shirt as the Source Color and then replaced it with color from the background image. My range parameters are all at 0, with the falloff parameters all around .2. When using this technique, you can initially predict if you are affecting the bluescreen (which you do not want to do) by toggling on ColorReplace's affectAlpha parameter and looking at the alpha channel of the ColorReplace node. The bluescreen should still be pure black.
After doing this, I return to Primatte and delete some of my fine tuning operations.
Primatte therefore has a great deal of flexibility, both within the node, or by preceding it with other nodes. You will find, however, that you have the most flexibility when you decide to not composite inside of the Primatte node. This gives you the chance to apply effects to the foreground element like Transforms or Blurs, as well as spill suppression. In this tree, I have toggled Primatte's output to alpha only, and then turned on preMultiply in the Over node. Because I am not processing the edges with color suppression operators, the edge stays much cleaner. Note that if you are doing color corrections in Primatte and you set your output to on Black, you will still have a better edge if you feed the background in. Here, let me put it this way:
For more information, jump to About Keying and Spill Suppression. |