How to Make a Realistic Waving Flag in After Effects

After Effects 30/10/2019 3 min read

Today we’re gonna go over how to make a flag look like it’s waving in After Effects. This technique is quick but the results are really nice. You can see the flag has some shadows and warping to make it really look like it’s waving. So let’s dive into After Effects and take a look at how to make this effect happen!

Alright, let’s get started. I’m gonna make a new composition and then bring in my flag image. Now I need to bring in some footage. I’ve got this clip of some flowing cloth from Motion array that I’m gonna use. It’s important to have high quality footage for this technique as this is what drives the effect. 

 

So with my footage in my composition I’m gonna scale it down to fit my composition size. One way I can do this is to right click on the layer and go to Transform > Fit to Comp. This perfectly scales my layer to the exact dimensions of the composition. Now I’m going to precompose the footage. This way if I ever use multiple instances of the footage (which spoiler alert: I will) I only need to make edits to the precomp, rather than all the duplicates. I’m gonna select the option “Move all attributes into the new composition”and click “OK”. I’m also gonna go ahead and turn this layer off as I don’t need to see it anymore. 

Now I’m ready to apply some distortion to the flag image. To do this I’m going to go to Effect > Distort > Displacement Map. The default settings aren’t what I’m looking for so I need to make some changes. The first thing I’m gonna do is change the “Displacement Map Layer” to my footage precomp so that it’s looking at the footage to drive the displacement. Then I’m gonna change the channels the effect is using for horizontal and vertical displacement to “Luminance”. With Luminance, After Effects is looking at the brightness of the layer. Where the layer’s dark, there won’t be much distortion, and where it’s light, there will be a lot. Now, when I preview, you can see I’m starting to get closer to what I’m looking for. 

I’m going to bump my max displacement up to 10 for both horizontal and vertical to help push the effect. One thing I’m noticing is that I’m getting some weird tiny distortions in my flag. That’s got something to do with my footage so I’m gonna go into my pre comp and check it out. 

In the footage I can see there are these tiny little blocks that are reflecting light and that’s what’s causing the weird distortions. To fix that I’m going to add a blur to smooth things out. I’ll go to Effects > Blur > Gaussian Blur. Now I’ll just crank up the blurriness until things smooth out. I’m also going to check “Repeat Edge Pixels” to get rid of the fade at the edges. While I’m in here I’m going to make a few more edits to the footage to help out my effect. First I’m going to crush the levels to add contrast which will in turn make my displacement more pronounced. I’ll do this with Effects > Color Correction > Levels. Then I’ll just bring in my black and white values. I’m also going to speed up my footage since the wave is pretty slow right now. By toggling the brackets at the bottom left of my timeline I expand out some options for In, Out, Duration, and Stretch. I’m going to take my stretch percentage and drop it to 50%. That will make my footage twice as fast. I’m going to call that good and go back out to my main comp. 

I think the flag’s almost there but what’s missing are some shadows on the flag to really sell that waving effect. To add those in I’m going to duplicate the pre comp. Good thing I precomped that footage, right? Then I’m going to drag it above my flag layer, set it to Multiply, and then turn it’s visibility on. The shadows are too dark for me, so I’ll drop my opacity to 50%. Now I just need to matte the shadows to the flag. So I’ll duplicate my flag and drag it above the shadows. Then I’ll change the shadow’s track matte to Alpha Matte so the shadows only appear where the flag is. And there you have it, a waving flag! 

Well that concludes this tutorial. I hope you guys found it helpful.  If you did, we’ve got lots of other tutorials for Premiere Pro, After Effects, and filmmaking in general!   If you’re doing an interview any time soon, you might need to make some lower thirds, so check out this video we did all about that.  And if you didn’t want to make your own, we have awesome lower thirds templates that you can look through.