Winter Examination Period 2023 — January — Semester A
ECS762P COMPUTER GRAPHICS Duration: 2 hours
This is a 2-hour online exam, to be completed during a fixed 4-hour window.
You MUST submit your answers before the exam end time.
All instructions and guidelines from the exam page should be followed.
This is an open-book exam and you may refer to lecture material, text books and online
resources. The usual referencing and plagiarism rules apply, and you must clearly cite any
reference used.
Calculators are permitted in this examination. Please state on your answer book the name and
type of machine used.
Answer ALL questions
You MUST adhere to the word limits, where specified in the questions. Failure to do so
will lead to those answers not being marked.
YOU MUST COMPLETE THE EXAM ON YOUR OWN, WITHOUT CONSULTING OTHERS.
Examiners:
Dr. M. Hansard and Dr. P. Hao
Queen Mary University of London, 2023
Page 2 ECS762P (2023)
Question 1
(a) This question is about indexed drawing. Consider the following layout of 2D vertices:
0 1 2 3 4 5
6 7 8 9 10 11
12 13 14 15 16 17
(i) Describe (or sketch) the result of applying indexed drawing to the following two
index arrays (separately), using the LINE STRIP rendering mode:
[2,1,7,8] [15,16,10,4,3,9,10]
(ii) One of the 7 indices in the second array can be removed, without affecting the
geometric appearance of the image. Write the 6-index version of the array.
(iii) Suppose that the 10 indexed vertices all have different colour attributes. Would
the 7-index and 6-index version of the second array produce the same image
Explain your answer.
(iv) Suppose that the drawing mode is GL TRIANGLE STRIP. Give an index array that
could be used to create a solid rectangular background, covering the whole of the
drawing area in the diagram.
[8 marks — word limit 100]
(b) Explain two advantages of indexed drawing, compared to direct drawing of vertex
buffers.
[4 marks — word limit 100]
(c) This question is about attribute buffers. Complete the following visualization of a
float32 WebGL buffer (array), containing two [xi
, yi
, zi
] vertices, interleaved with
two [ri
, gi
, bi
] vectors of colour data, where i = 0, 1.
[ x0, y0, z0, … ]
Answer the following questions, and show your working:
(i) What is the length of the array, in bytes
(ii) What is the stride of the array, in bytes
(iii) What is the offset of the colour data, in bytes
[8 marks — word limit 30]
(d) Consider a unit surface normal n = [u, v, w]
. Suppose that only the [u, v] components are
stored. How could the constraint |n| = 1 be used to recover the w component, mathematically
What problem might be encountered, and how could it be solved efficiently
[5 marks — word limit 50]
Turn over
ECS762P (2023) Page 3
Question 2
(a) What is the purpose of the modelview matrix, and how is it usually specified, by the
programmer
[5 marks — word limit 100]
(b) What is Z-fighting, and why does it happen Briefly describe two possible ways to
avoid the problem.
[7 marks — word limit 100]
(c) Consider the following routines from two separate GLSL shaders, in which p is a vec4
vertex, and t is a uniform angle variable:
// SHADER1
void main() {
float s = sin(t);
float c = cos(t);
gl_Position.x = c * p.x – s * p.y;
gl_Position.y = s * p.x + c * p.y;
gl_Position.z = p.z;
gl_Position.w = p.w;
}
// SHADER2
void main() {
gl_Position = rot_xy(t) * p;
}
Give a complete GLSL implementation of the function rot_xy(t), so that the effect
of SHADER2 is exactly equivalent to that of SHADER1.
[10 marks — word limit 100]
(d) Suppose that A is a homogeneous affine transformation matrix, while B is a homoge_xfffe_neous projective transformation matrix. Commment on whether each of the following
transformations is affine, projective, or neither, in general. Explain your reasoning in
each case.
C = AA D = AB E = BA
[3 marks — word limit 100]
Turn over
Page 4 ECS762P (2023)
Question 3
(a) Give a real-world example of each of the following materials. Suggest a suitable
rendering model, in each case.
(i) A diffuse material.
(ii) A specular material.
(iii) A translucent material or substance.
[6 marks — word limit 100]
(b) What is the difference between per-vertex and per-fragment shading Which gives
better quality results, and why In what situations would the two approaches give
approximately the same result
[6 marks — word limit 100]
(c) Describe the Phong shading model, including the required inputs, and the mathemati cal formulation.
[6 marks — word limit 100]
(d) Consider a simple Lambertian shading model at surface point p, with normal vector n.
The light source is located at position q.
(i) Draw a sketch, showing p and n. Indicate three possible light locations q1, q2,
and q3, that would result in the same outgoing radiance L
(p), according to
the Lambertian model. Explain your sketch, including relevant mathematical
expressions.
(ii) Now suppose that the outgoing radiance from the light, L
(q), is subject to
attenuation. Comment on whether or not L
(p) would still be the same, for the
three light locations q1, q2, and q3 in your sketch from part (i).
[7 marks — word limit 100]
Turn over
ECS762P (2023) Page 5
Question 4
(a) Explain the use of texture coordinates, including the following considerations:
(i) How can texture coordinates be obtained and stored
(ii) How are texture coordinates transmitted to the shaders
(iii) How are texture coordinates interpolated across primitives
(iv) How are texture coordinates used in the fragment shader
[8 marks — word limit 100]
(b) Give two examples of post-processing effects, which do not require the full 3D
scene geometry. Where would these effects typically be implemented, in the WebGL
graphics pipeline
[3 marks — word limit 100]
(c) Consider a 3D scene full of identical party balloons, floating in the air.
(i) Describe a possible approach for rendering the scene, given only an RGB image
of a single ballon (without any 3D model of the shape).
(ii) Would your approach work properly if the balloons are all very translucent
Explain your answer.
(iii) Would your approach work properly if the balloons are all very reflective (e.g. made
of silver foil). Explain your answer.
[8 marks — word limit 100]
(d) This question is about deferred shading.
(i) How does the procedure work, and what data structures are involved
(ii) To what extent could deferred shading be used to implement the rendering
equation, in practice
[6 marks — word limit 100]
End of questions