LIBRARY: Tutorials Reviews Interviews Editorials Features Business Authors RSS Feed

Flying through a tunnel in After Effects

COW Library : Adobe After Effects Tutorials : Chris Zwar : Flying through a tunnel in After Effects
Flying through a tunnel in After Effects
A CreativeCOW After Effects Tutorial

Flying Through a Tunnel with AE
Chris Zwar Chris Zwar
Entertainment Media
South Melbourne, AUSTRALIA
©2004 Chris Zwar and All rights reserved.

Article Focus:
Flying through a tunnel can be useful for everything from “wormholes” in sci-fi movies like “Contact” to the transcontinental phone line in “3 colours red”, or even the optic nerve of Edward Norton in “Fight Club”. To create a Hollywood-level tunnel effect requires a true 3D application, with sophisticated modeling, rendering and 3D camera interaction – however, in this tutorial, Chris Zwar mocks up a quick & dirty 2D imitation with the “Polar Coordinates” filter in After Effects.

zipped AEP basic movie advanced movie #1 advanced movie #2

Background Information

If you look at the After Effects documentation for the "Polar Coordinates" filter, it says:

"This effect distorts a layer by transposing each pixel in the layer's x, y coordinate system to the corresponding position in the polar coordinate system, or the reverse."

While this description is undoubtedly accurate, it's not really that descriptive or helpful. What would be much more effective would be something like "The Polar Coordinates filter can be used to simulate the effect of flying through a tunnel".

In simple terms, the Polar Coordinates filter takes an image and re-positions pixels so that one which moves from the top to the bottom will now move from the center of the screen to the outside. So if we create a texture which scrolls from the top of the screen to the bottom, the Polar Coordinates filter will remap it so the texture moves from the center of the screen to the outside – in other words, it will look like we're moving through a tunnel.

By using the “reshape” effect, we can move the center of the tunnel around to add some twists and turns, and to inject a bit of drama we can fake some camera shake by using the “Transform” effect.

This project was created in After Effects 5.5, but the principles work in earlier versions too. Before version 4.0, Fractal Noise was a 3rd party effect you had to purchase, but if you've got it there's no reason you couldn't do this tutorial on versions 3.1 or 3.

I use a Macintosh so the keyboard shortcuts mentioned apply to the Mac – if you're on a PC then you'll have to substitute “apple” for “alt” and “option” for “control”, or vice versa.

So if you're OK to go, let's get started.

Creating the Texture

Open After Effects and choose "New Composition". Call the composition "Fractal Texture".

The first step is to create the texture for the "walls" of our tunnel. The composition needs to be square for the Polar Coordinates filter, so we'll use dimensions of 400 x 400 and square pixels. In a work situation the size, duration and frame rate would match the project you're working on- it doesn't matter too much for this tutorial. We'll create a 10 second animation, and if you were working with PAL video it would be 25fps, 29.97 for NTSC, 24 for film or some HD etc.

We're going to use fractal noise to create a streaky texture, so add a solid and make it the size of the composition. The colour doesn't matter, and I called the solid "Fractal noise- full screen" to help things stay organized. If the duration of the solid is shorter than the composition, drag it out to the full length of the timeline.

If you need to, drag the solid out to run for the full duration of the composition.

Apply the fractal noise effect. Because we're trying to give the impression of speed we want blurry streaks, so we don't need a lot of detail in our fractal noise and we can reduce the "complexity" setting to make rendering faster.

Set the contrast to 200, the brightness to -20, and the complexity to 3.

Our texture needs to scroll from top to bottom, and we can use the "Offset Turbulence" feature of fractal noise to do this. The "Offset Turbulence" controls are revealed under the "Transform" heading.

Twirl down the "Transform" arrow and set a keyframe at the start of the composition for the "Offset Turbulence", which will be the same as the centre of the composition (200,200). To scroll vertically, we need to animate the Y-value, so go to the end of the composition (press “end”) and add another keyframe of 200, 20000. The higher the Y-number the faster we'll fly through the tunnel - but only alter the Y-value. If you want it really fast, make it larger than 20000.

With our keyframes set, the fractal noise scrolls from top to bottom.

To make our fractal noise look a bit streakier, we'll stretch it using the scale values of the fractal noise. These controls are also part of the fractal noise effect, and are just above the "Offset Turbulence" controls we just animated. Firstly, uncheck the "Uniform Scaling" box because we want the X & Y values to be different. Change the scale width to 50% and the scale height to 1000%.

It's worth noting that this isn't the same as scaling the layer. Fractal noise is generated by mathematical algorithms and when we scale fractal noise using these controls we're just changing the way the math is calculated and how the fractal is rendered - so we're not losing any quality by scaling up.

To get some more variation in the streaks, open the "Sub Settings" twirly, and make the Sub Influence 90% and the Sub Scaling 50%.

Now that we have our fractal noise looking nice and streaky, and smoothly scrolling from top to bottom, we have to make adjustments for using the Polar Coordinates filter. Our fractal texture needs to be seamless - in other words our left side and right side must "wrap around", otherwise we'll have a big visible seam down the middle of our tunnel.

Apply the "offset" filter and change the centre to 400,200 and you'll see the problem. The Offset filter is wrapping our fractal texture around so that the left and right sides will now wrap seamlessly, and the “problem area” is in the middle of the composition.

Now we have our left and right sides of the screen wrapping around seamlessly, we just have to fix the middle.

The line down the middle is where the “real” left and right sides of the fractal noise meet. We need to disguise it.

If you have AE 6.5, you can use the CC Simple Wire Removal filter, but to make this tutorial compatible with older versions of AE we'll just cover up the seam with some more fractal noise.

Select the fractal noise layer and duplicate it, then select the top layer and go to "Solid Settings" and change the size of the duplicate layer to 200,600. To keep things organized, I changed the name to "thin strip".

We only need a thin strip in the middle to cover our seam, and it's a waste to render a wider image than we need. When you duplicated the layer, you also duplicated all the effects and keyframes - but we don't need the "offset" effect applied to our top layer, so delete it.

Now add a mask to the top layer using the keyboard shortcut of apple-shift-n, which adds a new mask the same size as the layer. Press "m" so we can see the mask options. Click on "shape".

Pressing “m” reveals the mask properties.

We want to make the mask thinner so we can feather the edges. Type in 50 for the left, and 150 for the right, and select "rectangle".

Press "f" to reveal the mask feather, and click on the link icon to un-link the X and Y feathers. Enter an X feather of 50. We've just covered our seam.

Feather the X value only, by un-checking the “link” icon.

If your composition doesn't look like this, make sure you deleted the “Offset” effect from the “thin strip” layer, and that the “thin strip” layer is above the “full screen” layer.

When our fractal noise is converted into our tunnel, the top of the composition will be the centre of the tunnel. To enhance the sense of distance, we want it to fade to black. The easiest way to do this is to use a ramp.

Add another solid and make the width the same as the composition (400), and the height 200. I called it "Distance Ramp".

Set the Y-position of the solid to be 100, so the solid sits at the top of the screen. If the duration of the solid isn't the same as the composition, drag it out to be the same. Or, press "end" to go to the end of the comp, select the layer and press option-].

Make the ramp the full duration of the composition. Note that the Y-position of the ramp is 100.

Add the ramp effect - the default values work well, but we'll change the "start" to be a bit lower. This will give our tunnel some width. Change the start position to be about 200,20.

Now that the ramp looks OK, change the transfer mode to "multiply" so it effects the layers beneath it.

OK, that's our texture done.

Creating the Tunnel

Now we turn it into a tunnel.

Close the composition window, and in the project window drag the icon for the "Fractal texture" composition onto the make-composition icon at the bottom. This will automatically create a new composition with our Fractal noise texture in it.

In our new composition, add the "Polar Coordinates" effect to the Fractal Texture layer. Change the "Type of Conversion" to “Rect to Polar", and make the Interpolation 100%.

Voila! Now that's most of the work done, and if you do a RAM preview you'll see that we're now flying through a tunnel.

But to make things a bit more interesting, let's make the tunnel twist and turn. To do this we'll use the "Reshape" effect.

The Reshape effect can be used to do "morphing", and I've written a separate tutorial which explains the Reshape effect (and how to do morphing) in more detail. If you want more information on the Reshape effect, I suggest you look at the “Morphing with After Effects” tutorial in the Creative Cow tutorials section.

We're going to use the reshape effect to change the location of the centre of the tunnel, and this will hopefully look like the tunnel is twisting.

Before we add the reshape effect, we need to set up some masks to define how we reshape the tunnel. We need 3 masks - one to define where the end of the tunnel is (i.e. the center of the composition), another to define where we want it to be, and another to define the outside of the tunnel.

The easiest one to add is the outside one, so use the keyboard shortcut of apple-shift-n to add a new mask, It will be the same size as the composition. Press "m" to reveal mask properties, then click on "shape" and leave all the numbers the same, but choose "oval", then click OK.

We don't want the mask to actually act as a mask and cutout the image, so change the mask mode from "add" (which is the default) to "none". Finally, click where it says "Mask 1" and press "return" - this will let you rename the mask. Call it "Boundary Mask".

We've renamed the mask and changed the mask mode to “None”.

We'll follow a similar procedure for our next mask. Press apple-shift-n, press m, set the mask to "none", and then click on shape. We'll make the end of the tunnel have a radius of 20 pixels. Because the centre of the layer is 200,200 pixels, we can just type in "200-20" for the left and top, and "200+20" for the right and bottom. Click on "oval".

One of After Effects’ best time-savers is the way you can type simple math equations into dialogue boxes, so you don't have to do the math yourself. I'm not suggesting I don't know what “200+20” is, I'm just demonstrating a great shortcut.

Click on "Mask 2", press return, and change the name of the new mask to "Tunnel Centre".

Our masks are visible in the composition window, but because we changed their mode to “none” they don't actually mask the image, if you know what I mean.

For our third and final mask, we can just duplicate the second mask. So make sure it is selected and press apple-d. If duplicating the mask doesn't work, press F2 to deselect everything, then click on “Tunnel Centre”, and try again. Change the name of the new mask to "New Tunnel Centre".

Our third mask is a duplicate of the second mask. Change the name to avoid confusion.

Currently we can only see 2 masks in the composition window- because our 3rd mask is a duplicate of the 2nd it's in exactly the same position. Double-click the centre mask in the composition window, which will allow you to move it. Move it away from the centre, so it's clear of the original "Tunnel centre" mask. Now we can see all 3 masks separately.

Now we have our masks set up, we can apply the "reshape" effect. With a bit of luck, the default settings will have our masks correctly allocated. If not, set the "Source mask" to "Tunnel Centre", the “Destination Mask" to be "New Tunnel Centre", and the Boundary mask to the "Boundary Mask".

The source, destination & boundary masks should match the masks we just created.

Next, we'll add some correspondence points to link the two masks. Correspondence points are described in more detail in my other tutorial, "Morphing with After Effects". In order to have the correspondence points show up, we need to select the "Reshape" effect in the effects window. Press F2 to deselect everything, and then click on the "Reshape" heading in the effects window.

By clicking on the word “Reshape”, we select the effect and see the correspondence points in the composition window.

In the main composition window, you will now see a black line linking the two masks, with white squares at each end. These are the correspondence points, which tell After Effects how the two masks are linked. Because the masks are duplicates of each other they are identical, and it's very easy to add more correspondence points. When masks are different shapes it can be much more difficult.

In the composition window, hold down the "option" key and move the mouse pointer to touch one of the masks. The mouse pointer will have a + appear, showing that you will add a correspondence point where you click. I added another 7, evenly spaced around the circle.

This shows the 8 correspondence points, which control how the first mask is reshaped to the second masks’ position.

If we change the "Percent" value of the Reshape effect, we can see how the centre of the tunnel is now warped to the location of our duplicate mask.

Our work is nearly done.

Animating the Tunnel

The reshape effect has a control called "Elasticity", with settings ranging from "stiff' to "normal" to "super fluid". These settings determine how precisely After Effects renders the reshape effect. Despite the descriptive nature of the terms, there is no difference in the "style" of each setting, but basically each setting takes about twice as long to render as the previous one, but with increased quality. The "super fluid" setting doesn't make the effect look like water (or any fluid), it just renders with about 8 times the precision and rendering time of the "stiff" setting. For this demo, the "stiff" setting will be fine because it renders the quickest - but if you are using this technique in a real-world situation, you might need to try some of the other settings if you see pixel at ion and blockiness in the render.

The Interpolation setting determines how After Effects calculates the animation between the keyframes when the masks move. The default setting of Linear is fine here.

Now that everything is set up, the final thing we need to do is animate our tunnels twists and turns. To do this we'll be changing the position of our "New Tunnel Centre" mask.

To get the most organic and natural looking sweeps and turns, we'll use motion sketch to generate some hand-drawn keyframes. Unfortunately we can't “motion sketch” a mask, so we'll use a small solid instead and then we'll copy the position over. It's a bit tedious but it will look better and less “mechanical” than individually keyframed movements.

Add a new solid and make it 40 x 40 pixels. Pick a random colour to help us see it better, and drag the solid out so it fills the duration of the comp (remember – press “end” then option-] ).

If you can't see the Motion Sketch palette, select "Motion Sketch” from the "window" menu.

Click on "start capture" and hold the mouse button down while you sweep the mouse around the composition window. Try to keep within the area of the tunnel - it doesn't matter if you go outside the circle of the tunnel but the render times increase dramatically. Try to draw nice flowing and organic lines, and alter the speed with which you move the mouse in a smooth manner too. Once you've drawn 10 seconds of movement, the Motion Sketch will stop and you'll be returned to the original view. Depending on your view preferences, you may see the motion path you've just created in the composition window.

These are the View Options, and determine whether or not you can see the Motion Paths of your solid.

Now for the tedious part. Unfortunately there's no way to cut & paste the position keyframes we just created to the position of the mask, so we have to do it manually. But it's not too bad.

Press "home" to make sure you're at the start of the composition. Select the "Fractal texture" layer and press "m" to reveal the mask properties. Click on the stopwatch for the "Mask Shape" parameter of the "New Tunnel Centre" mask, to add a keyframe. To speed up our workflow, we'll temporarily turn off the effects, because we don't need to see them and they take a while to render. Click on the "f" next to the layer quality switch.

In the composition window, double-click on the New Tunnel Centre mask, which will allow us to move it. Drag it so it sits on top of the solid.

Drag the mask so it sits over the blue solid. Notice that because the effects have been disabled to speed up rendering, we're not seeing the tunnel.

Now press "shift - page down" to move 10 frames along in the timeline, and drag the mask to the new position over the solid. Keep this up until you've done all 10 seconds - you'll have to press the "end" key to do the last keyframe.

When you drag the mask, make sure you drag it from inside the square bounding box, otherwise you can end up rotating or scaling the mask instead - which will muck everything up.

To be really accurate, and to capture the nuances of our hand-drawn animation, we'll go back and do another keyframe between each pair we've already created. All you have to do is go to frame 5 (because it's half way between 0 and 10), move the mask to over the square solid, then press shift-page down as before. This will fill in the gaps. If you were totally anal, you could go back and start on frame 2 and then frame 7 etc.

I've created one keyframe every 10 frames, now I'm going back and doing another keyframe between the first batch.

Once you've done that, you have successfully copied the organic feeling of our hand-sketched movement to the position of the mask.

Final Touches

Our final few steps are just to make it look a bit more dynamic. Firstly, turn back on the effects for the Fractal Texture layer, and we'll add a bit of colour by applying "Colourama" and selecting the "Fire" preset in the "Output Cycle" section.

Next we'll add some camera shake. Because our tunnel doesn't have 3 dimensions - although it looks like a tunnel it's actually flat - we won't use a "real" camera. We'll just fake it.

Add an adjustment layer to the top of the composition and make it run the duration of the timeline (press "end", then option-] ).

From the list of "distort" effects, apply "Transform". Press "e" to reveal the transform effect in the timeline, and open the twirly arrow to reveal the properties we can animate. We're going to use the "position" parameter. It's very important to note that we are not animating the position of our adjustment layer, but rather the position property of the transform effect.

Press "home" to go to the start of the composition and add a keyframe for the position of the transform effect. Then press "end" to go to the end of the timeline and add another keyframe. Both of these will be at their default values equal to the centre of the composition, so you won't see any change.

Note how we have added keyframes to the “Transform” effect – we are not animating the “position” of the adjustment layer.

If you can't see the "wiggler", select it from the "window" menu. Then click on the word "position", under the transform effect to highlight both keyframes. Now we can use the wiggler to add random keyframes between them, which will "wiggle" the position and look like camera shake.

In the wiggler palette, select "spatial path", "jagged", “all dimensions independently”, and a frequency of 12 and a magnitude of 10. You can experiment with your own parameters, they're not vital. Once you click "apply", you will get random position keyframes applied between the start and end position keyframes we selected. These new keyframes will be spaced at even 12 frame intervals, because that's what we put into the wiggler settings.

To make the camera shake a bit more realistic, you can select keyframes, delete them and slide them around to make the motion a bit more organic.

Deleting and sliding keyframes around can create a less mechanical feel.

Because the camera is moving around, we'll get black borders around the edges where the Fractal Texture layer is moved away from the edge of the composition. To fix this, we'll zoom in slightly. Change the "scale" of the transform effect to 120%, and then enable motion blur for the layer by clicking in the "M" box.

Again- notice that we are changing the Transform effect, and not the scale of the layer.

Enable motion blur for the layer by clicking the motion blur box.

At this stage we're pretty much done- but there's one more tweak we'll add. We've generated our texture from fractal noise, and it's pretty blurry as it is. However using the Polar coordinates filter you can construct a tunnel out of all sorts of textures, and sometimes they'll need a bit of blur to enhance the effect. Not all tunnels are streaky. So although we don't need to in this case, we'll add some radial blur anyway just to demonstrate the process.

Select the Adjustment layer and add the "Radial Blur" effect. Change the "type" to "Zoom", and the "antialiasing" to "high". In the timeline, open the twirly arrow to reveal the radial blur parameters.

Select the Solid layer and press p to reveal the position keyframes we drew earlier.

Now click on the word "centre" under the radial blur effect, and choose "add expression" from the animation menu. Three new icons will appear - click on the middle one, which is the "pickwhip" Drag this icon down to the word "position" under the Solid layer, and when you see the box appear around the word "position" let it go.

Drag the pickwhip onto the position of the solid for an instant expression.

You've just added an expression which copies the position of the solid (which is the "end" of our tunnel) to the centre of the radial blur effect. Change the amount of Radial Blur to something high, like 60. If you have a slow machine, you can change the antialiasing to "low" and add a fast blur effect of about 2- 4 pixels – it's basically the same look but it renders faster.

If you are using an older version of After Effects which doesn't support expressions, you can just copy and paste the keyframes.

Because the "transform" effect we applied is moving the layer and scaling it up, the position of the solid will no longer be exactly where the end of the tunnel is. Because the center of the radial blur is linked to the solid, we want to apply the radial blur before the transform effect, so the center of the radial blur matches the end of the tunnel. So click on the word "radial blur" and drag it above the word "transform". This changes the order of the effects so that the blur is rendered first (in the correct position), then the camera shake is added.

Drag the “Radial Blur” effect above the “Transform” effect so it is rendered first.

We don't need to see the solid anymore, so turn off its visibility - and just to make sure move it to the bottom of the timeline underneath our fractal tunnel.

Turn off the visibility of the solid and move it to the bottom of the composition, because we don't need to see it.

And there we have it- flying through a simple tunnel using the Polar Coordinates and the reshape filters.


This simple technique will never give results that match a real 3D modeling and animation program, but there are ways to enhance the effect. If you look at the accompanying project file, you'll see two variations that are a bit more complex.

The first variation uses several layers of fractal noise to create a more complex texture, along with a few particles generated with “Foam”. While there are several particle generators in After Effects, I decided to use “Foam” to demonstrate that it's useful for more things than just foam.

As well as the twists and turns using the “reshape” effect, the tunnel also rotates by animating the value of the offset filter, and the “Radial Blur” effect has a modified expression to take into account the Transform effect’s position change – this allows the radial blur to be applied after the Transform effect.

The second variation of the effect uses a different texture to simulate wires, just to demonstrate that not all tunnels are science-fiction wormholes. The opening scene in “3 colours red” generated a lot of acclaim for the “telephone cables” effect.

Chris Zwar
Entertainment Media

Please discuss this technique in the After Effects forum at

Please visit our forums and view other articles at if you found this page from a direct link.


Flying through a tunnel in After Effects
by Jon McGovern
Thanks for this great tutorial! I've used it and it's really effective. I don't know how you find the time to do these but I'm glad you do! Thanks! Rating Five is best isn't it?

Related Articles / Tutorials:
Adobe After Effects
Create an Arrow or Pointer preset for After Effects

Create an Arrow or Pointer preset for After Effects

In this video tutorial, Graham reveals a really quick way to use Shape Layers to make an arrow preset that you can use to point to anything in Adobe After Effects.

Graham Quince
Adobe After Effects
Realistic Water Movement with Fractal Noise

Realistic Water Movement with Fractal Noise

In this tutorial video, Andy Ford shows you how to use the Fractal Noise effect in After Effects to add movement to water in a still photo

Andy Ford
Adobe After Effects
Adobe Creative Cloud September 2020 Update: Streamlined workflows that make storytelling easier

Adobe Creative Cloud September 2020 Update: Streamlined workflows that make storytelling easier

The current environment is forcing us to rethink and reimagine so much. Content creators, from broadcasters to streaming services to social video creators, are finding new ways of working that prove creativity and resourcefulness are inherent to the video industry. Adobe's Eric Philpott explores Adobe's developments in response to the ever evolving challenges we face today.

Eric Philpott
Adobe After Effects
Makin' Planets! Saturn (with rings and shadows)

Makin' Planets! Saturn (with rings and shadows)

In this video, Graham shows how to make Saturn's rings using Polar Coordinates, then use an Alpha Invert Matte along with a simple expression to cut the rings out.

Graham Quince
Adobe After Effects
Text Box Background Preset in After Effects

Text Box Background Preset in After Effects

Graham's latest tutorial shows you how to combine several effects to generate a background for any text layer you add to an After Effects comp.

Graham Quince
Adobe After Effects
Makin' An Eclipse

Makin' An Eclipse

In this tutorial for Adobe After Effects, I use the Circle effect, Fractal Noise, Polar Coordinates and CC Light Rays to create a 2D solar eclipse.

Graham Quince
Adobe After Effects
How To Put Yourself In Any Movie Part 3: Keying Greenscreen

How To Put Yourself In Any Movie Part 3: Keying Greenscreen

Following the huge response to parts one and two of independent filmmaker Cody Pyper's Adobe Photoshop and After Effects tutorial series, "Put Yourself In Any Movie!", here is the truly EPIC series finale, which is the most complete single keying tutorial we've ever seen. It's all here, including Red Giant's Primatte Keyer, Premiere Pro's Lumetri Color Panel, AE's Keylight filter, everything you need to know about curves and levels, realistic blurs, shadows and VFX, and more! Did we mention that this is epic? EPIC!

Cody Pyper
Adobe After Effects
Makin' a 3D Nebula in Photoshop, Cinema4DLite, and After Effects

Makin' a 3D Nebula in Photoshop, Cinema4DLite, and After Effects

Graham continues his space tutorial series, featuring the Orion Nebula

Graham Quince
Adobe After Effects
Motion Tracking in After Effects

Motion Tracking in After Effects

During this short video tutorial, Andy Ford shows you how to apply Track Motion to aerial drone footage

Andy Ford
Adobe After Effects
Free Tablet and Phone Screen Replacement Tracking Images

Free Tablet and Phone Screen Replacement Tracking Images

Here's a giveaway for anyone interested in trying to do a screen replacement for their iPad, iPhone, Tablet or phone.

Graham Quince
© 2020 All Rights Reserved