Perspective Projection
The most unmistakable characteristic of perspective projection is perspective foreshortening: the farther an object is from the camera, the smaller it appears in the final image. This effect occurs because the viewing volume for a perspective projection is a frustum of a pyramid (a truncated pyramid whose top has been cut off by a plane parallel to its base). Objects that are closer to the viewpoint appear larger because they occupy a proportionally larger amount of the viewing volume than those that are farther away. This method of projection is commonly used for animation, visual simulation, and any other applications that strive for some degree of realism because the process is similar to how our eye (or a camera) works. The following command defines the frustrum of the viewing volume:
void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far);
This function calculates a matrix that accomplishes perspective projection and multiplies the current projection matrix by it. The viewing volume is defined by the four sides of the frustum, its top, and its bottom, which correspond to the six clipping planes of the viewing volume, as shown in Fig.5.28. Essentially, the viewing volume defines the world coordinates within which our 3D objects reside. Objects or parts of objects outside this volume are clipped from the final image.
viewing volume
near far
- 5.28: Viewing Frustrum near far
- 5.28: Viewing Frustrum
The projection plane is defined as a plane parallel to the base of the pyramid and centered at the viewpoint position. The following code from Example5_ll, shows the effect of changing the frustrum parameters. Changing the left, right, bottom and top planes is like changing the viewing lens on a camera - you can view your scene with a wide angle or a telephoto lens!
Post a comment