

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Example Problem You are standing at the point (3,0,0), looking at the point (0,4,0). The up direction in this case is along the y-axis, [0 1 0]. Your image plane is 1 unit away, and has a size of 3 by 4. Your far plane is 10 units away. Step 1: Translate eye point to origin: 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 3 Step 2: Rotate so that you’re looking down the –z axis, with VUP being up. VPN = (3,0,0)-(0,4,0) = [3 -4 0] VUP = [0 1 0] X’=VUP x VPN = [0 0 3]. Y’ = VPN x X’ = [-12 -9 0] Z’ = VPN = [3 -4 0] Normalize: x’ = [0 0 1], y’= [-12/15 -9/15 0] = [-4/5 -3/5 0], z’ = [3/5 -4/5 0]. You could check that this is an orthonormal system by verifying that the size of each is 1, and that the dot product of any two is zero. So, the rotation matrix is:
Step 3: Scale the matrix appropriately. Assume a perspective projection (the question didn’t say, here). Then the 3x4 area at 1 unit away is equivalent to a 30x40 area at the far plane, 10 units away. That is, it goes from –15 to +15 in x, and –20 to +20 in y. You want to scale this to the canonical view volume, which has a far plane 1 unit away in z, and goes from –1 to 1 in both x and y. So, the scaling matrix is:
If you, instead, had a parallel projection, the x and y extents wouldn’t change, so at the far plane (10 units away), they’d extend from –1.5 to 1.5 in x, and –2 to 2 in y. Scaling to the canonical view volume, then, is accomplished by the scale matrix:
Step 4: Projection Everything is in the canonical view volume now, so just project to the z=1 plane, so that the x and y values in the viewing volume will be in the –1 to 1 range (after adjusting for homogeneous coordinates. The projection matrices for parallel and perspective projection, respectively, are: 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 and 0 0 1 0 0 0 1 0 0 1 0 0 1 0 0 0 . Now, just multiply together to get the final matrix. The transformation to canonical view volume for the perspective case is:
0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 3 =
And similarly for the parallel projection. Incorporating the projecion yields: