A 3-Part Exploration Of A Powerful After Effects Filter
by Brian Maffitt, MAFF/x Inc. & Total AE

What's this all about?

First of all, the Gradient Wipe filter is part of After Effects. All of the techniques in this tutorial depend on the use of this program.

Many After Effects users have posted questions online regarding tricky animation needs--needs that were easily addressed with the use of this filter. Recently someone needed to animate pulses of light traveling along a winding roadway. The request drew a wide range of responses, many of them functional suggestions, but none of them easy to execute; it became clear that not many people understood the potential of the Gradient Wipe effect, for it offers the simplest solution to this particular problem.

I threw the following animation together in about half an hour. It consists of three Photoshop pict files, manipulated in AE using only the Gradient Wipe effect. All of the source files are included in this folder for reference.

gwch1p02.gif (8944 bytes)
Click to play me (164k .mov)

In this brief tutorial we'll examine the basics of the Gradient Wipe effect. I'll explain how it works, give some tips for creating effective gradients in Photoshop, show a few advanced animation techniques, and give you a step-by step walkthrough of the above sequence. I hope it sparks your imagination.

Gradient Wipe Basics
Or, "Yeah, Yeah, I Know all this Stuff, Right?"

Note: This chapter approaches the Gradient Wipe filter from ground zero. If you know the general theory behind its operation, you may want to skip to the next chapter. You will, of course, miss out on my prose, but suit yourself.

Briefly, the Gradient Wipe uses a grayscale file to generate an animated transition between two layers. The pixels of the destination layer replace the source layer according to the pixel value of the gradient layer. Got that?

All right, forget the words. It takes a thousand of them to describe a picture, so let's just look at some pictures. This is a visual medium, right?

 


Let's call this the "A" Layer


and this the "B" Layer


and this handsome fellow
we'll call "Mr. Gradient".

Using the Gradient Wipe filter, you can create a transition between the A Layer and the B Layer by using Mr. Gradient as the transition layer. All three of them need to be present in the comp for this to work.

Hint: The gradient layer need not be visible--in fact it probably shouldn't be. Although in most cases you can just hide it at the bottom of the stack of layers, there are cases when you don't want it hanging around mucking up your composition, like when you're animating a tranparent alpha. Click the layer's little "V" box in the timeline to turn off its video. This works for any filter that uses another layer as a source of information, such as the "Displacement Map" filter.

White pixels lead the transition, followed by successive shades of gray, and finishing up when the wipe reaches the black pixels. In the case of a simple ramp like Mr. Gradient here, you get a simple left-right wipe, thus:


Note that the transition has
a soft edge--this is adjustable
via the Gradient Wipe controls.

 

You can adjust the ease-in ease-out of this sort of linear transition by varying the midpoint of the gradient. If you're using Photoshop you can do this within the Gradient Tool Options palette:


Drag the slider like so.

Your gradients might now look like this:

 


The top midpoint's set to about 20%...
And on the bottom it's set to about 80%.

gwch2p07.gif (6966 bytes)
...and if you were to apply this
to layers A and B, your results
would look something like this.

 

Now of course you can use After Effects' Linear Wipe effect to do simple left-right transitions. And yes, you can use AE's ease-in ease-out keyframes to control the gradient wipe--but here's where things get interesting: in the example directly above us, a single pict contains two gradients, one above the other. This means you could have TWO wipes going on simultaneously -- one easing in and one easing out -- from the same layer, using ONE effect--Gradient Wipe.

To further illustrate, have a look at this file:


This started as a linear gradient,
followed by the Polar Coordinates
filter. This wipe would result
in a clockwise radial sweep.

Big whoop. AE already has a radial wipe effect, right? But add a gradient bar to the top of the file, thus:


...and something nifty happens.
Now you can radial-wipe an
image on in the bottom area
of the screen while simultaneously
wiping a title on left- right across the top.

 

Cool, eh? Are the idea lights beginning to go off yet? In the next chapter we'll look at some more advanced techniques and some good tricks for making gradient picts. Having fun yet?

Advanced Gradient Design
Or, "All Roads Lead to Photoshop"

The fun and power of this filter depend on creative gradient design. Photoshop and its many filters are an obvious choice for creating interesting grayscale files.

Take a look at this example:


This is a simple 45+ linear gradient...
except that for fun I applied
a Xaos Paint Alchemy filter to
it to simulate brush strokes...


...so now when I use it for a
transition, the wipe "paints"
itself on.

Paint Alchemy is terrific for generating "natural-looking" gradient effects--it simulates an infinite number of brush-stroke styles. It only works on color files, though, so you'll need to convert your grayscale gradient files to RGB to apply the effect and then back to grey again.

The KPT Gradient Designer tool is another very powerful member of the gradient arsenal. Its ability to do radial sweeps, a variety of bursts, and--most importantly--do cycles (black to white-back to black again , for example) make it the starting point of choice for most of my gradient work.

Look at this next wipe map:

What the heck is going on here?

Well--this is a Gradient Wipe map that simulates the "drafting" of the image below. These are the informational outlines of part of the "Rubino" font family, which is designed to look like a font-in-creation, complete with the "artist's" original source lines. In creating the above gradient the circular lines were all designed to wipe on with a circular sweep gradient, and the straight lines all wipe on straight.

gwch3p04.gif (6004 bytes)

Hint: In a multiple-gradient wipe like this, it's desireable to have some of the areas start or end on something other than pure white or black--this, in effect, adjusts the timing of the wipe so that all of the lines aren't drawing at the same time. This can look more "natural".

By animating these lines with the above wipe, then "sketching in" the font's outline and fill with the "brushy" gradient at the top of the chapter, I got a movie that looked like this:


Click on the above image to play the movie. (200k .mov)

See?

Obviously, there was a great deal of work involved here in designing the gradient--but it was much quicker to apply (and render) this technique than animating fifty different elements in After Effects.

There are literally-and I'm not exaggerating here--about eighty bazillion different ways of generating interesting gradients. One really nice tool is Adobe Illustrator: play with the blend tool and let your imagination go wild. Another is KPT's Gradients on Paths, which was recently rolled into the KPT Gradient Designer. This tool is a bit of a bear to use effectively but can be useful in certain situations. Or you can render gradients directly onto objects in a 3-D Program like ElectricImage, then composite some "running lights" or other moving patterns later in AE... the possibilities are endless.

The next chapter will be a specific step-by step approach to animating a gradient transition along a path-- and gets into the very powerful technique of layering offset gradient wipes to animate repeating pulses of light. Almost through! Hang in there!

The Roadway Pulse Project
Or, "How I Got Inspired at my 4th of July Cookout"

Some time ago somebody posted a problem on-line. I'll call the person "Greg" (although his real name is Doug and he works for Digital Knight Productions).

"Greg" had a client who wanted pulses of light travelling along a winding highway. Several suggestions were posted before I got to the question, and rather than throw in my two cents at the time I decided to give the idea some thought. In spite of the suggestions for hand-drawing mattes and carefully tweaking polygon wipes, I felt the easiest solution had to lie in the Gradient Wipe filter. But I had only used the filter to wipe on a line or an object; the trick was how to get the necessary pulses?

While I was cleaning my grill it hit me--if you can wipe something on, you can wipe it off. The key to the pulses is to use multiple, offset Gradient Wipes. The front of the pulse wipes on, gets a few frames into the animation, then immediately begins to wipe off. The two effects chase each other across the scene. Of course, the effect can be offset to include as many on-screen pulses as you want.

Here's how:

First of all, I created the source files. The base was a Corel Stock PhotoCD Image of a nice windy Monaco Road:

I used the pen tool to define the roadway path, then used that path to create the rest of the files. Once you've defined a pen path you can "stroke" it with any of the photoshop paint tools. I used the airbrush tool to create the eventually-pulsing glow. The result is a solid green photoshop file with the following alpha channel:

To create the most important image, the gradient blend, I again used the pen path as a source. This time, however, I stroked it with the paintbrush tool--and here's where some experimentation is called for. You have to find the best combination of several settings to achieve an optimum blend.

There are 256 possible shades of gray in an 8-bit gradient. The Options palette for several of the Photoshop tools lets you choose a "fade" amount--set this to 256 to obtain the smoothest possible effect. Make sure your paint colors are reset to full black and full white, and that your opacity is set to 100%. Selecting "Background" or "Transparent" really depends on your situation--I usually set it to "Background".


Your basic settings for creating a
nice, smooth gradient.

Your next step is to define a custom brush size appropriate for your path and your task. You create a custom brush by clicking in any empty box in the Brushes palette, thus:

...which pops up the following box:

The two things we care about in this window are "Diameter" (for now) and "Spacing" (which we'll get to in a minute).

The main thing to worry about in choosing a diameter is that it's big enough to accomodate the effect you're going to be wiping on. Be careful about getting TOO big, however--particularly if your path has sharp corners, as the following example illustrates:


This path has been stroked with
a too-fat brush. The overlapping
gradient will result in unwanted
artifacts. It's bad.


This path is better. It's wide enough
to accomodate the glow effect but
not so wide it overlaps itself.
We like this one.

Now that we have a width we like, all that's left is to stroke the path--but what's happening? The stroke is coming up too short! Or too long!

This is where the "Spacing" slider comes into play (see above). Increase the spacing and the line goes further before fading out-- decrease it and the line tightens up. You'll have to stroke the path, see which way you need to adjust, undo, adjust the spacing amount accordingly, and stroke again until you're satisfied with the results.

My path ultimately looked like this:

Now all that was left was to animate it in AE. Let's have a quick look at the Gradient Wipe interface:

The only goofy thing about the interface, to my sensibilities at least, is that the effect seems to have been designed to wipe layers OFF rather than ON. This means, when the transition is "100% complete" (top slider), the layer is GONE, rather than fully on. This is not a problem, it just seems backwards to me, because I usually think in terms of bringing a new element in.

I created a 640 x 480 comp, and dragged the files into it in the following order: Gradient Path, Monaco, Glow. I selected the "Glow" layer, applied the Gradient Wipe effect, set the Gradient Layer to "Gradient Path", set the transition softness to roughly match the sides of the glow (so the front of the glow would look like the sides) and made the transition about five seconds long. Result: a green glowing line wiped itself neatly on, following the road.

Satisfied, I added another "Monaco" layer, again applied the Gradient Wipe effect, selecting "Gradient Path" as the Gradient Layer. I then copied the keyframes from the "Glow" layer, offset the timeline by about ten frames, and pasted the keyframes into the second "Monaco" layer. Now the Green glow appeared to wipe off ten frames after it wiped on. I adjusted the Transition Softness setting of the second Monaco layer to a value of "6" which gave it a nice motion-blur-trail look.

Now it was a simple matter of duplicating and offsetting these top two layers as many times as I liked to create multiple "pulses" of light. Project done.

Let's look at it again!


Click to play me. (164k .mov)

Of course, layering dozens of these effects would start slowing things down a bit. If this is the case, you can create the "pulse" as a separate layer keyed with an alpha channel, then pre-render the pulse as a QT movie using these settings: Animation, best quality, Milltions+. This saves the effect with no loss of image quality and with an intact alpha channel. You can then bring it in, loop it, copy and offset it as many times as you'd like and it will render much faster.

In Closing... Or, "Thank Heaven it's Finally Over"

Well, that's it! More than you ever wanted to know about the Gradient Wipe filter. I've typed the word "gradient" more times in the creation of this tutorial than in the rest of my life combined. I hope it was worthwhile.

Have fun and keep exploring!

Brian Maffitt

Special thanks to Total Training for allowing us to re-print this tutorial