Adobe After Effects Keylight
As a designer who has recently started working in augmented reality (AR), I regularly turn to the skills, tactics, and tools I relied on as a designer for 2D screens and experiences. In school, I really enjoyed using After Effects and set a professional goal to use the tool for work as much as possible. So my heart jumped when my boss turned to me earlier this week and asked “Do you know After Effects? The supports transparent video and gifs and I need your help creating some assets.” I’ve literally been waiting my entire design career to write this post!Adding transparent video and gifs to AR is a great way to prototype animations, direct user attention to design elements, and quickly annotate the world without occluding parts of the scene. Video brings warmth and character into your scenes and video without a bounding box feels like magic.
Image layers from our featured animation are separated into AR planes. Magic, right?Creating transparent videos from green screen footage sounds a lot more intimidating than it actually is.
If you have After Effects and a video with a beautiful green background, you’re only a few clicks away from a transparent video. Just like me, you’ll be impressing your boss in no time. Start with your green screen videoOpen up your green screen footage in After Effects and find the Keylight effect in the “effects and presets” menu on the right.
Make sure the layer with the footage is selected and double-click the Key Light effect. Use the KeyLight effect to turn green screen footage into AR-ready, transparent videoJust adding this effect won’t do anything, but if we use the eyedropper labeled “screen color” we can tell the script that our screen is green and it should change anything that’s green to transparent. This would be true for any color you select.
If you selected yellow, all the yellow would go transparent.Remember, this tool grabs all the pixels that are very close to your selected color, which means if you have shadows or highlights they might get overlooked – lighting is key for all video projects. This also means you should never wear green shirts in front of a green screen unless you’re going for that disembodied head look..
With a few quick clicks, the Keylight effect removes the selected background color from your video. Clean up the shot with screen gainAs you can see, removing the green background can sometimes leave behind some fuzzy artifacts.
To eliminate this blur surrounding the non-green figures in our shots we use “screen gain.” Simply increasing the screen gain a little can solve most flaws. To note: screen gain adjusts the continuum of color that is omitted from your shot. Increasing the gain removes more shades, but if you turn the screen gain down you will see more green shades that no longer make the cut. Render your video with an alpha channel – that's where transparency happens.Once your video has rendered, it’s now ready to add to your AR experience. If you’re building your experience in, you can easily import the video into your project through any attached cloud service like Google Drive or iCloud. You can also save your videos to your camera roll and import them straight into the project.There you go, superstar!
You’ve made a helpful transparent video for an augmented reality experience and you’ve impressed your boss with how deftly you handled that last minute request.If you made your immersive project with Torch AR, share it with us by posting to social media with the tag #builtwithtorch – we’d love to see and share your augmented reality creations.
Keying in After EffectsThe best way to create transparent video for use in Flash projects is with Adobe After Effects. There are two reasons for this: First, After Effects offers advanced tools for masking, keying, and compositing. Second, you can easily access technology for converting video layers into Flash Video files with embedded alpha channels. Let’s explore the process with three sample compositions.
Using KeylightIncluded with After Effects is a powerful chroma key plug-in called Keylight. The technology used in Keylight uses a core algorithm written by the Computer Film Company. This technology has been used on numerous feature films including Harry Potter, Mission Impossible, and Sweeney Todd. Keylight has won the Academy Award for Technical Excellence and is a one-stop-shop for keying, despill, and color correction.When you apply Keylight to a footage layer, you choose a color to key out. The effect then performs two tasks. First, it erases all the pixels that match the color.
Second, it removes that color spill from other pixels. So if you select green, it will remove the backdrop and greatly reduce any green reflections on the foreground. Keylight is relatively easy to use (once you understand its options). It is also quite adept at properly keying reflections, semitransparent areas, and hair.
Getting startedThe Keylight plug-in can be a bit intimidating because it has nearly 60 parameters. The good news is that there are only a few main controls and the rest are just used for fine-tuning. Let’s start with some basic material that needs to be keyed. Copy the Chapter04 Project Files folder from the DVD to a local hard drive.
Open the file Chapter04.aep from the Chapter04 Project Files folder. This project file contains all the elements you will use for this chapter. In the Project panel, double-click the composition 01KeyingStart to load it. Four clips are loaded into a Timeline. This composition uses non-square pixels, which will not work well in Flash. So, you’ll need to modify the composition’s settings.Choose Composition Composition Settings. From the Preset list choose HDV/HDTV 720 29.97 to switch to a square Pixel Aspect Ratio.
![Keylight Keylight](https://i1.creativecow.net/u/302485/keylightgungrainy.png)
After Effects changes the composition size and automatically adjusts the clips to display properly. Move the Current Time Indicator to the start of the composition by pressing the Home key. You are now ready to start the keying process.Pulling an initial keyKeying is often a multistep process.
You will find yourself finessing and refining to get the best results. However, the most dramatic change starts with a single click. When using Keylight, you’ll first choose the Screen Colour you’d like to remove (yes, the plug-in is British). The Screen Colour is the color you want removed from the background that Keylight will also despill from the rest of the scene.Click the eyedropper next to Screen Colour to activate the selection eyedropper. Click just over the shoulder of the subject.
You want to click close to the person to remove the green areas closest to the subject. At first glance, the key looks “perfect.” But it’s not. Close examination will reveal that the image has extra transparency and some spill that needs to be corrected.Click the drop-down menu next to View and switch to Screen Matte.
This lets you see the grayscale matte that Keylight uses to create transparency.The matte indicates transparent areas with black, opaque areas with white, and partially transparent areas with gray. Close examination of the matte indicates that the background has not been completely removed and that the shirt is showing undesirable amounts of transparency. Increase the Screen Gain parameter until the background is a clean black plate.
For this first shot, a value of 110.0 works well. Some users alternately use the Clip Black slider discussed in the next section for similar results. Change the Screen Pre-blur to a value of 1.0 to slightly soften the edges of the generated matte. Avoid using a high value or halos will occur.Cleaning up the matteFor a believable key, it’s best to have some gray pixels around the edge of the subject (so hairs and other semitransparent elements can blend into the background). However, the background should be solid black, and the foreground should be solid white.
Adobe After Effects Keylight
Currently, the background is in good shape, but the foreground could use some work.Click the disclosure triangle next to Screen Matte to reveal several controls that you can use to fix matte problems.Use one or more of the following sliders to refine the mask:. Clip Black. Makes the blacks in the matte darker. Clip White. Makes the white areas in the matte whiter. Be careful with the Clip Black and Clip White controls so you don’t overdo it and ruin the edges of your foreground. Clip Rollback.
Allows you to undo clipping and bring the edges back. Screen Shrink/Grow. Contracts or expands the matte. Screen Softness. Softens the generated matte. Screen Despot White.
Removes white specks that are inside a generally black background. Screen Despot Black.
Removes black specks that are inside a generally white foreground. Tip: Gently Scrub Your KeysWhen adjusting properties in Keylight, you need a gentle hand.
Go even slightly too far and you’ll produce poor results. When using sliders, try holding down the Command (Ctrl) key to scrub any property value in tiny, subtle increments. Adjust the Clip Rollback to 5.0 to restore edge detail and set the Screen Softness to 1.0 to remove fringe at the edges. Adjust Screen Despot Black to 5.0. You may need to resize the Effect Controls panel to see the full name. Click in the area between the Effect Controls panel and the Composition panel, and then drag to resize.Click the View drop-down menu and choose Final Result to see your keyed footage.
Tip: Toggle ViewsAs you make adjustments to your key, you should toggle back and forth between Screen Matte view and Final Result view. This makes it easier to check your progress. Your end goal, as you view the Screen Matte, should be to have an all black background and an all white foreground with a little bit of gray around its edges. Wispy elements, like hair, should be gray.Correcting colorAfter you’ve keyed the background, you’ll usually need to adjust the foreground colors so they properly match the colors of your new background.
Fortunately, Keylight offers two sets of controls to fix these issues.Foreground Colour Correction. Affects the majority of the person or object left behind after Keylight has removed the background.Edge Colour Correction. Modifies a thin band of pixels running around the person or object. This is where the majority of color spill occurs from the background reflected on the subject and is a critical area to tweak when you are trying to make a believable composite. From the Project panel, drag the file Rooftop.tif to the bottommost position in your active composition.
You’ll use this outdoor scene to adjust the colors of the footage to match. Reselect the top layer and in the Effect Controls panel, click the disclosure triangle next to Foreground Colour Correction. Select the Enable Colour Correction check box.
Increase the Saturation slider to 115 to boost the color in the foreground. Adjust the Contrast and Brightness to match the foreground subject to the background plate.
For this image, try a Contrast setting of 4.0 and a Brightness setting of –5.0. Click the disclosure triangle next to the Colour Balance Wheel. This allows you to adjust the white balance of the image and tint the foreground to better match the color temperature of the background.Slowly drag the x of the wheel to the left. Experiment with different positions until the color matches well. Tip: Controlling EdgesTo adjust how thick of a band Keylight treats as an edge, examine the Edge Colour Correction view. You can then adjust the Edge Grow parameter.
Click the disclosure triangle next to Edge Colour Correction. Select the Enable Edge Colour Correction check box. Set Edge Grow to 10.0, Saturation to 80.0, and Brightness to -10.0 to reduce the richness of color at the edges (the results will be subtle). Set Edge Colour Suppression to Suppress Green.Open the Colour Balancing area and set Saturation to -2.0 to further remove color from the edges.
The bottom edge is fixed, and the composition of the shot looks good. Close examination reveals a black edge along the top of the frame. In the Effect Controls panel, scroll to the bottom to see all the controls.
Click the disclosure triangle next to Source Crops. Change the X Method and Y Method to Repeat the Edge Color. This removes most of the fringe.Change the Top crop to 99.0. The edge is fairly clean, but a small color shift exists because the top corner of the matte has a little hot spot left. Your key is now complete.
Three more shots are in the current Timeline with which you can practice. Each offers slightly different challenges including wispy hair and color spill. Use the techniques you’ve learned so far and practice keying these additional shots. When you are ready, continue with the lesson. Using MasksSometimes you’ll need to combine masks to improve the quality of your keys in After Effects. This might be because the chroma key background is not big enough to fill the frame or because you have color spill or reflections. Let’s try keying a shot that needs a little extra work.
Adding a garbage matteSometimes areas of footage just need to be cropped before you even start the keying process. This is generally referred to as using a garbage matte and allows for areas to be masked. In the Project panel, double-click the composition 02MaskingStart to load it. This composition contains one HD clip and is set to use square pixels. Notice that the background does not fill the entire screen. Select the layer CameraMan.mov in the Timeline.Double-click the Rectangle tool in the toolbar to add a rectangular mask to the footage.
A new rectangular mask is added to the footage layer, and the Timeline expands to show Mask 1. Tip: Getting the Best KeyWhen using Keylight, be sure your layers are set to Best Quality. You’ll also want to set the Composition panel to 100% magnification and full quality. This is the only way to accurately judge the results of your keying.Limiting the key with a maskKeylight will sometimes remove more from the footage than you want. In this particular shot, you’ll notice that the lens of the camera is reflecting green (which lenses naturally do even when they are not placed near a green screen).
This is causing the camera to show partial transparency. Fortunately, a mask can also be used here to limit Keylight’s reach.Make sure layer 1 is selected and that Keylight’s controls have View set to Final Result. Closely examine the camera lens to see the unwanted transparency. Move the Current Time Indicator to 2:00 and repeat the mask move and sizing. Repeat the mask movement and positioning every second in the Timeline.
You should now have a keyframe for the Mask Path at each second in the Timeline. Now check to see if more keyframes are needed.Press the Home key to return to the start of the composition and press the spacebar to watch the footage play slowly. Watch closely to see where the mask needs additional keyframes to ensure the lens reflection is covered.
Check the effect by clicking the RAM Preview button in the Preview panel. Make sure the Resolution is set to Full Quality to properly judge the accuracy of the key and mask.Exporting with transparency to FlashNow that the footage layer is properly keyed, it is ready to export to Flash. While Flash supports three different codecs for video (Spark, On2, and H.264), only On2 VP6 supports the use of an alpha channel. Fortunately, After Effects makes this an easy export.The video you want to export has lots of empty space, so you can nest this to create a smaller frame size.In the Project panel, select the composition 02MaskingEnd. Drag the composition onto the Create a New Composition button at the bottom of the Project panel.
This creates a new composition that nests the original inside of it and also matches the size and duration of the original. Double-click the new composition called 02MaskingEnd 2 to open it. Choose Composition Composition Settings to modify the file. In the Composition Settings dialog, rename the composition Camera Man with Alpha. From the Preset list choose Custom. You will make a smaller-sized composition to size the video for Web use. Enter a Width of 250 pixels and a Height of 340 pixels.
Be sure the Pixel Aspect Ratio is set to Square Pixels. Click OK to change the composition settings. When you reduce the frame size the resulting video file will load faster. Select layer 1 in the Timeline. Press P for position.
After Effects Adobe Download
Hold down the Shift key and press S for scale. Change the Scale to 50% for both the width and height.Drag the position slider to position the video within the new comp. A value of 217.0 and 175.0 should work well.
![Keylight Keylight](https://i1.creativecow.net/u/244774/screenshot2012-10-11at1.00.43pm.png)
In the Preview panel, click the RAM Preview button to review your animation. Watch the animation through to make sure the video is not cropped at any point. Choose Composition Add to Render Queue. The Render Queue controls how animations are processed and written to disk. Click the Best Settings text next to Render Settings to customize Output.Because the output of Flash Video is intended for Web use, you can specify a lower frame rate. Select Use this frame rate and set its value to 15.
Tip: Background CheckWhen keying, it can be difficult to judge the quality of a key. One technique is to put a brightly colored solid behind the keyed footage (Layer New Solid). Make the solid color a different color from the original screen color. For example, if the original image was shot against a green screen, try laying it over a red solid. Be sure to check the key by moving the CTI to check the key at a few points in time. From the Preset list choose FLV – Same as Source (Flash 8 and Higher) to match the output size to the composition size. Deselect the Export Audio check box because there is no audio for this composition.
Choose the On2 VP6 codec. In the Basic Video Settings area, select the Encode Alpha Channel check box to include transparency with the exported file. In the Advanced Settings area click the Quality list and choose Best for the highest quality (yet slowest) encode. Lower the data rate to 1000 kbps in the bitrate settings section. And then click OK to store the Format Options. Click OK to store the Output Module Settings.
Click the filename next to Output To and specify the Chapter04 Project Files folder that you copied at the start of the lesson. In the Render Queue click Render to create the file. The resulting file is now ready to use in a Flash project. The transparency is embedded into the file.Using Transparent Video in FlashOnce your Flash video file is rendered, you can import it into Flash.
The import process is quite simple as it is treated like any other footage item. You’ll learn more about Flash video options in Chapter 12, “Professional Encoding of Flash Video.”.
Launch Flash Professional. In the Welcome screen, click the Flash File (ActionScript 3.0).In the Properties panel, click the Edit button.
![Keylight Keylight](https://media.phpnuke.org/000/975/772/2ef_b74_580_580-adobe-after-effects-4.jpg)
Set the document to 400 px × 400 px at 30 fps and click OK. Position the video on the Stage using the Selection tool.
Select the bottom layer in the Timeline. Move the playhead to frame 300. Right-click in the Timeline and choose Insert Frame to extend the background layer. Choose File Publish Preview Default to test the file. Close Flash (there is no need to save your test file).Additional PracticeIf you’d like some additional keying practice, we’ve included one more task. You can open the file 03CompositeStart to use the techniques you’ve learned so far as well as to experiment with new techniques.
Gain confidence by exploring the footage and composition. You can compare your progress with the composition 03CompositeEnd. Size the composition using a smaller size (640 × 360).
Use square pixels for output to Flash. Perform a clean key of the TVShot.mov layer.
Composite the ScreenContent.mov layer below the television. Use Position and Scale properties to resize and accurately place the layer in the right position. Use the Fast Blur effect to defocus the ScreenContent.mov layer.
Export the composition as a layered file for Flash by choosing File Export Adobe Flash Professional (XFL). Import the XFL file into Flash Professional and explore the layered file.