UNIVERSITY OF EAST ANGLIA School of Computing Sciences Main Series PG Examination 2013-14 COMPUTER GAMES DEVELOPMENT CMPSME27 Time allowed: 2 hours Answer any THREE questions. (40 marks each) Notes are not permitted in this examination. Do not turn over until you are told to do so by the invigilator. CMPSME27 Module Contact: Dr Stephen Laycock, CMP Copyright of the University of East Anglia Version 1
Page 2 1. (a) Describe the steps for drawing a triangle in OpenGL version 3.0 using a vertex buffer object. Each vertex of the triangle should have a colour defined but the triangle should not be textured. Exact OpenGL commands are not required. (b) The OpenGL Shading Language (GLSL) brings some key advantages to the graphics programmer. Briefly describe the rendering pipeline and the places where the graphics programmer can use their GLSL programs. (8 marks) (c) Describe what is meant by the following terms: i. World space ii. Eye space iii. Clip space (d) Assume we are drawing a triangle with a different colour for each vertex and we would like the colours to be linearly interpolated across the face of the triangle. Describe, with the aid of diagrams how Gouraud shading is calculated to achieve this. (10 marks) (e) We would now like to light the triangle with per-pixel lighting. Describe how to calculate the diffuse and specular components of the Phong Illumination model. (10 marks)
Page 3 2. Assume you are a games programmer creating a virtual environment for a game. The renderer you are creating must be able to display textured triangles forming the models of the environment which can be lit with perpixel lighting effects. (a) The following piece of code is used to define the geometry for the flat ground plane of the environment. verts[0] = -dim; verts[ 1] = -dim; verts[ 2] = 0; verts[3] = -dim; verts[ 4] = dim; verts[ 5] = 0; verts[6] = dim; verts[ 7] = dim; verts[ 8] = 0; verts[9] = dim; verts[10] = -dim; verts[11] = 0; texcoords[0] = A; texcoords[1] = E; texcoords[2] = B; texcoords[3] = F; texcoords[4] = C; texcoords[5] = G; texcoords[6] = D; texcoords[7] = H; Assuming you would like to map the texture to the quad such that it repeats twice in the -axis and three times in the -axis describe what values you would use for A, B, C, D, E, F, G and H? (b) Mapping 2D textures to 3D objects is more complex than traditional 2D texturing. Describe, with the aid of diagrams, the two-part mapping approach to texture mapping. (12 marks) (c) Describe how bilinear and nearest-neighbour filtering work and the effect they have on the quality of textured geometry being rendered. (d) To prepare geometry for lighting calculations we need to calculate vertex normals for our 3D objects. Describe how to calculate per-vertex normals and detail any assumptions you are making. (e) We would now like to shine a spot light at the ground plane. Describe how you would calculate the illumination in the fragment shader using per-pixel lighting. (12 Marks) PLEASE TURN OVER
Page 4 3. (a) What is the difference between object space and image space hidden surface removal algorithms? (b) Explain how coherence helps many hidden surface removal algorithms. (3 marks) (c) Describe the operation of the Z-buffer algorithm. (d) Describe with aid of a diagram the active edge list algorithm. (9 marks) (e) How does spatial partitioning help hidden surface removal? Give three methods of partitioning and illustrate with diagrams. (8 marks) (f) (i) (ii) What is the fundamental property of BSP trees as used in hidden surface removal? Build the BSP tree for the following 2D representation. (The letter is on the front side of the polygon).
Page 5 4. (a) Describe the 3D transformations required to rotate an object around an axis parallel to one of the co-ordinate axis. (There is no need to specify the matrix details). (b) Use suitable diagrams to explain perspective projection and derive the homogeneous matrix which provides a perspective projection in 3D graphics. (9 marks) (c) What is an orthogonal projection? (3 marks) (d) What are the requirements for 3D curves as used in computer graphics and computer-aided design? (e) Explain why parametric cubic curves are used by designers using Computer Graphics and give the general mathematical representation of these curves. (f) What are the differences between Hermite, Bezier and B-Spline curve representations? END OF PAPER