CS代考 COSC363-21S1 (C)

Mid-year Examinations, 2021 COSC363-21S1 (C)
No electronic/communication devices are permitted. Students may take exam question paper away after the exam.
Computer Science and Software Engineering EXAMINATION
Mid-year Examinations, 2021

Copyright By PowCoder代写 加微信 powcoder

COSC363-21S1 (C) Computer Graphics
Examination Duration: 120 minutes
Exam Conditions:
Closed Book exam: Students may not bring in any written or printed materials. Calculators with a ‘UC’ sticker approved.
Materials Permitted in the Exam Venue:
Materials to be Supplied to Students:
1 x Standard 16-page UC answer book
Instructions to Students:
• Answer all questions.
• This is a closed book exam. No written or printed material is allowed.
• Check carefully the number of marks allocated to each question. This suggests
the degree of detail required in each answer, and the amount of time you should
spend on the question.
• Use the separate answer booklet provided for answering all questions.
• No form of collaboration is permitted.
• This question paper carries a total of 50 marks.
• Total number of pages including cover page: 5
For Examiner Use Only
Question Mark
Page 1 of 5

Mid-year Examinations, 2021
COSC363-21S1 (C)
Questions Start on Page 3
Page 2 of 5

Mid-year Examinations, 2021 COSC363-21S1 (C)
Question 1. [14 marks for the whole question] Transformations
For each of the questions (a)-(c) given below, write a small code segment containing the functions mentioned in the question along with OpenGL transformation functions, glPushMatrix(), and glPopMatrix() functions for generating the required transformation.
(a). (4 Marks) Refer to Fig. 1a. The model consists of two parts A (arrow), and B (base). The base is positioned at the origin, and the arrow can rotate about the pivot point P = (-5, 10, 0). In its initial configuration, the arrow makes an angle of 45 from the horizontal on the xy-plane. The following two functions are used to draw the model:
drawArrow();
drawBase();
Write a code segment that performs the following transformation: The arrow is rotated about P so that it is horizontal, pointing in the direction of –x axis. Both the arrow and the base are then rotated about the y-axis, so that the arrow points towards –z axis.
(b). (6 Marks) Refer to Fig. 1b. The top figure (i) is produced by calling a function drawBeetle(). Write the code segment that creates two copies of the object and transforms them as shown in the bottom figure (ii).
(c). (4 Marks) Refer to Fig. 1c. The top figure (i) is produced by calling a function drawTriangle(). The triangle’s base is 2 units and height 1 unit. Write the code segment that transforms the triangle as shown in the bottom figure (ii).
Fig. 1a Fig. 1b Fig. 1c
Page 3 of 5

Mid-year Examinations, 2021
COSC363-21S1 (C)
Question 2. [8 marks for the whole question] Illumination Models
Fig. 2 shows the normal vector n, light source vector l, and the view vector v at a vertex P. All vectors are unit vectors on the xy-plane.
(a). (2 Marks) Redraw this diagram in your answer booklet, and show the reflection vector r and the half-way vector h.
(b). (2 Marks) Using the angles given in the diagram, find the angles between n and h and also the angle between r and v.
(c). (4 Marks) Compute the colour at the vertex P using the above angles in the formula: Pcolour = Lamb Mamb + (n•l) + (n•h) f .
Lamb = (0.2, 0.2, 0.2), Ldif = (1, 1, 1), Lspe = (1, 1, 1)
Mamb= (1, 0, 1), Mdif = (1, 0, 1), Mspe = (1, 1, 1), f = 1.
Question 3. [5 marks for the whole question] Object Modelling, Texture Mapping
A triangle fan is generated as shown in Fig. 3a, with p as the central vertex and v0, … v6
edge vertices. The image given in Fig. 3b is used for producing a texture mapped output of the triangle fan as shown in Fig. 3c.
Write a code segment containing a glBegin()-glEnd() block, defining the texture mapped model of the triangle fan. In the code segment, use (px, py, pz) as coordinates of the central vertex, and (vx[i], vy[i], vz[i]) the coordinates of the vertex vi, i = 0..6. Also, please specify the texture coordinates at each vertex. You are not required to include any other vertex attributes such a colour or normal vector in your code.
Page 4 of 5

Mid-year Examinations, 2021 COSC363-21S1 (C)
Question 4. [8 marks for the whole question] Viewing and Projection
(a). (4 Marks) Draw a sketch of the canonical view volume, including the axes of the clip
coordinate reference frame.
(b). (2 Marks) On the canonical view volume, mark a point on the near plane and another point on the far plane, and write their clip coordinates.
(c). (2 Marks) What is meant by pseudo-depth of a point? What is the pseudo-depth of a point on the near plane?
Question 5. [6 marks for the whole question]
A primary ray in a ray tracing algorithm meets an object at a point P = (0, 0, -40) (Fig. 4). The scene contains only one light source located at the point L = (0, 40, -10). A shadow ray is generated at P to determine if the point P is in shadow.
(a). (3 Marks) Write the components of the unit vector along the shadow ray at P.
(b). (3 Marks) The shadow ray returns a value 52 for the ray parameter t at the closest point of intersection.
(i) What does this value of t represent?
(ii) Is the point P in shadow? If yes, why; if not, why not?
Question 6. [9 marks for the whole question] Tessellation Shaders
(a). (2 Marks) Briefly outline two main operations performed in a tessellation control shader.
(b). (3 Marks) A primitive of type GL_PATCHES is not directly renderable. Briefly explain how a primitive of this type is used and a renderable object is produced in an OpenGL-4 application.
(c). (4 Marks) A quad domain is tessellated as shown in Fig. 5 below. Write the inner and outer tessellation levels used in generating the figure, and give the tessellation coordinates of the points C, D andE.
End of Examination
Page 5 of 5

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com