Offsetting Layers and Time

Table of contents:

Some of the coolest things you can do with expressions involve increments of layer index numbers (the number of the layer to the left of the source name) or time itself. The following example makes use of both.

Time in expressions is measured in whole seconds. Frames and fields are calculated as decimal fractions of seconds. Of course, if you're ever worried about calculating this, you can use fractions instead: in 24 fps footage, frame 65 would be time = 65/24 (or 2.7083 seconds). See how easy?

Tip

Wondering what value an expression generates? You can check it by applying the Numbers effect to a solid and setting an expression for Value/Offset/Random Max. For example, try entering thisComp.frameDuration and you'll see the value returned by that expression.

You can also use thisComp.frameDuration to calculate time based on frames. It returns the fraction of one second that each frame lasts.

A frame's index and time become especially useful when using conditionals. In the example, index and time serve to average grain between several frames of a sequence, for situations in which regular grain removal methods aren't cutting it with a locked-off shot. Now, get ready to move beyond one-liner expressions.

Grain Averaging

There are cases (which don't come up all the time, but which do come up) in which the normal methods of dealing with graintools as powerful as the Remove Grain effect (detailed in Chapter 9, "Virtual Cinematography")just don't do the trick. The noise simply obscures too much of the source. There is an interesting alternative, one that came in handy when I was working on The Day After Tomorrow.

This effects plate was taken on a huge blue-screen stage: actors trudged across a snowy plain. It was meant to be snowing fairly hard in the shot, and unfortunately, it was decided to use practical snow on set. I understand that typically, as in Figure 10.17, this is done with little bits of plastic confetti or, the old school way, cornflakes painted white. We were already successfully adding computer-generated snow to all kinds of exterior shots. Worse, the lighting grid appeared in frame; the garbage mask to remove it left a big hole in the falling snow. I needed to get rid of the plate snow altogether and start over. Happily it was a locked-off shot and the following trick worked with the addition of a gentle camera push.

Figure 10.17. Ah, the fall of fresh artificial snow on a blue-screen stage.

I determined that the frames I wanted to average were the ones at the end of the shot, where I could easily eliminate the only moving element in the shot, actors crossing the snowy plain. I did not really know how many frames I would need to average (5? 20?), but I knew that if I took a series of different frames and set their Opacity correctly I could average them together to create an opaque image.

This technique would remove the huge flakes of snow (or any large grainy noise) as follows: on a given frame, a given snowflake would appear at a given place in the frame, but not in adjacent frames. My technique would therefore average out the flakes. If I needed to average ten frames, then the opacity would have to decrease 10% from bottom to top.

Notes

If you composite ten frames each with an Opacity of 10%, the result will not be completely opaque. This is not an error on the part of After Effects, although it is not how things work in similar applications such as Shake. Imagine holding up two pieces of paper that are 50% opaque up against a light. Would two sheets of semi-transparent paper, held together, completely block it out? No.

Without expressions, this process would be a real pain, because I need to experiment interactively with how many layers to combine. Each added layer would require adjusting the opacity of all of the layers. Instead, I was able to apply two expressions to one layer and simply duplicate that layer until I had enough iterations to accomplish the effect of averaging.

This same trick works with any type of noise in footage, so long as the camera is locked off. Included on the disc is 10_degrain.aep, which was cobbled together from a short sequencejust a few framesshot in sequence in a downpour using a still camera. The fact that this technique basically works with such crude source should serve as an endorsement.

Drop the sequence (or noisy footage of your own) into a new composition and reveal the layer's Opacity setting. Apply an expression to Opacity and replace the default expression by typing:

Index*100/thisComp.numLayers

This expression simply says, "Multiply 100 (full opacity) by the index number of this layer, and divide this amount by the number of layers total in this composition." The keywords thisComp and numLayers can be found in the expressions menus, in case you're wondering where they came from.

Next, to average together the last few frames of the composition, counting backwards for each additional layer, apply Time Remapping and add the expression

thisComp.duration(index / (1/thisComp.frameDuration))

The duration of a composition is measured in seconds; from that, we're subtracting the current index number divided by the frame rate, which is derived by dividing the frameDuration into 1. Instead of (1/thisComp.frameDuration) you could enter 24 for 24 fps, or 29.97 for 29.97, and so on. Now each successive layer in the Timeline becomes a still frame, incremented backward one frame.

Now you get to use your artist's eye. Duplicate (Ctrl+D/Cmd+D) the layer until you no longer see noise being reduced in the shot; or delete excess layers if you've overshot the mark. In this example, we are unfortunately limited to 7 frames because that's all we have, but you can still see that the "noise" caused by the falling rain is greatly reduced (Figures 10.18a and b).

Figures 10.18a and b. In case the dramatically lower amount of rain in 10.18a isn't apparent when compared with one frame of the source (b), it should be obvious that the passing car has also been removed procedurally.


Conditionals and Triggers

Section I. Working Foundations

The 7.0 Workflow

The Timeline

Selections: The Key to Compositing

Optimizing Your Projects

Section II. Effects Compositing Essentials

Color Correction

Color Keying

Rotoscoping and Paint

Effective Motion Tracking

Virtual Cinematography

Expressions

Film, HDR, and 32 Bit Compositing

Section III. Creative Explorations

Working with Light

Climate: Air, Water, Smoke, Clouds

Pyrotechnics: Fire, Explosions, Energy Phenomena

Learning to See

Index



Adobe After Effects 7. 0 Studio Techniques
Adobe After Effects 7.0 Studio Techniques
ISBN: 0321385527
EAN: 2147483647
Year: 2004
Pages: 157

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net