# CG ECSE-4750 Computer Graphics Final Exam Solution, RPI, Tues 2018-12-18

Name, RCSID: WRF solutions

## 1   Grade statistics

1. Number of final submissions: 27
2. Highest score: 74
3. Lowest score: 44
4. Average score: 61.78
5. Median score: 64

## 3   Rules

1. You have 180 minutes.
2. You may bring in two 2-sided 8.5"x11" papers with notes.
3. You may not share material with each other during the exam.
4. No collaboration or communication (except with the staff) is allowed.
5. There are thirty six questions. Check that your copy of this test has all the pages.
6. Full score is 76.

## 4   Questions

1. _____/2 Put these graphics pipeline components in the correct order:

2. primitive-assembly 2nd
3. rasterizer 3rd
2. _____/2 Which of the following 3D rotation methods is vulnerable to gimbal lock?

1. Euler angles *
2. matrix
3. quaternion
4. vector
3. _____/2 In the OpenGL pipeline, the Primitive Assembler does what?

1. fits together pieces of ancient Sumerian pottery.
2. rotates vertices as their coordinate systems change.
3. creates lines and polygons from vertices. *
4. finds the pixels for each polygon.
5. reports whether the keyboard and mouse are plugged in correctly.
4. _____/2 When rotating an object, what can happen to an object?

1. Straight lines might turn into curves.
2. Straight lines stay straight, but angles might change.
3. Straight lines stay straight, and angles don't change, but distances may change, either longer or shorter.
4. Straight lines stay straight, and angles don't change, but distances might get longer.
5. Straight lines stay straight, and angles and distances don't change. *
5. _____/2 If i and j are quaternions, what is i+j?

1. -k.
2. 0.
3. 1.
4. i+j, there is no simpler representation. *
5. k.
6. _____/2 If i and j are quaternions, what is ij?

1. -k.
2. 0.
3. 1.
4. i+j, there is no simpler representation.
5. k. *
7. _____/2 The quaternion i represents what rotation?

1. 180 degrees about the x-axis. *
2. 90 degrees about the x-axis.
3. 180 degrees about the y-axis.
4. 90 degrees about the y-axis.
5. no change, i.e., 0 degrees about anything.
8. _____/2 The parametric equation of a line through the points (1,1) and (2,3) is:

1. P = (1,1) + t(1,0) + u(0,1)
2. P = (1,1) + t(1,1)
3. P = (1,1) + t(1,2) *
4. P = (1,1) + t(2,3)
5. P = t(1,1) + u(2,3)
9. _____/2 The normal vector of length one to the plane through the points (1,0,0), (0,1,0), (0,0,1) is

1. (1,0,0)
2. $\left( \frac{1}{\sqrt{3}}, \frac{1}{\sqrt{3}}, \frac{1}{\sqrt{3}} \right)$ *
3. (-1, 0, 0)
4. 3
5. (1/3, 1/3, 1/3)
10. You call gl.BufferSubData to do what?

1. to add or replace part of the buffer in the GPU. *
2. to define a submarine object.
3. to subtract some data in the buffer.
4. to tell the GPU to look for a pattern and substitute any occurrences,
5. to tell the GPU to use a subroutine instead of the main program.
11. _____/2 Translating the 2D homogeneous point by (1,2,3) by (in Cartesian terms) dx=1, dy=2 gives which new homogeneous point?

1. (1,2,3)
2. (1,2,3,4)
3. (2,4)
4. (2,4,3)
5. (4,8,3) *

as Cart: (1/3,2/3)+(1,2) = (4/3,8/3)

12. _____/2 Rotating the 2D Cartesian point (0,1) by 90 degrees gives what:

1. (1,0)
2. (-1,0) * (corrected)
3. (0,1)
4. (0,-1)
5. (-.7,.7)
13. _____/2 Give me a matrix M that has this property: for all vectors p, $Mp = \begin{pmatrix}2&3&1\end{pmatrix} \times p$. The operator is the vector cross product.

$\begin{pmatrix}0 & -1 & 3 \\ 1 & 0 & -2\\ -3 & 2 & 0 \end{pmatrix}$

14. _____/2 In a fragment shader, a sampler2D does something more than a simple array lookup like you have in most programming languages. What?

If the subscripts are fractions, this blends the adjacent texels.

15. _____/2 Tell me about view normalization. What is it? What is good about it?

Transforms the scene and the projection together to make the projection orthogonal down one axis and the clip region a 2x2x2 cube centered on the origin. However a cube in the scene becomes a truncated pyramid. The simpler projection and clip polyhedron are a win. E.g., the hardware is simpler.

16. _____/4 Compute the projection equations when the viewpoint is at (0,0,0) and the projection plane is 2x+y+z=4. Use Cartesian coordinates. You do not need to put the result into a matrix form, but simplify your result as much as possible.

The projection will be a scaling since the center is at the origin. Point (x,y,z) will scale to (ax,ay,az) where 2ax+ay+az=4, so a=4/(2x+y+z). So, the projection is:

x' = 4x/(2x+y+z), y' = 4y/(2x+y+z), z' = 4z/(2x+y+z),

You could start with the matrix mentioned in class and end with this:

$\left( \begin{array}{cccc} 4 &0&0&0\\ 0&4&0&0\\ 0&0&4&0 \\ 2&1&1&0 \end{array} \right)$

17. _____/2 Name the algorithm that was designed to rasterize a circle using only integer additions, subtractions, and shifts.

Bresenham's circle algorithm.

18. _____/2 In a shader, what is the difference between a uniform variable and a varying variable?

A uniform variable is a global constant that is the same for all vertices. A varying variable is computed in the vertex shader and then interpolated across the polygon to give a value at each fragment that is input to the fragment shader.

19. _____/2 Give 2 reasons why we usually use a sequence of low-degree curves instead of one high degree curve.

No local control: changing one control point can change the whole curve. Badly conditioned matrix: a small change in a control point can cause a big change in the curve. Sensitivity to numerical roundoff errors.

20. _____/2 What does the word rational mean in NURBS?

NURBS use homogeneous coordinates, so their Cartesian X, Y, and Z are ratios.

21. _____/2 What is the difference between Phong shading and Gouraud shading?

Gouraud shading computes a color for each vertex and then interpolates it across the polygon (face). Phong shading starts with a surface normal at each vertex of the polygon and interpolates an approximate normal for each pixel of the polygon. Then, in the fragment shader, this approximate normal is normalized an input into the lighting equation that is the subject of the following question.

22. _____/2 In the Phong lighting model, which computes the color or brightness of each pixel, how do you make a surface material more metallic or shiny?

The shininess is the exponent of the dot product of the view vector and reflected vector. Higher means shinier.

23. _____/2 Where is the 3D homogeneous point (1,0,0,0)?

At infinity in the Cartesian direction (1,0,0). Informally, at the end of the positive X axis. The limit of the Cartesian point sequence (x,0,0) as x approaches infinity. The center of projection for a parallel projection down the X axis.

24. _____/2 Consider a 2D cubic Bezier curve with Cartesian control points (0,0), (1,1), (2,2), (3,3). What is the point at t=0.5?

1/8 (0,0) + 3/8 (1,1) + 3/8 (2,2) + 1/8 (3,3) = (3/2, 3/2)

25. _____/2 Describe what the curve in the previous question looks like.

A straight line from (0,0) to (3,3).

26. _____/2 What is Constructive Solid Geometry?

Constructive solid geometry allows a modeler to create a complex surface or object by using Boolean operators to combine simpler objects - Wikipedia.

27. _____/2 What texture mapping problem does the mipmap solve?

The projected size of the texels are usually not close to the size of the pixels. This is a problem because: If the texels are smaller than the pixels, aliasing issues arise. If larger, then several adjacent pixels will be the same color, making the image look posterized. Mipmaps solve this by precalculating a pyramid of texture maps that are coarser and coarser.

28. _____/2 Mathematically, the aliasing problem in CG

1. happens when high frequency signals are not sampled often enough.
2. happens when low frequency signals are sampled too often.
3. is a new problem that did not occur with the old displays.
4. can be reduced by subsampling and averaging
5. both (a) and (d). *
29. _____/2 About polygon clipping:

1. A polygon might gain vertices. *
2. A polygon might gain area.
3. If a polygon's vertices are all outside the clip region, then it may be deleted.
4. Using a 6-stage pipeline keeps the latency the same.
5. Concave polygons become convex.
30. _____/2 A small light source that is twice as far away is 1/4 as bright. That is, there is an inverse square fall off for brightness. However, when modeling light in graphics, we usually don't do that. Why?

Various reasons. The dynamic range of brightness in the scene would then be too great. If the light is bigger than a point and we're not too far away, or if there is ambient light, then the brightness falls off more slowly.

31. _____/2 What tool maps spectral colors into a human perceptual coordinate system? Your use it to determine the visual result of mixing colors.

The CIE Chromaticity diagram.

32. _____/2 With a B-spline, the joints are usually invisible because the two segments meet with C2 continuity. Sometimes a designer may want there to be a visible kink at a joint, i.e., wants only C0 continuity. How can that be achieved?

To reduce C2 continuity to C0 continuity at a joint, make 3 control points coincide.

33. _____/2 What's the hardest part of implementing the painters algorithm?

Sorting the polygons back to front. This is always hard if they overlap in Z and sometimes impossible. Then you have to split a polygon.

34. _____/2 Consider a cube. It has both geometry and topology. What is the geometry and what is the topology?

Geometry: the positions of the vertices. Topology: which vertices (i.e., their id numbers) make up the edges and faces.

35. _____/2 Name the javascript WebGL function that sets the current buffer for future buffer operations.

bindBuffer

36. _____/2 Name the javascript WebGL function that declares that the current buffer contains 3 floats per vertex (or generally some number of some type per vertex).

vertexAttribPointer

End of final exam. Total: 76 points.