Sky replacements are extremely common in feature films and TV shows. If done well, most viewers won’t notice these invisible effects. Chances are your favorite modern Western didn’t have a huge sky full of fluffy cumulonimbus clouds, or that romantic scene from your favorite guilty-pleasure flick didn’t have the moody sky it appeared to have. We have to add all of this in post.
There are many techniques to replace skies and backgrounds, and most editing applications include some form of motion tracking and keying. For this example, I’ll be using Adobe After Effects and plug-ins from Boris FX: Primatte Studio to pull a key for the sky, and Mocha Pro’s planar track to accurately match the scene’s movement.
To begin, we selected the clip below of a girl and her horse against a pale blue sky. Start by importing your footage clip into After Effects. We’re going to import a replacement sky image into the project, as well.
Don’t worry about this sky being a static file because we’re going to use planar motion tracking to match the background and follow the camera movement. We’ll also use a “3D offset” technique to push our replacement sky back into Z space.
The first thing to do is name this “original plate,” then duplicate this plate to pull a key.
Keying the Sky
Apply “Primatte Studio” from the effects menu and drag and drop it right onto your timeline. If you don’t have a license for Boris Continuum plug-ins, feel free to try a different keyer or download a trial here.
Now we’ll activate our heads-up display by clicking the “HUD” button.
What I like about Primatte Studio is that it’s very visual. You can either use a point to select or you can use a rectangle to grab a larger area. You can also use clean backgrounds for pulling more color into your key.
Even though we have uneven color values in the sky, you can still pull a decent key from the color range. Use “clean foreground” to clean up the edge of the horse so that you don’t lose your light wrapping.
Use the Final Matte dropdown view to make sure that your composite matte looks good. You can add an edge correction and a little softness to the edge of your matte by using “hybrid enable.”
In just a few clicks, you’ll have a pretty robust key.
I’m not going to worry too much about the softer detail toward the bottom of the shot or the sunlight, because I actually want to keep this lens flare in the middle of the sky. I’ll use a Mocha roto-mask to keep this detail. You’ll also want to change your BG color to get rid of some of that darkness that we had.
Tracking the Motion
Navigate to Mocha Pro in your Effects Panel and drag and drop that onto your sky background layer. You will need to launch Mocha Pro using the large Mocha button.
Note: if you don’t have Mocha Pro, a light version of Mocha is included free with Adobe After Effects Creative Cloud. To launch it, select a layer and go to Animation > Track in Mocha AE).
Now it’s time to track the background. Mocha excels at tracking difficult areas like this out-of-focus tree in the background. I’ll track “translation, scale and rotation” only. You want to track an area that is never obscured by the foreground.
Once tracked, save Mocha and close it. In the Module Renders section, select the sky JPEG layer as your Insert Layer.
Now when you relaunch Mocha Pro, you can click on your layer and then click your “Insert Clip” dropdown menu. If I select my insert layer, we now see the new sky will follow the tracked motion.
The “Align Surface” button will scale the surface tool to the edges of your shot.
Next, go into Mocha’s Insert Module and apply a 3D offset to this track. We’re going to apply a depth offset, and that changes the scale of your object, so we’re going to increase the scale. This is actually just a quick way to push the new sky replacement layer further into the distance, for a more natural motion in relation to the foreground.
Save Mocha and close it. Inside the plug-in, select “Insert Cutout,” then check the render checkbox.
Refining the Composite
Now you can composite the sun and flare back into the shot. Duplicate the insert sky plate, then apply Mocha Pro, but turn off your insert render.
Next, draw a shape around the sun and flare. We’re going to link the sun shape to the sky replacement track.
Export your Mocha roto mask as “Mocha Shape Data for AE.”
Back in AE, select Edit > Paste Mocha Mask.
You can feather this shape if you like, and this will composite the sun and flare right back into your shot.
So here’s a still of our before:
And here’s our after:
While this might seem like a lot of steps, it’s all about the details. Mastering the basics of chroma keying, motion tracking, and masking will give you limitless ability to transform your footage or replace backgrounds to your creative heart’s content. Tools like Primatte Studio and Mocha Pro are designed to save you time and make some of these visual-effect complexities simpler and more efficient.