Quake Lenses - Theory

## How it works

This is a visual explanation of the theory behind Quake Lenses.

### The Standard Projection

The interactive figure below is a top-down view of how a camera takes a picture (sort of). The colored circles represent the objects being photographed. The flat line is the photograph itself.

Try it: Drag the circles.

This is incidentally how all 3D games today are rendered to your screen. It is the Standard Projection, formally known as the Rectilinear Projection.

Note: Did you notice how the projection stretches near the edges of the photograph?

Unfortunately, stretching is a nasty side effect of the Standard Projection when used for wide-angle views. The screenshot below has 160 degrees of view (same as the figure above).

The guys in the image above are all the same size, but distortion increases toward the edges of the image. The Standard Projection is really only suited for 120 degrees at most. So if you want a wider view, you have to try another projection.

### The Panorama

The next figure is a top-down view of how a panoramic camera takes a picture (sort of). The film is no longer flat, but curved into a cylinder or sphere around the camera. After the picture is taken, we unroll it onto a flat frame.

Try it: Drag the circles.

The following screenshot shows what this looks like in-game, with the same horizontal degrees (160) as the rectilinear example screenshot above.

Note: This screenshot is much less wider than the rectilinear projection, and yet it is still able to capture the same view, but without distortion near the margins. In fact, the cylinder projection can be used to capture an entire 360 horizontal degrees, as seen in the following image:

It is hard to tell from a still image that this projection is ill-suited for games, but after watching the following clip, you will soon realize its most damning detriment.

The moving image creates a sense of nausea, stemming from the way that movement is translated into the projection. Though it creates a wide field with minor distortion, it sacrifices the predictable "warping" of the image that creates the sense of space and perspective. Thus, if we desire a less nauseating perspective, we must again move on to another projection.

### The Stereograph

The stereograph is a combination of the Standard and Panoramic projections. It combines the best of both by forming a wide field of view without sacrificing playability. The stereographic projection requires two cameras, illustrated by the following figure.

Try it: Drag the circles, and click the second camera to see the final projection.

The centered camera first projects the image onto the cylinder screen, exactly like before. But instead of unrolling it onto a flat frame, we use a second camera to project it onto a flat frame. The screenshot below shows what this looks like in-game.

The difference is subtle when showing only 160 degrees, but showing 300 degrees in the image below exaggerates what's really going on:

The idea here is that the stereographic projection increases the size of the objects near its margins, creating a predictable perspective effect.

Note: Did you notice that the guy in the far left in the image above is large, but undistorted?