PETZOLD BOOK BLOG

Charles Petzold on writing books, reading books, and exercising the internal UTM


Recent Entries
< PreviousBrowse the ArchivesNext >
Subscribe to the RSS Feed

The “Vertigo” Effect in 3D

March 7, 2007
New York, N.Y.

The story goes something like this: When Alfred Hitchcock was filming Vertigo he wanted to build a staircase structure that would expand in depth to simulate the acrophobia of the main character, played by James Stewart. But 2nd unit cameraman Irmin Roberts suggested it could be done with an optical effect. If a camera moves in on a subject, everything gets larger, of course, but the perspective also changes so that the distance between the foreground and the background seems to grow. If at the same time the camera zooms out at precisely the right pace, the foreground can remain the same size while the background seems to recede from the viewer.

This combination dolly-in/zoom-out effect was used five times in Vertigo (released in 1958), each time accompanied by the same music: In the opening sequence (chapter 2 on the DVD), twice in the bell tower (chapter 20), and twice more at the end (chapter 33). Thereafter it was called the Vertigo effect or the dolly zoom or several other terms, and has since been used in a number of movies, probably to the point where it's now a cliche.

(Wikipedia has a Dolly Zoom article that indicates the technique "appeared earlier at the climax to [Hitchcock's] film Spellbound," which dates from 1945. This is just plain wrong: The relevant scene in Spellbound is at 1:38:22 on the DVD and only looks like a dolly zoom if you don't know the boy is moving relative to the background. The camera is following the moving boy, so of course the background recedes, and there's nothing special about it. I suspect this particular shot was done with rear-screen projection.)

The following WPF program demonstrates the Vertigo effect with 3D graphics:

VertigoEffect.xbap

Move the slider at the bottom to change the perspective. (Towards the rear of the "room" you'll sometimes see some rippling that results from lines changing width in combination with anti-aliasing.)

I struggled to find a way to do this effect entirely in XAML, but eventually gave up. Instead, I used a binding converter. The markup for the camera looks like this:

The FieldOfView property (which corresponds to a zoom) is controlled by the Slider and can be adjusted between 15 degrees and 120 degrees. (It starts at 45.) The Position property of the camera is a data binding with the FieldOfView but with a converter involved. The "conv" resource refers to a class that contains the following conversion method:

The param argument is an object of type CameraParameters, also defined as a resource, which keeps the conversion routine generalized. The CameraParameters class simply contains three properties that indicate the desired width of the foreground object (which should stay the same regardless of the FieldOfView), a reference point for the camera, and the vector along which the camera will move.

You can download all source code here. Before compiling, you'll have to bring up Project Properties, select the Signing tab and click the Create Test Certificate button.

What's that you say? You've never seen Vertigo?? Well, could you add it to your queue, please? And while you're at it, add Rear Window (1954) as well. Both films are among Hitchcock's finest. Both films are in color. Both are widescreen. Both star James Stewart. Rear Window takes place in a single set supposedly on the same street where I live in New York City. Vertigo is set in San Francisco and has some wonderful location footage. Rear Window stars a divine (but pre-royal) Grace Kelly. Vertigo stars Kim Novak but also features Barbara Bel Geddes, who concluded her acting career as Miss Ellie in Dallas. (And let's not forget that gorgeous Vertigo score by one of the greatest film composers of all time, Bernard Herrmann.)


Recent Entries
< PreviousBrowse the ArchivesNext >
Subscribe to the RSS Feed

(c) Copyright Charles Petzold
www.charlespetzold.com