2.5D: Using the Camera


What if you could pick up a camera and move it around a world of objects that were flat and two dimensional, yet were related to one another and to a virtual camera in 3D space? As was explored toward the end of the previous chapter, that's pretty much the dimensional model After Effects offers you. It's sort of a 2.5D world, comprised of objects that can exist anywhere but have no depth themselves.

There are a lot of fun, stylized ways to play around with 3D in After Effects, but there are also ways in which you can get the After Effects 3D camera to match the behavior of a real camera, if you understand how they are similar, and how they differ. Therefore it's worth taking a closer look at how 3D works in After Effects, and how its various featuresthe camera, lights, and shading optionscorrespond to their real world counterparts.

Understanding the After Effects Camera

You can use 3D in After Effects without setting a camerajust toggle a layer to 3D and voilabut it's a little bit like driving a race track using a car with an automatic transmission: You can't maneuver properly, and before long you'll probably crash.

Furthermore, when you set a camera, you encounter one of the more helpful and visually descriptive portions of the After Effects user interface: the Camera Settings dialog (Figure 9.1). If you know how to interpret what it is showing you, the dialog's diagram tells you virtually everything you need to know about how the After Effects camera sees the 3D world.

Figure 9.1. Visual artists love visual user interfaces, and the Camera Settings dialog is one of the few to include a diagram. That's a good thing because it also contains a lot of settings that most users find a bit abstract. Here are the default settings for a 50 mm preset, which happens to be the setting that introduces no change of lens angle from a flat 2D view.


Virtually everything is an apt description, moreover, because one thing that is confusing about After Effects' camera is its use of lens settings from still SLR (single lens reflex) cameras to describe how long or wide a lens is. The diagram in Camera Settings, however, is helpful not only in making some sense of the numbers involved, but also in learning how camerasbe they real or virtualoperate.

Lens Settings

The default camera in After Effects uses the 50 mm preset (listed in the Preset pull-down menu in the Camera Settings dialog). Switching all of your layers to 3D and setting this camera does not change the appearance of your scene whatsoever, which is significant. Like many added features in After Effects, it is specifically designed not to fundamentally change (or corrupt) the appearance of your work when you switch it on.

But hold onthere's no such thing as a 50 mm virtual camera lens because virtual space doesn't contain millimeters anymore than it contains kilograms, parsecs, or bunny rabbits. The virtual world is generally measured relative to pixels. Everything else is just kind of made up until you find its analogue in the real world. So where did the name come from?

On any physical camera, there is a lens length that would be considered neither long nor wide. This lens captures a scene without the shifts in perspective and distortion of featuresnot all of them displeasing, mind youassociated with lenses that tend more toward the fisheye or telephoto perspective (Figures 9.2 through 9.4).

Figure 9.2. The extreme wide or fisheye lens pointed inside an evenly proportioned 3D box. Note that the "long" look of the box is created by this "wide" lens, which tends to create very strange proportions at this extreme. A physical lens with anything like this angle would include extremely distorted lens curvature.


Figure 9.4. The default lens (50 mm setting). If the Z Position value is the exact inverse of the Zoom value, and all other settings are at the default, this is the view you get, and it matches the appearance of setting no After Effects camera whatsoever.


Figure 9.3. A telephoto lens (using the 200 mm setting) pushes items together in depth space, shortening the distance between the front and back of the box dramatically.


On a 35 mm SLR still camera such as has been used for professional photography for decades, 50 mm is the median lens length and the namesake for the After Effects preset. SLR cameras are familiar to many more people (including After Effects developers) than professional film or video cameras. But how many movies have been shot predominantly using an SLR camera? Not many; in fact, only one candidate comes immediately to mind, La Jetée, the 1962 Chris Marker film that was the inspiration for Terry Gilliam's movie 12 Monkeys.

Your source more likely would be from a 35 mm motion picture camera shooting Academy ratio, on which, it just so happens, a 35 mm lens is considered flat or normal. But if your footage would come from a miniDV camera, the tiny CCD requires an equally tiny default lens length of around 4 millimeters. The appearance of different lens lengths is directly related to the size of the backplate or video pickup, the area where the image is projected inside the camera. The smaller the film size (or CCD size), the shorter the default lens.

The point is that millimeters don't mean much without a physical lens and a physical camera. The only setting in the Camera Settings that truly, universally applies, whether images were shot in IMAX or HDV or created in a 3D animation package, is the Angle of View.

Real-World Camera Settings

So how exactly do the After Effects camera's settings line up with those of a camera in the physical world? If you know a camera's settings, how do you use them?

First, look again at the diagram provided in the Camera Settings dialog. Four interrelated numerical fieldsFilm Size, Focal Length, Zoom, and Angle of Vieware oriented around two triangles sharing a common hypotenuse (Figure 9.1). On a physical camera with a prime lens, these values would all be fixed. With a zoom lens, the Film Size would be fixed (as it always is in a physical camera), but the Zoom and Focal Length could be changed, resulting in a change in the Angle of View. These four settings, then, are interrelated, as the diagram implies.

Yes, there is an optional, indirectly related, fifth numerical field in the Camera Settings diagram: Focus Distance, which you enable by checking the Enable Depth of Field toggle. This is more like a camera's aperture setting; I'll touch on it separately later.


And so it is with the After Effects camera: Change Angle of View, Zoom, or Focal Length and the other two values among those will change correspondingly, but Film Size will remain fixed. Film Size is useful only if you're trying to emulate a specific camera, which I'll get to in a moment.

Lengthen the lens, and Focal Length increases as Angle of View decreases. A physical telephoto lens really is longer from lens to back plate, and adjusting its zoom does make the lens longer or shorter. The only feature that would make this diagram any clearer is if it actually articulated to visually display the difference in Angle of View as clearly as it can be seen (particularly in the top views) in Figures 9.2 through 9.4.

Making Your Adjustments

The only two settings to focus on (no pun intended) are Zoom (for animation) and Angle of View (to match source where that measurement is available). Film Size and Focal Length, measured in pixels, make sense only relative to those two. Angle of View is the actual radius, in degrees, that the camera sees. The setting corresponds directly to real world cameras, and Angle of View is a setting you will see in other computer graphics programs, so you can match it precisely if you need to.

The Zoom value is the distance of the camera lens, in pixels, from the plane of focus of its subject. By default when you set a new camera, After Effects always sets that camera's Z Position value equivalent to the negative of its Zoom value, so that everything that is at the default Z position of 0.0 remains framed the same as it was before the camera was activated. The plane of focus represents an area the size of the composition (Figure 9.5), so wherever it is relative to the camera is the point where all items will be framed by that area exactly.

Figure 9.5. You can easily have overlooked the highlighted settings in the Camera Settings dialog. Comp Size (on the right) shows the horizontal size of the composition, in pixels, if the Units and Measure Film Size settings are as shown. This makes the relationship between Zoom and Plane of Focus clearer, although Comp Size is showing a horizontal measurement while the diagram makes it appear vertical.


There are several cases in which having the Zoom value in pixels is ideal. It helps for reference when creating depth of field effects, and it makes it easy to tie the position of the camera and the zoom together via expressions for depth of field and related effects (discussed later).

Emulating a Real Camera

And how do you put all of this knowledge to work? You probably have one of two goals: Either you're matching settings that came from a real camera in order to match your elements to images taken with that camera, or you're creating a shot from scratch but want it to look like it was shot with a particular camera and lens. Here are some of the things you have to consider:

  • Depth of Field: Is everything in the shot in focus, or does the shot require a narrow depth of field with elements in the foreground and background drifting out of focus?

  • Zoom or push: If you are moving in or out on the shot, which type of camera move is it (discussed further in the section called "Moving the Camera")?

  • Motion blur and shutter angle: These settings aren't part of the 3D camera, they're composition settings. If you're unclear about these, review Chapter 2, "The Timeline." Note that camera movement can generate motion blur, just as layer movement does (Figures 9.6a and b). The key is that the objects to be blurred by the motion of the camera must have Motion Blur toggled on.

    Figure 9.6a and b. The blurred object (9.6a) is not moving, the camera is, but the object's motion blur must be toggled on to track the camera's motion. Just in case you were wondering, there is no motion blur associated with zooming (9.6b).


  • Lens angle and distortion: The perspective and parallax among objects in 3D space changes according to the angle of the lens through which they are seen. Real cameras also introduce lens distortion, a curving toward the edges of the image, especially apparent with wide angle lenses, which require a good deal of lens curvature (hence the fisheye lens) in order to take in such a wide angle of view. The After Effects 3D camera does not need a physical lens and does not cause lens distortion on images, but you may need to add it to match existing footage (see the "Optics Compensation" section).

  • Exposure: The After Effects camera has no direct corresponding adjustment for this feature (and limitation) of physical cameras. Therefore you needn't worry about it. But if, on the other hand, you want to create effects that emulate changes in exposure, you may be best off working with eLin (from Red Giant Software and on the book's CD-ROM) in a 16-bit linear image pipeline. For more on that, see Chapter 11, "Issues Specific to Film and HDR Images," and for an example of working this way, look at the last section in Chapter 12, "Working with Light."

One specific piece of information that can help you match existing footage is a camera report, a record of the settings used when the footage was taken. If the crew was large enough to include an assistant cameraman, this information was taken down and can be made available.

Making Use of a Camera Report

If you know the type of camera and the focal length used for your shots, you have enough information to match the lens of that camera with your After Effects camera.

Researched by Stu Maschwitz, author of Chapter 15, "Learning to See," Table 9.1 details the sizes of some typical film formats. If your camera is on the list, and you know the focal length, use these to set your camera in the Camera Settings dialog. The steps are

1.

Set Measure Film Size to Horizontally.

2.

Set Units to Inches.

3.

Enter the number from the Horizontal column of the chart that corresponds to your source film format.

A potentially easier alternative to the listed steps, for those who like using expressions, is to use the following expression on the camera's Zoom property:

 FocalLength = 35 //change to your  value, in mm hFilmPlane = 24.892 //change to your  film size, in mm this_comp.width*(Focal Length/hFilmPlane) 


4.

Set Units to Millimeters.

5.

Enter the desired Focal Length.

Table 9.1. Typical Film Format Sizes

FORMAT

HORIZONTAL

VERTICAL

Full Aperture Camera Aperture

0.980

0.735

Scope Camera Aperture

0.864

0.732

Scope Scan

0.825

0.735

2:1 Scope Projector Aperture

0.838

0.700

Academy Camera Aperture

0.864

0.630

Academy Projector Aperture

0.825

0.602

1.66 Projector Aperture

0.825

0.497

1.85 Projector Aperture

0.825

0.446

VistaVision Aperture

0.991

1.485

VistaVision Scan

0.980

1.470

16 mm Camera Aperture

0.404

0.295

Super-16 Camera Aperture

0.493

0.292

HD Full 1.78

0.378

0.212 (Full Aperture in HD 1.78)

HD 90% 1.78

0.340

0.191 (90% Safe Area used in HD 1.78)

HD Full 1.85

0.378

0.204 (Full Aperture in HD 1.85)

HD 90% 1.85

0.340

0.184 (90% Safe Area used in HD 1.85)

HD Full 2.39

0.3775

0.158 (Full Aperture in HD 2.39)

HD 90% 2.39

0.340

0.142 (90% Safe Area used in HD 2.39)


Your shot now has the correct Angle of View to match the footage, and so any objects that you track in (perhaps using the techniques described in Chapter 8, "Effective Motion Tracking") will maintain the correct position in the scene as the shot progresses. It's vital to get this right if your camera is going to move during the shot, and especially if the lens used was at one extreme or the other, wide or long.

Lens Distortion

If a virtual camera is set with a wide lens angle, the software simply samples a wider (and taller) area of the scene, as you saw in Figure 9.2. This dramatically changes the perspective of 3D space, but it does not actually distort objects the way a real camera lens does because it relies on no lens whatsoever. All the software is doing is widening the view area and scanning, in a linear fashion, each pixel that falls in that area.

A real camera cannot simply widen its view area, which is essentially fixed. It can only "see" what is perpendicular to the surface of the lens glass, so it uses a more convex lens combined with a short lens length to pull a more disparate (wider) range of view.

At the extremes, this causes lens distortion that is easily visible; items in the scene known to contain straight lines don't appear straight at all, but bent in a curve (Figure 9.7). In a shot taken with a fisheye lens, it's as if the screen has been inflated like a balloon. It's rare, but not unprecedented, for a shot in a movie to look like this (but there are always exceptions, for example the point of view of a droid in a certain big-budget science fiction film).

Figure 9.7. The somewhat psychedelic look of lens distortion at its most extreme. The lens aberration in this case is so extreme that even the flare caused by the front lens element is extremely aberrated. You could easily set an equivalently wide lens with the After Effects 3D camera, but none of the curving of what should be straight lines (the ground plane, the building outline) would occur.


As you work with more and more footage, particularly at film resolution (where the phenomenon is often more apparent), you start to notice that many shots that don't seem so extreme as a fisheye perspective have some degree of lens distortion. Even if you can't spot any curved edges that should appear straight at the edge of frame, you might notice that motion tracks from one side of the frame don't seem to apply equally well at the other side of the frame, proportions go out of whack, and things don't quite line up as they should (Figure 9.8).

Figure 9.8. The curvature of items that you expect to be straight is one clear clue that there is lens distortion in this scene, but the surest sign is that an attempt to corner pin a yellow solid to the side of the building fails; it is not possible to make all four corners and edges line up properly.


There's no way to introduce lens distortion directly to a 3D camera, but the Optics Compensation effect (Professional version only) is designed to add or remove it in 2D. Figure 9.9 shows this effect in action. Increasing the Field of View makes the affected layer more fisheyed in appearance; to correct a shot coming in with lens distortion, check Reverse Lens Distortion and raise the Field of View (FOV) value.

Figure 9.9. The process of removing distortion must take place in a composition larger than the source, padded to allow what happens to the corners of the image. The Beam effect is used on an adjustment layer, below the Optics Compensation effect, to act as a virtual "plumb line" to check the precision of a line near the edge of frame (where lens distortion is strongest).


This process is not exactly scientific, because the Field of View settings don't correspond to measurable phenomena, such as difference in Lens Angle. You have to look for what should be a straight line in the scene and adjust the setting until you're happy with the match. The specific workflow is

  1. Having identified that there is lens distortion on a background plate to which you must add foreground elements (as in Figure 9.8), drop the background into a new composition that is at least 20% larger than the plate to accommodate stretching the corners.

  2. Add an adjustment layer above the plate layer, and apply Optics Compensation to that layer. Check Reverse Lens Distortion and raise the Field of View (FOV) setting until lines that should appear straight in your image look straight.

  3. Add a Beam effect below the Optics Compensation effect. Make its Inside Color and Outside Color settings match (using any color you'll be able to see easily), and align the Starting Point and Ending Point along an apparently straight line near the edge of frame. Fine-tune the Field of View setting a little more until the line is plumb (as in Figure 9.9).

  4. Pre-compose all of these layers and set this new composition as a guide layer. In Figure 9.10, you can see that the corner pin is now successful, but you actually want to match the distortion of the source shot.

    Figure 9.10. Over the undistorted background plate, you are able to freely position, animate, and composite elements as if everything were normal. Note that the perspective is still that of a very wide angle lens, but without the curvature. Any elements you positioned in 3D space would need to have a similarly wide Angle of View to match this perspective.


  5. Create a new master composition containing the background plate and the laid-out foreground element. Copy Optics Compensation from the adjustment layer where you undistorted the background and paste it to the foreground element but turn off Reverse Lens Distortion. You have applied the exact distortion of your background to your foreground elements, and they now match up (Figure 9.11).

    Figure 9.11. Back where you started, by applying the same Optics Compensation effect that was used to undistort the background to the foreground layers, but with the Reverse Lens Distortion box now unchecked, the foreground distorts to match the background, and features now line up properly.


You have tricked After Effects into compositing elements into a distorted environment. Stu Maschwitz, who supplied me with the example used for the step-by-step figures, notes that it is important not to undistort and redistort the plate image itself, which will soften it dramatically. He summarizes the process with the following haiku:

undistort, derive

reunite distorted things

with an untouched plate

Mixing 2D and 3D

Using a 3D camera in an effects situation typically entails compositing 3D elements over a 2D plate background. This is no big deal. After Effects does not force you to decide up front whether your composition consists of a 2D or a 3D world, and it can contain both, layered together. This is a huge advantage as long as you're clear about managing the composition properly.

And why is it an advantage to mix layers in this manner? Once you understand it, you have a lot less to worry about:

  • A background stays in place no matter how you move the camera (as in the motion tracking examples using the 3D camera in the previous chapter).

  • 2D adjustment layers set to comp size and default position affect the whole composition, including 3D layers, without budging.

  • Foreground from 3D programs that come in with 3D camera tracking data can be augmented in 3D while remaining rendered 2D elements.

Everybody wins.

Where are the gotchas of this approach? They are all special cases:

  • A 2D layer can use a 3D layer as a track matte and vice versa. Beware of using a 3D track matte on a 3D layer: It's rarely (if ever) what you want. One or the other layers typically needs to be locked in 2D space.

  • Some effects that emulate 3D perspective make use of the After Effects camera. Typically, and paradoxically, these work correctly on 2D layers only. Examples of this are Trapcode's Particular and 3D Stroke (Figure 9.12).

    Figure 9.12. It seems incredible, but the particles generated by Particular, a Trapcode plug-in, are true 3D, as is evident in perspective view. Paradoxically, this 3D effect occurs when Particular is applied to a 2D layer. It calculates the 3D positions internally using the After Effects camera as a reference, an elegant workaround for the fact that 3D layers in After Effects are always flat planes.


  • Pre-composing a set of 3D layers effectively makes them behave like a single 2D layer. They no longer interact with other 3D layers or with the camera unless you enable Collapse Transformations for the pre-comp. Doing so bypasses the camera in the embedded composition, but respects the 3D position of the object. (For details, see Chapter 4, "Optimizing the Pipeline.")

So go ahead, freely mix 2D and 3D layers. Just make sure, if it gets confusing, to double-check the gotchas list and ascertain that you know what you're doing.



Adobe After Effects 6. 5 Studio Techniques
Adobe After Effects 6.5 Studio Techniques
ISBN: 0321316207
EAN: 2147483647
Year: 2006
Pages: 156

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