Week 7 Tutorial

Question 1

Consider the OpenGL code:

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(2, 2, 2, 0, 0, 0, 0, 1, 0);

This sets up the modelview matrix for a camera with eye position (2,2,2), looking at (0,0,0) and up vector (0,1,0). (See pages 264-265 of text.)

The origin of the UVN (camera) co-ordinate system is (2,2,2) (eye position). The view plane normal (VPN) points from where we’re looking at to the eye.

VPN = eye - look

(a) Calculate n, u, and v, the basis for the camera’s coordinate system.

(b) Calculate the matrix that transforms from UVN (camera coordinates) to XYZ (world coordinates). When would this be useful? Hint: Think about a camera mounted in a car.

(c) Calculate the matrix that transforms from XYZ (world coordinates) to UVN (camera coordinates).

Question 2

Draw the BSP tree that results when inserting the edges shown below in the diagram below, in the order indicated by the numbers (i.e., in lectures we picked a polygon to split on randomly, but for this case, insert the polygons in the order indicated).

edges for BSP The front side of each edge is marked with a dot - when you draw the tree put the subtree corresponding to the front side on the left.

If the viewpoint is as indicated in the diagram, what order will the edges be rendered in?

What order must the edges be inserted in order to minimize the number of edges that must be split? You can check your answer with the BSP tree applet.

Question 3

Consider three algorithms for visible surface determination: BSP tree, Z-buffer and depth sort. What difference to the output (if any) can a different ordering of the objects make for each of these three algorithms?

Comments are closed.


Bad Behavior has blocked 50 access attempts in the last 7 days.