12.2 PIXELS
ؕؓThe fundamental task is converting lines, points and surfaces in 3D space, to be depicted on a 2D screen using colored pixels, or printed on paper with dots, or plotted with pens.
A computer screen is made up of an square array of points (pixels). The points can be lit up. When viewed as a whole these points make a picture.
One major problem is making a map between a geometry model (a collection of points) and what we see on the screen. This is accomplished with the perspective transform.
12.2.1 The Perspective Transform
A set of basic viewing parameters may be defined (variations are also common),
As seen above the viewing parameters can all be combined using simple matrix multiplication which will convert a point in 3D space to a point on the screen.
The process of drawing an object is merely applying this transformation to each point in the 3D model, then using the resulting (x, y) point on the 2D screen. (Note: If this transformation is done properly then z = depth in the view plane.)
The point mapped to the computer screen can then be converted to a single pixel using a simple scaling calculation. (Note: It is not shown, but if a point is off the screen, then it cannot be drawn.)
Visual display can be done using,
For the sake of simplicity, the remaining graphics methods ignore some trivial operations such as screen coordinates, line clipping at edge of screen, etc.
The `z' value after the perspective transform gives a relative depth of a point. This can be used later for depth sorting, or to set light intensity to cue the user to view depth.