- Keying is the process of separating a foreground from a background after the shot is filmed with distinctively different background to the foreground. i.e. a blue or green screen.
- Keying creates a mask (or known as a matte) from this difference. e.g. with a Colour Key a range of pixels in a blue or green screen shot is selected to create an animated black and white mask.
- The key is then embedded in the alpha channel where masks are used to composite the foreground with a different background.
- Some methods of compositing a blue or green screen FG with a BG dont use a matte and strictly speaking are not keyers. i.e. the additive keyer
AimsWhat you don't want from a key is:
- Buzzing edges (due to noise)
- Sucking edges (due to over-treatment)
- Crawling edges
- Not to soft on hard edges & not to hard in defocused or motion blurred edges of the plate.
- all the detail of the original
- that the background areas of luminance affects the matte. i.e. bright lights.
TypesThe are several types of colour keyers available that extract the foreground from the background. see pictures
- Luma Key Based on the Luminance values of the selected colour range. If the edge of the fg/bg is significantly different in brightness an excellent soft, detailed key is produced.
- Chroma Key Based on the UVW colour space and luminance values. Good at selecting areas of colour and making solid areas of white and Black. Edge detail is often sharp, works best for solid non translucent edges. i.e. not glass or hair. dge detail is often far too sharp and noisy. Advanced chroma keyers use 3d maths with various colour models (Master Keyer / Primate ).
- Primatte 3D Chroma Keyers Can select a narrow range of a hue selection while maintaining softish edges, making it a good keyer if you need an ok result fast. Often used for a hard matte. Allows the artist to easily specify multiple areas of the image to be FG or BG. But it is a 'magic box' with little manual control, excellent at selecting ranges of colour to get a solid key quickly. It slightly lacks in detail in translucent soft areas, and this is more noticeable at higher resolutions.
- Colour Key Based on the RGB and Luminance of the selected color range. good at selecting areas of colour and making solid areas of white and Black. Edge detail is often sharp, works best for solid non translucent edges. i.e. not glass or hair. Dosent work as well as a chroma keyer for selecting a range of values.
- Colour Difference (value of difference of one pixel from another). A cheep procedural keyer. A simple equation that creates a matte based upon the difference of the RGB channels. This is a good keyer for edge quality, particularly with hair, glass, shadows, but results in the mask not having a solid white of black area. Ultimatte and Keylight are advanced examples of this type of keyer.
- Keylight A advanced colour difference keyer. Often used to create a soft matte. Controls are more open than Primatte. Many of its buttons are never used. Basically select a single colour and fiddle with gain control to adjust the matte as with a lut. Has a range of built in matte adjustment tools such as: blurs, gain, screen balance (gamma)
- Additive Keyer Image Based combination of FG & BG does not use the normal method of generating an alpha and then multiplying b
- Difference Keyer a simple subtraction provides the difference between the BG & FG. Not piratically used for keying due to being so sensitive it will pick up grain variation.. A Bump Matte is a variation of difference matte.
- FloodFill Keyer Also known as the magic wand keyer. Works well on still images but less so on multiple frames.
- Roll your own see: Luma KeyChannel chopping the image to create a key. Channels form different colour spaces can be examined to see how they best separate the image.
ProcessKeying is done in three stages:
- Examining the plate
- Preparing the plate - if required i.e. a degrain, cleanup?
- Creating the matte: extracting the foreground from the background
- Despill & fringe: treating the edges so the join between the fg and the bg is hidden & removing a colour cast generated by the colour reflection of a chroma screen.
Strategies for creating the matteCan be divided into procedural and non-procedural methods. Any of the bellow methods mattes are then combined if necessary.
- One click key (Non Procedural Single key) A single key generates a mask that is then applied to the image (with or without multiplication) in a single tool. Often using a sophisticated plugin. Quick to implement and easy to execute, but usually not detailed enough for film resolution.
- Multiple keys for separate areas of the screen (Non Procedural Matte Combination) A single key does not select the entire screen (because of variations in the screen expose or different parts of the fg i.e. hair, upper body parts and lower body parts). Additional areas that where not successfully selected with the first key are rotoscoped with rough garbage masks so select different areas of the screen) and subsequent keys are added to first key's matte. The mattes are then combined up to create a final key. Quick to implement(apart from the rotoscoping) and easy to execute.
- Multiple Keys for combining different qualities (Procedural Matte Combination?) Several keys are combined to create a matte i.e. a key for the fine edges and one for the core of the FG. Each key is either applied to the whole image or a selection. The mattes are then combined to create a final key. As no rotoscoping is done this set of procedures can be applied to different similar images to create a quick work-flow, but more time to initial implement. It also generates more control over the quality of the keyed edge, as
- Non-matte compositing (Procedural Image Combination). The fg & bg are combined in other ways apart from using a matte and the normal 'over' process. i.e. additive keyer. Mattes might be used and used to control areas where this is applied.
- Examining the plate
- Examine the channels RGB & HLS separately with an expand/levels to locate 1) if any channel has separation 2) if perhaps one channel iSub from another has separation.
- Get a rough idea what the BG is to see how edges resolve(differentiation in luminance) in different areas of the image.
- What prepwork is needed?. clean-up, roto.
- Are there solutions that other artists have resolved for the sequence? - degrain / despill / keys scripts.
- Is it locked off, do i need tracks for roto or patches.
- Preparing the plate
- Hopefully you have a screen that has been evenly lit without unwanted shadows. Different screen material, temperature of lighting equipment and if the screen has been exposed less or more than the FG will change how the fg & bg separate when creating a matte.
- Often during production there wasn't enough time create a perfect screen so it will require cleaning up. Markers, wires & and other bits of rig, production equipment, shadows too dark to key, fg that is not behind a screen, will require either removed with paint & patch or separated with a roto.
- Plate requires dustbusting and any few frame paint fixes to be done - i.e. scratches
- If the fg subject has areas that have the same colour as the screen, it will create holes in the matte, so it will need to be roto'ed. This colour might be due to spill or perhaps part of the actor or their wardrobe is the same colour. A chroma keyer or hue difference keyer might be quicker to isolate this area than a roto.
- Producing a rough roto outside the edges of the fg often helps by creating a garbage matte to remove areas away from the fg subject so only that needs keying, as well as defining an area that needs to be cleaned up.
- If a locked off camera has shot a empty green screen, then this can be used to help generate a key. A perfect corrected screen can also be created if this is required.
- The screen plate might require pre-treating to help separation. i.e. Degrain Noise Reduction or Colour Corrections?
- Creating the matte
- Pull a key with One Click keyer such as keylight. This should give you an idea what the problems might be, often soft areas are missing, matte edges becomes two hard if all off the fg is keyed.
- A common strategy is to create a soft key that is transparent & has holes in it and a hard key that has been shrunk/eroded and then they are combined to create a solid key with soft edges. Testing the screen with several types keyers can be done to find get the desired results as they produce different results. If you have no need for soft edges or transparency a chroma or colour keyer is best: i.e. Primatte. On the other hand Ulltimate / keylight / Luma key are far better with softness detail. If you really want to learn about keying the you can build your own keyers by hand using a procedual node based effects package.
- Once a good matte is made the original untreated fg plate is used to composite the image over the bg.
- If further edge detail is required an Additive Keyer can be used.
- Despill & fringe
- After you have pulled the key you need to despill the image to remove/desaturate the screens colour cast and coloured edges. Any parts of the image that has been inveterately de-spilled need to be held out by mattes. i.e. green eyes on the fg with a despilled green screen. Its important to compare the original plate with the despilled plate and check it hasn't changed.
- Edge fringe detail|#Fringe adjustment needs to join the background colour and luminance levels.
- The edges can be further integrated by matching the BG plate i.e. focus, Light Wrap & Edge Blending
- Using paint on difficult areas such as motion blur can be more time effective than getting the keyer to pull a perfect key.
Motion blur FXguide Thread (cache) Separate rgb in tree layers, you get tree b&w clip white different density. Use histogram or lumakey to contrast your clip to extract a matte. This technique work to extract some detail, that not a one shots deal. Mult for dark edges and screen for fine detail such as blond hair. you will have to to create specific mattes for the areas you want to use though. hair, clothes, blurred object, etc. mostly sep the darks from the lights. just like your laundry. if you try to do to much at once you will ruin everything. by yellowpearl(2003)
Checking keys A clean matte has solid blacks a whites where necessary. It is difficult to check this so a colour correction of clamping the blacks at values of .2 rather than 0, and whites at .8 rather than 1 will reveal stray pixels (a LUT can be created to do this). Using a curve rather than a clamp with a slight incline to .2 and .8 is better