digital compositing - nus computing - homecs5245/lecture/compositing.pdf · · 2009-02-09leow wee...
TRANSCRIPT
Digital Compositing
CS5245 Vision and Graphics for Special Effects
Leow Wee Kheng
Department of Computer Science
School of Computing
National University of Singapore
Leow Wee Kheng (CS5245) Digital Compositing 1 / 67
Introduction
Introduction
Digital compositing means
digitally manipulated integration of at least two images to
produce a new image.
The new image must appear realistic.
It must be completely and seamlessly integrated,as if it were actually photographed by a single camera.
Leow Wee Kheng (CS5245) Digital Compositing 2 / 67
Introduction
Example: A scene in Saint (1997) shot in front from blue screen.
Leow Wee Kheng (CS5245) Digital Compositing 3 / 67
Introduction
Main Topics
Keying
Separate foreground elements from background elements.
Rig Removal
Remove unwanted elements in footage.
Alpha Blending
Blend foreground elements with new background footage.
Other topics: Refer to [Kel00].
Leow Wee Kheng (CS5245) Digital Compositing 4 / 67
Alpha Blending
Alpha Blending
Basic equationC = αF + (1 − α)B (1)
F : foreground image
B: background image
C : composite
α: opacity or transparency
matte: an image of α values
The above operation is performed on each corresponding pixel.
If α = 1, then C = F ,foreground is shown, i.e., foreground is opaque.
If α = 0, then C = B,background is shown, i.e., foreground is transparent.
0 < α < 1: semi-transparent, e.g., shadow, smoke, etc.
Leow Wee Kheng (CS5245) Digital Compositing 5 / 67
Alpha Blending
Example: No Background B.
foreground F matte α composite C
Leow Wee Kheng (CS5245) Digital Compositing 6 / 67
Alpha Blending
Example: With Background B.
foreground F matte α
background B composite C
Leow Wee Kheng (CS5245) Digital Compositing 7 / 67
Alpha Blending
Example: Foreground with shadow.
foreground F matte α
background B composite C
Leow Wee Kheng (CS5245) Digital Compositing 8 / 67
Alpha Blending
Important Notes
α of shadow should take intermediate value (0 < α < 1).Otherwise, shadow looks unreal.
A bad matte results in a bad comp.
Leow Wee Kheng (CS5245) Digital Compositing 9 / 67
Alpha Blending
α at boundary should also take intermediate value.Otherwise, have dark fringes.
Good matte has intermediate α at boundary and in shadow.
Leow Wee Kheng (CS5245) Digital Compositing 10 / 67
Alpha Blending
Real images have smooth boundaries, no fringe.
Leow Wee Kheng (CS5245) Digital Compositing 11 / 67
Alpha Blending with After Effects
Alpha Blending with After Effects
1 Create a comp with matte, foreground, and background stacked inlayers.
2 Composite using luminance-based track matte.
Leow Wee Kheng (CS5245) Digital Compositing 12 / 67
Keying
Keying
Separate foreground elements from background elements,creating a matte of foreground.
Also called pulling a matte (of foreground), orkeying out (i.e., making transparent) background.
Recall:A good matte has intermediate α in shadow and along objectboundaries.
Leow Wee Kheng (CS5245) Digital Compositing 13 / 67
Keying
Basic methods
Luma keying
based on luminance, i.e., intensity.
Chroma or color keying
based on color, i.e., blue screen, green screen.
Difference keying
requires clean plate,i.e., background image without foreground element.
Leow Wee Kheng (CS5245) Digital Compositing 14 / 67
Keying
Basic Ideas
Compute difference between foreground and background (based onluma, chroma, or color).
Map difference value to α.
Very small diff⇒ α = 0.
Very large diff⇒ α = 1.
Intermediate diff ⇒
intermediate α.
Leow Wee Kheng (CS5245) Digital Compositing 15 / 67
Color Keying with After Effects
Color Keying with After Effects
Example images from The Saint (1997).
Leow Wee Kheng (CS5245) Digital Compositing 16 / 67
Color Keying with After Effects
Create a comp with background below foreground in timeline panel.
Select foreground, thenselect “Effect → Keying→ Color Key”.
Use dropper to select KeyColor.
Set Color Toleranceamount.
Leow Wee Kheng (CS5245) Digital Compositing 17 / 67
Color Keying with After Effects
Results: Some background remains, some foreground is removed.
increasecolor
tolerance
Leow Wee Kheng (CS5245) Digital Compositing 18 / 67
Color Keying with After Effects
Results: Color keying in AE has limitations.
increasecolor
tolerance
Leow Wee Kheng (CS5245) Digital Compositing 19 / 67
Color Keying with Keylight in After Effects CS4
Color Keying with Keylight in After Effects CS4
Keylight [Key]
An Academy award winning blue and green screen keyer.
Core algorithm was developed by the Computer Film Company.
Further developed and ported to After Effects by The Foundry.
Use Keylight in After Effects CS4
Create a comp with background below foreground in timeline panel.
Leow Wee Kheng (CS5245) Digital Compositing 20 / 67
Color Keying with Keylight in After Effects CS4
Select foreground, thenselect “Effect → Keying→ Keylight”.
Use dropper to selectScreen Colour for keying.
Screen Balance isadjusted automatically.
Leow Wee Kheng (CS5245) Digital Compositing 21 / 67
Color Keying with Keylight in After Effects CS4
Keylight performs color keying as follows:
Compare intensities of primary components of a pixel and screen color.
If small diff, set α = 0:transparentbackground pixel
If large diff, set α = 1:opaqueforeground pixel
If moderate diff, setintermediate α:semi-transparentedge pixel
Leow Wee Kheng (CS5245) Digital Compositing 22 / 67
Color Keying with Keylight in After Effects CS4
Blue screen is keyed out.
Foreground element is blended with background.
Leow Wee Kheng (CS5245) Digital Compositing 23 / 67
Color Keying with Keylight in After Effects CS4
Display Status view to check result.
White: opaque
Black: transparent
Gray: semi-transparent
Car window is not very transparent.
Hands and steering wheel are a bit transparent.
Need to fix transparency problems.
Leow Wee Kheng (CS5245) Digital Compositing 24 / 67
Color Keying with Keylight in After Effects CS4
In Keylight, transparency can be adjusted using the following features:
Leow Wee Kheng (CS5245) Digital Compositing 25 / 67
Color Keying with Keylight in After Effects CS4
Let’s illustrate their functions using these test images:
foreground image
foreground blendedon green screen
background image
Leow Wee Kheng (CS5245) Digital Compositing 26 / 67
Color Keying with Keylight in After Effects CS4
Screen Gain
more redmore transparent
increase gain
default = 100
Leow Wee Kheng (CS5245) Digital Compositing 27 / 67
Color Keying with Keylight in After Effects CS4
Screen Gain
default = 100
decrease gain
more opaquemore blue/green
Leow Wee Kheng (CS5245) Digital Compositing 28 / 67
Color Keying with Keylight in After Effects CS4
Screen Balance
change colorincrease balance
default
decrease balancechange color
Leow Wee Kheng (CS5245) Digital Compositing 29 / 67
Color Keying with Keylight in After Effects CS4
Click Black
Differences below Click Black are assigned α = 0.
Result: Affected foreground pixels become totally transparent.
Leow Wee Kheng (CS5245) Digital Compositing 30 / 67
Color Keying with Keylight in After Effects CS4
Click Black
more transparent
increase clip black
default = 0
Leow Wee Kheng (CS5245) Digital Compositing 31 / 67
Color Keying with Keylight in After Effects CS4
Click White
Differences above Click White are assigned α = 1.
Result: Affected foreground pixels become totally opaque.
Leow Wee Kheng (CS5245) Digital Compositing 32 / 67
Color Keying with Keylight in After Effects CS4
Clip White
default = 100
decrease clip white
more opaque
Leow Wee Kheng (CS5245) Digital Compositing 33 / 67
Color Keying with Keylight in After Effects CS4
Apply to our example: increase screen gain.
Status
Matte
Leow Wee Kheng (CS5245) Digital Compositing 34 / 67
Color Keying with Keylight in After Effects CS4
Final comp:
Leow Wee Kheng (CS5245) Digital Compositing 35 / 67
Color Keying Handling Blue Spill
Handling Blue Spill
Blue spill is due to light reflected from blue screen.
(a) (b)
(a) Hair looks blue or purple.
(b) Skirt has blue color.
Leow Wee Kheng (CS5245) Digital Compositing 36 / 67
Color Keying Handling Blue Spill
Key out blue screen using Keylight and blend with background.
Example images from Merlin (1998).
Leow Wee Kheng (CS5245) Digital Compositing 37 / 67
Color Keying Handling Blue Spill
(a) (b)
(a) Background not clear.
Increase screen gain to improve transparency.
(b) Hair looks purple: blue spill.
Adjust screen balance to remove some blue spill.
Leow Wee Kheng (CS5245) Digital Compositing 38 / 67
Color Keying Handling Blue Spill
(c) (d)
(c) Still have blue spill.
Uncheck check-box forLock Biases Together.Select skin color forDespill Bias using dropper.
(d) Final comp.
Leow Wee Kheng (CS5245) Digital Compositing 39 / 67
Color Keying Handling Poor Green Screen
Sometimes, the blue/green screen may be poorly done.
Example: from Executive Decision (1996).
The green screen has more red than green!
Leow Wee Kheng (CS5245) Digital Compositing 40 / 67
Color Keying Handling Poor Green Screen
When the image is keyed, the foreground looks transparent.
Leow Wee Kheng (CS5245) Digital Compositing 41 / 67
Color Keying Handling Poor Green Screen
To fix the problem, need to tell Keylight to scale down red componentso that the green component is the most prominent.
Check check-box for Lock Biases Together.
Select skin color for Despill Bias using dropper.
Need to select from Source view, i.e., input image.
Alpha Bias is selected automatically.
Leow Wee Kheng (CS5245) Digital Compositing 42 / 67
Color Keying Handling Poor Green Screen
Display Status view to check result.
Pilot’s mask is transparent.
Cockpit glass canopy is not totally transparent.
Need to fix transparency problems.
Leow Wee Kheng (CS5245) Digital Compositing 43 / 67
Color Keying Handling Poor Green Screen
Increase Clip Black to make the glass canopy more transparent.
Leow Wee Kheng (CS5245) Digital Compositing 44 / 67
Color Keying Handling Poor Green Screen
Decrease Clip White to make the mask opaque.
Leow Wee Kheng (CS5245) Digital Compositing 45 / 67
Color Keying Handling Poor Green Screen
There are some spots on the foreground and background,most apparent in the Matte view.
Leow Wee Kheng (CS5245) Digital Compositing 46 / 67
Color Keying Handling Poor Green Screen
Increase Screen Despot Black and Screen Despot White to remove spots.
Leow Wee Kheng (CS5245) Digital Compositing 47 / 67
Color Keying Handling Fringes
Handling Fringes
Sometimes, adjusting Clip Black and Clip White can produce fringes.Adjusting Screen Gain usually doesn’t produce fringes.
Leow Wee Kheng (CS5245) Digital Compositing 48 / 67
Color Keying Handling Fringes
One method of removing fringes is to shrink the screen matte.Set Screen Shrink to small negative value.
Leow Wee Kheng (CS5245) Digital Compositing 49 / 67
Color Keying Handling Fringes
Large negative value Small negative value Positive valueShrink too much Just nice Expand too much
Demo: keyed by Keylight, keyed by Ultimatte AdvantEdge.
Leow Wee Kheng (CS5245) Digital Compositing 50 / 67
Difference Keying
Difference Keying
Key out background based on pixel-wise color difference betweenforeground and background footage.
Can be used when:
Blue screen isimperfect.
Background is not ofuniform color.
Leow Wee Kheng (CS5245) Digital Compositing 51 / 67
Difference Keying
Require a clean plate: footage without foreground.
Leow Wee Kheng (CS5245) Digital Compositing 52 / 67
Difference Keying with Ultimatte AdvantEdge
Difference Keying with Ultimatte AdvantEdge
Ultimatte AdvantEdge is a plug-in to After Effects.
Select foreground, thenselect “Effect →AdvantEdge”.
Specify clean plate image.
Select screen colour usingdropper of SampleBacking.
AdvantEdge can use cleanplate to do screencorrection.
Leow Wee Kheng (CS5245) Digital Compositing 53 / 67
Difference Keying with Ultimatte AdvantEdge
If screen correction is imperfect, can use guide lines to limit area to beblended.
Leow Wee Kheng (CS5245) Digital Compositing 54 / 67
Difference Keying with Ultimatte AdvantEdge
Final comp:
Leow Wee Kheng (CS5245) Digital Compositing 55 / 67
Rig Removal
Rig Removal
Rigs are equipment that support the actors or props.
Sometimes, rigs cannot be removed by keying alone.
So, have to apply masking technique to remove rigs.
Need clean plates of background footage.
If camera moves, then need motion-controlled camera.
Computer controls camera to move the same way twice:
Without foreground objects; get clean plates.With foreground objects.
Basic Idea:
Apply a mask to mask out the rig.
Replace pixels in masked area by corresponding pixels in clean plate.
If rig moves, then animate the mask accordingly.
Leow Wee Kheng (CS5245) Digital Compositing 56 / 67
Rig Removal
Example: Let’s assume that this chess piece is a rig.
Show: Chess footage, clean plate.
Leow Wee Kheng (CS5245) Digital Compositing 57 / 67
Rig Removal
Step 1: Align Clean Plate
Check misalignment between foreground and clean plate.
Motion-controlled camera can’t be perfect.
Difference of foreground and clean plate can reveal misalignment.
Leow Wee Kheng (CS5245) Digital Compositing 58 / 67
Rig Removal
Translate clean plate to align.
Use real number coordinates get more precise alignment.Have to set layer quality to “Best”.
Leow Wee Kheng (CS5245) Digital Compositing 59 / 67
Rig Removal
Step 2: Mask Out Rig
Lock clean plate to avoid accidental change of position.
Put a mask over rig, include rig shadow.
Set mask mode to Subtract.
Leow Wee Kheng (CS5245) Digital Compositing 61 / 67
Rig Removal
Oval shaped mask may not work in general.
May mask out part of foreground element.
Need to manually set the mask shape.
Rotoscoping: manually set outline of mask, matte, or foreground.
Leow Wee Kheng (CS5245) Digital Compositing 63 / 67
Rig Removal
3. Animate Mask
Move mask to cover rig in subsequent frames.
Make large mask to minimize the number of keyframes that needrotoscoping.
Leow Wee Kheng (CS5245) Digital Compositing 64 / 67
Summary
Summary
Further readings and exercises:
Other miscellaneous topics in compositing [Kel00].
Adobe After Effects CS4 User Guide [Aft].
Keylight User Guide [Key].
Do the tutorials in Keylight User Guide.Download test images from The Foundary [Fou].
Leow Wee Kheng (CS5245) Digital Compositing 66 / 67