Procedual Matte Creation

vfxwiki  >  Post Techniques  >  Matte Generation  >  Keying  >  Procedual Matte Creation
{MAKETOCBOX(float=>right)}{MAKETOCBOX} {TOC}

Intro

By combinging different types of keyer or keys that are that are aimed at different areas of an image you can pull the desired matte
See attached zip with combustion project and source fottage - a similar tutorial is here CreativeCow.net(external link)

Procedual Matte Combination

see pictures of examples of other operations(external link)

When combining keys you often need to add to the area the key has selected of the background (more black in area) or remove an area the key has selected of the foreground (more white in area).


Combining areas to go black - As black is represented as '0' by multiplying one matte by another if either of the mattes have black pixles it will result in the combination having '0'. Be aware that in float if a pixel has a minus value it will mess things up. A minimum maths operator can be used instead of a multiply but does not decrease the luminance as much as a multiply if values are not pure black, but a min is safer in float.
Image Image Image
A multiplied by B equals (A x B-)

Image Image Image
A minimum B equals (A min B-)

Combining areas to go white Similar to above. Add operators can be used or a maximum operator, with the max op being safer in float. Another option is to use a merge over that add thogether but using itself as a mask.
Image Image Image
A add B equals (A + B-)

Image Image Image
A maximum B equals (A max B-)

Merge Over A powerfull tool when combining mattes is to merge them over one another rather than using a add or max operator. This is has several advantages.
  1. Unlike adding, when in float you can never add the whites together and get more than white creating possible problems later when colour correcting.
  2. Unlike adding or the max tool, if two edges are added together, the sum total of the matte remains the average of the two mattes, keeping the greys in edges correct.

Example

Three keys are combined:
  1. 'Edge Key' (or soft matte)this is concerned with the edge of the mask, keyers such as a colour difference of luma keyer create good detailed soft edges.
  2. 'Hold Out Key' (punch, body, core or hard matte): this is a white mask that is slightly smaller than the edge mask but inside of the mask (the white area) is pure white and contains no grays
  3. 'Garbage Key' This is the opposite of the 'hold out key'. The white mask is made slightly larger than the 'edge key' but the outside of the mask (the black area) contains no grays

When keying the most important thing is the quality of the edge. You want to have detail but for it to also be soft. This is unfortunately a contradiction. If you add a feather or blur to the mask you add softness but loss detail, and if you decrease tolerance in the colour selection of your key you increase detail but lose softness on the edge. This method allows you to adjust the edge quality separate from the pure black or white areas of the mask (the hold out and garbage masks). The weakness of this method is when working with high resolution/depth images i.e. film. The 'hold out' or 'garbage' mattes create faint secondary lines around the edge key. Also if a erode/dilate or shrink/enlarge tool is used to differentiate the garbage and hold out key it can round off edges and make any detail sticking out thinly from the foreground difficult to keep.

Edge Key

Image

The edge key is only concerned with generating fine edge detail. Its ok if it has grays in the black or white area of the matte, as these will be cleaned with the 'hold out' and 'garbage' keys. Colour difference keys are very good at capturing the fine details in an edge. Read Steve Wrights chapter about keying in Digital Compositing for Film And Video for more nfo.

Hold Out Key

Image

This is used to punch a white hole in the matte, cleaning up any gray areas left by the edge key. The fg area keyed is solid white with no grays in it & its edge is a few pixels inside the edge of the real edge of the bg & fg. The accuracy to detail of the 'Hold out' key is not vital, but sharpness and being able to select a wide range of the background image is (like a chroma key). This key is often blurred to try and hide where it joins with the edge key. To have a matte edge that is inside the 'real' edge is to use a shrink or erode tool. To combine this apply a boolean/compound arithmetic tool, this 'add' operator can be used to add the whites of this matte to the whites of the edge detail key. (if working in float a max or merge over must be used)

Garbage Key

Image

This is used to clean up the bg or black areas of the matte that the edge key has left as grey. The BG area keyed is solid black with no grays in it & its edge is a few pixels outside the edge of the real edge of the bg & fg. The accuracy to detail of the 'Garbage' key is not vital, but sharpness and being able to select a wide range of the background image is (like a chroma key). This key is often blurred to try and hide where it joins with the edge key. The best way to have a matte edge that is outside the 'real' edge is to use a key that does not extend in terms of detail all the way out to this real edge, but the easiest way is to use a dilate or enlarge/grow tool.
Image


Combining the keys together

Image

By combining (multiply) the inflated 'garbage key' we get a matte that has a solid black and a good edge but no solid 'core' or held out center. Then by combining (add) the hold out key we get a solid white center for the matte. Then small adjustments to the edge position of the garbage and hold out key is useally required to make sure that none of the detail of the edg key is cut off. Sometime the use of a dilate/erode or shrink/enlarge tools make this impossible and by using different types of keys you can then instead seat the two keys in the correct position either side of the edge key without losing any of its detail.

  • Combining the whites of the hold out is done with an add operator. If working in float this can cause super-whits so a max or merge over operator is preferred

  • Combining the Blacks of the garbage key is done my multiplying the mattes together. If working in float use a min operator. Also a colour correction like a mult/brightness with the garbage used as the matte control input would work.

Links

External Links



Created by ome. Last Modification: Thursday 03 of May, 2007 11:19:15 GMT by ome.