# 3D projection

Part of a series on |

Graphical projection |
---|

**3D projection** is any method of mapping three-dimensional points to a two-dimensional plane. As most current methods for displaying graphical data are based on planar (pixel information from several bitplanes) two-dimensional media, the use of this type of projection is widespread, especially in computer graphics, engineering and drafting.

## Orthographic projection

When the human eye looks at a scene, objects in the distance appear smaller than objects close by. Orthographic projection ignores this effect to allow the creation of to-scale drawings for construction and engineering.

Orthographic projections are a small set of transforms often used to show profile, detail or precise measurements of a three dimensional object. Common names for orthographic projections include plane, cross-section, bird's-eye, and elevation.

If the normal of the viewing plane (the camera direction) is parallel to one of the primary axes (which is the *x*, *y*, or *z* axis), the mathematical transformation is as follows;
To project the 3D point , , onto the 2D point , using an orthographic projection parallel to the y axis (profile view), the following equations can be used:

where the vector **s** is an arbitrary scale factor, and **c** is an arbitrary offset. These constants are optional, and can be used to properly align the viewport. Using matrix multiplication, the equations become:

- .

While orthographically projected images represent the three dimensional nature of the object projected, they do not represent the object as it would be recorded photographically or perceived by a viewer observing it directly. In particular, parallel lengths at all points in an orthographically projected image are of the same scale regardless of whether they are far away or near to the virtual viewer. As a result, lengths near to the viewer are not foreshortened as they would be in a perspective projection.

## Weak perspective projection

A "weak" perspective projection uses the same principles of an orthographic projection, but requires the scaling factor to be specified, thus ensuring that closer objects appear bigger in the projection, and vice versa. It can be seen as a hybrid between an orthographic and a perspective projection, and described either as a perspective projection with individual point depths replaced by an average constant depth ,^{[1]} or simply as an orthographic projection plus a scaling.^{[2]}

The weak-perspective model thus approximates perspective projection while using a simpler model, similar to the pure (unscaled) orthographic perspective. It is a reasonable approximation when the depth of the object along the line of sight is small compared to the distance from the camera, and the field of view is small. With these conditions, it can be assumed that all points on a 3D object are at the same distance from the camera without significant errors in the projection (compared to the full perspective model).

**Equation**

assuming focal length .

## Perspective projection

When the human eye views a scene, objects in the distance appear smaller than objects close by - this is known as perspective. While orthographic projection ignores this effect to allow accurate measurements, perspective projection shows distant objects as smaller to provide additional realism.

The perspective projection requires a more involved definition as compared to orthographic projections. A conceptual aid to understanding the mechanics of this projection is to imagine the 2D projection as though the object(s) are being viewed through a camera viewfinder. The camera's position, orientation, and field of view control the behavior of the projection transformation. The following variables are defined to describe this transformation:

- - the 3D position of a point
*A*that is to be projected. - - the 3D position of a point
*C*representing the camera. - - The orientation of the camera (represented by Tait–Bryan angles).
- - the viewer's position relative to the display surface
^{[3]}which goes through point C representing the camera.

Which results in:

- - the 2D projection of .

When and the 3D vector is projected to the 2D vector .

Otherwise, to compute we first define a vector as the position of point *A* with respect to a coordinate system defined by the camera, with origin in *C* and rotated by with respect to the initial coordinate system. This is achieved by subtracting from and then applying a rotation by to the result. This transformation is often called a **camera transform**, and can be expressed as follows, expressing the rotation in terms of rotations about the *x,* *y,* and *z* axes (these calculations assume that the axes are ordered as a left-handed system of axes):
^{[4]}
^{[5]}

This representation corresponds to rotating by three Euler angles (more properly, Tait–Bryan angles), using the *xyz* convention, which can be interpreted either as "rotate about the *extrinsic* axes (axes of the *scene*) in the order *z, y, x* (reading right-to-left)" or "rotate about the *intrinsic* axes (axes of the *camera*) in the order *x, y, z* (reading left-to-right)". Note that if the camera is not rotated (), then the matrices drop out (as identities), and this reduces to simply a shift:

Alternatively, without using matrices (let's replace (a_{x}-c_{x}) with **x** and so on, and abbreviate cosθ to *c* and sinθ to *s*):

This transformed point can then be projected onto the 2D plane using the formula (here, *x/y* is used as the projection plane; literature also may use *x/z*):^{[6]}

Or, in matrix form using homogeneous coordinates, the system

in conjunction with an argument using similar triangles, leads to division by the homogeneous coordinate, giving

The distance of the viewer from the display surface, , directly relates to the field of view, where is the viewed angle. (Note: This assumes that you map the points (-1,-1) and (1,1) to the corners of your viewing surface)

The above equations can also be rewritten as:

In which is the display size, is the recording surface size (CCD or film), is the distance from the recording surface to the entrance pupil (camera center), and is the distance, from the 3D point being projected, to the entrance pupil.

Subsequent clipping and scaling operations may be necessary to map the 2D plane onto any particular display media.

## Diagram

To determine which screen *x*-coordinate corresponds to a point at multiply the point coordinates by:

where

- is the screen
*x*coordinate - is the model
*x*coordinate - is the focal length—the axial distance from the camera center to the image plane
- is the subject distance.

Because the camera is in 3D, the same works for the screen *y*-coordinate, substituting *y* for *x* in the above diagram and equation.

## See also

- Viewing frustum
- 3D computer graphics
- Camera matrix
- Computer graphics
- Graphics card
- Homography
- Homogeneous coordinates
- Perspective (graphical)
- Texture mapping
- Virtual globe
- Transform and lighting

## References

- ↑ Subhashis Banerjee (2002-02-18). "The Weak-Perspective Camera".
- ↑ Alter, T. D. (July 1992).
*3D Pose from 3 Corresponding Points under Weak-Perspective Projection*(PDF) (Technical report). MIT AI Lab. - ↑ Ingrid Carlbom, Joseph Paciorek (1978). "Planar Geometric Projections and Viewing Transformations" (PDF).
*ACM Computing Surveys*.**10**(4): 465–502. doi:10.1145/356744.356750.. - ↑ Riley, K F (2006).
*Mathematical Methods for Physics and Engineering*. Cambridge University Press. pp. 931, 942. doi:10.2277/0521679710. ISBN 0-521-67971-0. - ↑ Goldstein, Herbert (1980).
*Classical Mechanics*(2nd ed.). Reading, Mass.: Addison-Wesley Pub. Co. pp. 146–148. ISBN 0-201-02918-9. - ↑ Sonka, M; Hlavac, V; Boyle, R (1995).
*Image Processing, Analysis & Machine Vision*(2nd ed.). Chapman and Hall. p. 14. ISBN 0-412-45570-6.

## Further reading

- Kenneth C. Finney (2004).
*3D Game Programming All in One*. Thomson Course. p. 93. ISBN 978-1-59200-136-1. - Koehler; Dr. Ralph.
*2D/3D Graphics and Splines with Source Code*. ISBN 0759611874.

## External links

Wikimedia Commons has media related to .3D projection |