# Download PDF by J. Han: 3D Graphics for Game Pgmg. (rev.)

By J. Han

Similar nonfiction_6 books

Extra info for 3D Graphics for Game Pgmg. (rev.)

Example text

Therefore, Direct3D returns (Mview )T instead of Mview . 3 41 Per-vertex Lighting Fig. 13: The vertex position and normal are denoted by p and n, respectively. Once the light source and camera positions are defined, l, r, and v are obtained. Then, lighting can be computed per vertex. Light emitted from a light source is reflected by the object surface and then reaches the camera. Fig. 13 roughly describes what kinds of parameters are needed for lighting computation. The light source is defined in the world space.

15. The clipped polygons with black edges are further processed whereas those with red edges are discarded. Fig. 15 clearly shows the concept of clipping, but in reality clipping is not performed in the camera space. The projection transform is the last operation in the vertex processing stage, and it converts the camera-space objects into the clip space. Then, clipping is done at the clip space, as the space name implies4 . The projection transform is presented in the next subsection. 2 Projection Matrix The projection transform deforms the pyramidal view frustum into the axisaligned 2×2×1-sized cuboidal view volume, as shown in Fig.

Therefore, the third row of the projection Vertex Processing Fig. 20: 51 The projection transform converts the z -range [−f ,−n] to [−1,0]. 34) As shown in Fig. 20, the z -coordinates −f and −n are mapped to −1 and 0, respectively, by the projection transform. In other words, we have two known pairs of (z,z ): (−f ,−1) and (−n,0). 32) is determined. 22):  cot f ovy 2 aspect     0 0 0 0 0 0 cot f ovy 2 f 0 f −n 0 −1  0  0   nf  f −n 0 52 3D Graphics for Game Programming Exercises 1. Compute a 2D affine transform matrix that rotates a 2D point by θ about a point (a, b), not about the origin.