Computer Graphics

Revision Questions

1. (a) Why exactly does Gouraud shading produce an unsatisfactory answer for light sources which are close to a polygon relative to its size?
[5 marks]

(b) Suppose we have a unit cube centered at the origin, (ie, two opposite corners are (-0.5,-0.5,-0.5) and (0.5,0.5,0.5)). There is a light source at (a,b,c). Generate a formula for finding the colour reflected at any point (x,y,z) on the top surface of the cube, assuming that there is diffuse reflection. (Define any additional terms or notation that you introduce).
[10 marks]

(c) What would happen if (a,b,c) were inside the box?
[5 marks]

(d) How does the answer in (b) change if a specular reflection model is used?
[5 marks]

2. (a) Describe in detail the Cohen-Sutherland clipping algorithm for clipping a line segment (x1,y1,z1) to (x2,y2,z2) to a 3D canonical viewing volume specified as follows: the COP is at (0,0,0) and the clipping planes are x = ąz and y = ąz (there are no front and back planes).
[15 marks]

(b) The following specifies an alternative view volume: the COP is at (0,0,0), the view plane distance is 1, and the view plane window has vertices (1,0,1), (1,1,1) and (-1,0,1). Explain in detail how the Sutherland-Hodgman polygon clipping algorithm would work with this clipping region.
[10marks]

3. a) The cylinder in (1) below is centred at the origin as shown. It is drawn without hidden surface removal. Give viewing parameters sufficient to obtain the views (2), (3) and (4). You may ignore the view plane window and clipping plane parameters.
[10 marks]

[4 views of  a cylinder]

b) In a perspective projection, the observer's eye is at (1,1,1) and s/he is looking towards the origin. The viewplane is one unit distance from the observer's position, and between the observer and the origin. In the image the positive Z axis is required to be pointing vertically upward. Find the appropriate camera model parameters (VRP,VPN, VUV, COP) for this view.
[10 marks]

c) Construct the matrix which transforms from World Coordinates to Viewing Coordinates, for this view. and hence find a formula giving the projection of the world coordinate point (x,y,z) onto the viewplane.
[5 marks]

4. (a) The diagram below shows a plan view of a strange room with outside walls 1,2,3,4 and a "hole" demarcated by a,b,c,d. (Ignore the line AB, the points C, P1 and P2). Find a BSP tree to represent this room.
[5 marks]

[polygon with a hole and a line 
running through]

(b) Point P1 is inside the room and point P2 is outside. Show how the BSP tree can be used to determine for any point whether it is inside or outside the room.
[5 marks]

(c) Use the BSP tree traversal algorithm to obtain the back-to-front order of polygons from position C.
[5 marks]

(d) Line AB represents a path that a robot plans to take from A to B. It is required to know in advance which parts of this path will be inside and which outside the room. Show how to use the BSP tree to find these parts of line AB.
[5 marks]

(e) In general compare the BSP hidden surface algorithm with the z- buffer algorithm, stating the advantages and disadvantages of each.
[5 marks]

This may not be included, depending on time
5. (a) The diagram below shows a 2D analog of part of a ray traced scene. There are six "surfaces" A,B,C,D,E,F and a number of rays are shown. Based on the behaviour of the rays at the surfaces, identify the kind of reflective property which each surface has.
[5 marks]

[2D ray traced scene]

(b) Write a program showing the main recursive ray tracing function.
[7 marks]

(c) Suppose the scene consists entirely of convex polyhedra. Taking into account the fact that the greatest amount of time in ray tracing is taken up by intersection calculations, describe in detail how you would test whether a ray intersected a given polyhedra.
[8 marks]

(d) How would you find the intersection point between a ray and a polyhedra.
[5 marks]