Page 1 of 1

problems with masking greys

PostPosted: 03/19/2016, 8:54 pm
by gunnahafta

I'm still new to AE and trying out things. I want to do a sky replacement and tried many of the tutorials but they all assume blown out sky. I want to replace a dark grey sky and the usual ways don't seem to cut it. I tried a mask but the results aren't great because of trees\leave and harsh lines. I tried a key type method but too much grey in the rest of the movie. Please help.

Re: problems with masking greys

PostPosted: 03/20/2016, 12:23 pm
by JPT7505
You'd have to try a combo of keying and masking to get it to work and you may need to do this several times and seperate portions of the scene and tackle them one at a time.

Re: problems with masking greys

PostPosted: 03/20/2016, 6:53 pm
by gregalan
Hi gunnhafta. As JPT wisely says you may need to do small sections at a time but, depending on what sky you are replacing it with, it could be simpler - be aware that if you are replacing it with a darker sky you will inevitably end up with grey fringes around the fine details which will require extremely detailed work (and normally having to lose a lot of the detail).

However you might be able to:
Create two masks so that you end up with a sliver of the roof/tree line;

garbage masks .jpg

With the masks set to Subtract add the Brightness and Contrast effect (my example has Contrast at 71). You want to create a strong black and white image - no greys - but at the same time losing as little detail as you can.

b&w matte.jpg

Then add a copy of your footage underneath and copy the sky mask onto this layer. In its TrkMat box set it to Luma Inverted and set the mask's Mask Expansion to 2.
You should end up with this:


Anyway it should give you a starting point.

Re: problems with masking greys

PostPosted: 03/21/2016, 5:22 am
by plae57
Tools like Keylight and primatte, and other similar tools are great tools but when they don't work you need to know how to create mattes both manually and procedurally, and how to take advantage of other keying/masking techniques.

Three of the common mistakes when dealing with keys and mattes are:

Not using different color channels to create a procedural matte
Not using multiple mattes (of all types including roto) to create the "master matte"
not using tracking to assist in roto work

This book: ... lpage_o07_ Is a great resource for all things VFX. It is not an After Effects book, but a lot of examples are shows in After Effects. One of the early chapters is how to create a key manually. He provides multiple examples for manually creating a key using common tools found in every compositor.

I got a good sky replacement key using the green color channel, crushing the levels, and masking out the center of the building.


Good luck and have fun!

Re: problems with masking greys

PostPosted: 03/21/2016, 5:27 am
by gunnahafta
Thanks Greg. I gave it a quick try and didn't quiet get the result you showed.

Couple of questions:

I see on your sample images the two mask outlines but the areas you have masked are still showing. When I do my first mask and close the loop I only see what's inside the the mask. How do I get it it show all the mask outlines but not hide anything? I expect it is just a toggle switch somewhere.

I then set them to subtract and I see the black areas and just the tree and roof line. I apply the brightness contract filter to the layer but it doesn't seem to have an affect and it doesn't go black and white.

Re: problems with masking greys

PostPosted: 03/21/2016, 5:36 am
by gunnahafta
Thanks plae57.

Your matte looks good but I'm sorry to say I'm lost in your explanation of how you did it. Any chance of a few steps to help me try and figure it out?


Re: problems with masking greys

PostPosted: 03/21/2016, 6:26 am
by plae57
These videos:


Demonstrates using color channels to get a key. The first one shows you with Photoshop, but the process is the same in After Effects

Re: problems with masking greys

PostPosted: 03/21/2016, 3:52 pm
by gregalan
Hi. In the first image I set the masks to None (in the dropdown that has Add, Subtract etc.), it was only done for demonstration purposes so that you could see the idea. I'm not sure why the Brightness and Contrast effect isn't working, it should - have you set the contrast to 71?

Re: problems with masking greys

PostPosted: 03/22/2016, 8:52 pm
by gunnahafta
Thanks Greglan i gave it a go. Mixed results not sure what im missing but apprecate the help. If you happen to have the project file still could i get a copy?

Re: problems with masking greys

PostPosted: 03/23/2016, 4:33 pm
by gregalan
No problem- you'll have to re-link to your background.jpg.

Sky Replacement Sample.aep
Version CS6
(77.12 KiB) Downloaded 331 times