Advertisement
  1. Photo & Video
  2. Post-Processing
Photography

Sky Replacement of Complex Subjects

by
Difficulty:IntermediateLength:MediumLanguages:

If you've looked into this topic before, you've probably noticed that the majority of sky replacement tutorials limit themselves to hard-edged subjects like buildings, to make the masking process easier. To me, this is of fairly limited use and should be pretty easy to do without help anyway. What if you want to replace the sky of a more complex scene? In this tutorial, I'm going to take a nice sunny stand of trees and composite it over a cold, moody sky.

This would normally be a very challenging task, but I've come up with a workflow that should make it relatively straightforward for confident Photoshop users. If you're a Photoshop beginner, following along very carefully should give you a result better than expected and introduce you to some of the most useful masking tools available in Photoshop. Let's get started!


1. Open Your Subject

First, we're going to take our subject image and open it. I'm opening it as a Smart Object in case I need to go back and edit the RAW data later for some reason, but this isn't strictly necessary.

Duplicate your background layer and rasterise it if it's a Smart Object. At this point you should probably turn off your original background layer for convenience.

Our starting image. Fairly dull, really.

Our starting image. Fairly dull, really.

2. The Background Eraser

Yes, it's a real tool! Click and hold on the Eraser Tool in the tools palette, and a little menu should pop up with three options. Click on the Background Eraser in the middle.

One of Photoshop's many hidden gems.

One of Photoshop's many hidden gems.

Alt-click on an average colour from within your foreground. This may require a few clicks to get one you feel is accurate. The foliage colour I ended up using was this:

Direct sun like this makes all foliage a lime colour...

Direct sun like this makes all foliage a lime colour.

Ensure the Protect Foreground Tones box in the top toolbar is checked, and that the Limits are set to Discontiguous because the tree branches break up the continuity of the sky.

The more significant the difference is between your foreground and background, the higher you can set the Tolerance. I'm only using about 25%, but the difference between the yellow-green and the blue is probably strong enough in this image to go as high as 40-50%. This would result in cleaner edges with less edge artifacts, but I wanted to show more cleanup methods later on, so I'm not removing as much right now.

You can see the start of the erasing process. Really very straightforward.

You can see the start of the erasing process. Really very straightforward.

Now click around the edges of your subject, and in between gaps. Make sure that the little crosshair at the centre of the eraser brush is only on the areas of sky colour that you want to remove. You can click and drag across larger expanses of sky, as long as you don't let the crosshair touch the foliage.

Ta-da!

Ta-da!

3. Finish Erasing

Now to make sure that we're not missing anything. Duplicate the layer and then hit Ctrl-E to merge it back down into itself. This will make areas the Background Eraser missed less transparent so you can manually erase them. In our case, the Background Eraser won't completely get rid of clouds because they aren't blue like the sky.. Use the normal Eraser to delete any obvious areas of old sky.

If I wasn't tutorialising this, I have used a higher Tolerance value to eliminate this kind of thing.

A higher Tolerance value may have eliminated this kind of thing.

4) Bring on the Sky!

Now it's time to bring in the background layer, so grab your sky and drop it in.

Oooh, moody.

Oooh, moody.

When you put it below your subject layer, all sorts of horrible artifacts should show up around your foreground, so we're going to deal with those next.

Gross blue halos!

Gross blue halos!

The first place to go is Select > Select Color and click on an area of remaining sky. This should pick up any blobs of sky the two erasers missed, and a substantial amount of the halos around the foliage.

Go to Select > Modify > Feather (Or hit Shift-F6) and feather the selection by about 0.5px so we're not left with an ugly hard edge. Now hit delete.

No gross blue halos! (Well, less of it, anyway)

No gross blue halos! (Well, less of it, anyway)

5. Refining

Ctrl-click on the thumbnail of your working layer to load what remains as a selection. Apply this selection as a layer mask. This allows us to do the next two steps.

First, Right-click on the layer mask and hit Refine Mask. After playing with the settings a little, you should have lots of subject, but almost no blue halo remaining. If you're not familiar with this tool, check out this quick tip I wrote about the Refine Edge feature.

Now we're cooking!

Now we're cooking! These are my Refine Mask settings.

Carefully brush in your regions of transition, and remember you don't need to use as large a radius as you would with Refine Edge because the mask is quite accurate to begin with. It's not a rough selection.


6. Replace Foliage Detail

The Refine Mask improved the image a lot, but it looks like it has removed detail in some of the outer areas of subject. So now take a small, soft, 100% opacity white brush and click around on these edge areas to add the detail back in.

This is why we're alternating back and forth between erasing and masks.

This is why we're alternating back and forth between erasing and masks.

It looks better if you're fairly random, just don't be too loose and click right near the edges, or you'll pull those blue halos back in.


7. Defringe

When you zoomed in for step six, you may have noticed that there's a very fine line around your foreground layer. This is easily removed. Duplicate your layer and apply the mask. Then go to Layer > Matting > Defringe. I used a value of 2px, because that's about how thick my line looked. It shouldn't need to be very thick by this point.

Defringe can sometimes solve a very frustrating afternoon...

Defringe can sometimes save you from a very frustrating afternoon.

Defringe can create some strange blocky artifacts in areas of high detail if your mask isn't already very good, hence why it's the last step of the masking.

If you want, you can Ctrl-click and select this layer thumbnail and apply it as a mask to your original Smart Object for the final stage.


8) Colour Correction

Now we have a solid mask, it's time to make the tones and colours of the two plates match. This is likely going to be a compromise between foregrounds and backgrounds when working with two as disparate as these. This process will depend on whatever subject and background images you're using, so I'm going to go over what I did as an example that can be adjusted to your needs.

First, I'm going to mainly do the tones, because I find it easier to work in this order.

I need to cool and darken the outer areas of the foliage for it to blend into the new sky. I created a Curves Adjustment Layer above the subject, and made it a Clipping Layer of the subject layer by Alt-clicking between the two. This exclusively applies it to the subject layer.

I boosted the blues very slightly, dropped the reds a little, and darkened the whole thing quite a lot. This gives us a deeper, cool-green foliage which matches the sky better.

If the foliage is supposed to be lit by the new sky (even allowing for post-storm sun breaks), the foliage should be cooler and darker.

If the foliage is supposed to be lit by the new sky (even allowing for post-storm sun breaks), the foliage should be cooler and darker.

I then hit Ctrl+I to invert the mask. With a good size soft brush at 20% opacity, I brushed in the edges of the subject around the transition zones, allowing the effect to blend softly into the main foliage.

Not very noticeable, except for the color difference against the sky. Keep it subtle.

Not very noticeable, except for the color difference against the sky. Keep it subtle.

9. Sky Tones

Then I hit the sky with the same effect, but now I'm selectively brightened it around the transition zones. Thus the tones of the foreground and background meet in the middle of where they were at. I created a Curves layer with a strong brightening effect:

I'm using quite a lot of brightening here.

I'm using quite a lot of brightening here.

Then I inverted the mask, enlarged the brush a little, and brushed in somewhat randomly, trying to keep the sky looking as natural as possible. I didn't want a big bright glow around the foliage.

Make the sky plausible, not just a line around the edges of your subject. Note the "random" directionality in the mask thumbnail.

Make the sky plausible, not just a line around the edges of your subject. Note the "random" directionality in the mask thumbnail.

10. Colour Matching

Once the two areas are fairly well matched up tonally (you could always check this with a temporary Black and White Adjustment Layer), it's time to hit the colours.

First, I created a second Clipping Adjustment Layer for the sky, and mildly split-toned it. I increased the reds very slightly, then boosted the blue shadows very slightly, but dropped the blue midtones and highlights a reasonable amount:

A bit of colour correction on the sky.

A bit of colour correction on the sky. The slight yellow-green tinge to it makes it seem even more ominous, even though it's lighter in tone.

The foliage didn't need as much work done to it, so I just added a Hue/Saturation Adjustment Layer so I can desaturate and darken the yellows while moving them a little more towards green. The sunlight on the trees is too strong to look natural against the sky (even though this juxtaposition happens quite a lot in reality). I adjusted the yellow hue to diminish the effect.

Adjusting the yellow in the foliage even further to match.

Adjusting the yellow in the foliage even further to match. I'd call that pretty close at this point!

And There You Have It!

If I was taking this image all the way, I would use frequency separation on the grassy area to soften up those shadows, and colour balance the entire image as a whole now that the two plates are matched to each other (just like white balancing strobes gelled to ambient, really).

As it is, I think the result is surprisingly solid given the relative enormity of the task.

Before and after. It is doable!

Before and after. It is doable!

A quick word of warning. Shoot with the best lens you have. I tried to do this from a beautiful old 24mm f/2 I have which shoots wonderful images, but it has terrible chromatic aberration and the blue/orange edge glow was crazy. So, I reshot with a modern lens. This is actually part of the reason I said to use Smart Objects. If you discover anything in your image that's going to ruin the masking, you can just double-click the thumbnail to take it back into ACR (which can of course remove noise, vignetting, aberration, distortion, etc).

I've covered a number of Photoshop's handy masking tools here like the Background Eraser, Select Color, Refine Edge/Mask, and Defringe. They're all extremely useful in different ways, so I encourage you to integrate them into your workflow. They should make life much easier!

As ever, questions? Comments? Hit up the comments below!

Advertisement
Advertisement
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.