CG ECSE4750 Computer Graphics Final Exam Solution, RPI, Tues 20181218
Name, RCSID: WRF solutions
Table of contents
1 Grade statistics
 Number of final submissions: 27
 Highest score: 74
 Lowest score: 44
 Average score: 61.78
 Median score: 64
3 Rules
 You have 180 minutes.
 You may bring in two 2sided 8.5"x11" papers with notes.
 You may not share material with each other during the exam.
 No collaboration or communication (except with the staff) is allowed.
 There are thirty six questions. Check that your copy of this test has all the pages.
 Full score is 76.
4 Questions

_____/2 Put these graphics pipeline components in the correct order:
 fragmentshader 4th
 primitiveassembly 2nd
 rasterizer 3rd
 vertexshader 1st

_____/2 Which of the following 3D rotation methods is vulnerable to gimbal lock?
 Euler angles *
 matrix
 quaternion
 vector

_____/2 In the OpenGL pipeline, the Primitive Assembler does what?
 fits together pieces of ancient Sumerian pottery.
 rotates vertices as their coordinate systems change.
 creates lines and polygons from vertices. *
 finds the pixels for each polygon.
 reports whether the keyboard and mouse are plugged in correctly.

_____/2 When rotating an object, what can happen to an object?
 Straight lines might turn into curves.
 Straight lines stay straight, but angles might change.
 Straight lines stay straight, and angles don't change, but distances may change, either longer or shorter.
 Straight lines stay straight, and angles don't change, but distances might get longer.
 Straight lines stay straight, and angles and distances don't change. *

_____/2 If i and j are quaternions, what is i+j?
 k.
 0.
 1.
 i+j, there is no simpler representation. *
 k.

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

_____/2 The quaternion i represents what rotation?
 180 degrees about the xaxis. *
 90 degrees about the xaxis.
 180 degrees about the yaxis.
 90 degrees about the yaxis.
 no change, i.e., 0 degrees about anything.

_____/2 The parametric equation of a line through the points (1,1) and (2,3) is:
 P = (1,1) + t(1,0) + u(0,1)
 P = (1,1) + t(1,1)
 P = (1,1) + t(1,2) *
 P = (1,1) + t(2,3)
 P = t(1,1) + u(2,3)

_____/2 The normal vector of length one to the plane through the points (1,0,0), (0,1,0), (0,0,1) is
 (1,0,0)
 \(\left( \frac{1}{\sqrt{3}}, \frac{1}{\sqrt{3}}, \frac{1}{\sqrt{3}} \right)\) *
 (1, 0, 0)
 3
 (1/3, 1/3, 1/3)

You call gl.BufferSubData to do what?
 to add or replace part of the buffer in the GPU. *
 to define a submarine object.
 to subtract some data in the buffer.
 to tell the GPU to look for a pattern and substitute any occurrences,
 to tell the GPU to use a subroutine instead of the main program.

_____/2 Translating the 2D homogeneous point by (1,2,3) by (in Cartesian terms) dx=1, dy=2 gives which new homogeneous point?
 (1,2,3)
 (1,2,3,4)
 (2,4)
 (2,4,3)
 (4,8,3) *
as Cart: (1/3,2/3)+(1,2) = (4/3,8/3)

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

_____/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}\)

_____/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.

_____/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.

_____/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)\)

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

_____/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.

_____/2 Give 2 reasons why we usually use a sequence of lowdegree 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.

_____/2 What does the word rational mean in NURBS?
NURBS use homogeneous coordinates, so their Cartesian X, Y, and Z are ratios.

_____/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.

_____/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.

_____/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.

_____/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)

_____/2 Describe what the curve in the previous question looks like.
A straight line from (0,0) to (3,3).

_____/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.

_____/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.

_____/2 Mathematically, the aliasing problem in CG
 happens when high frequency signals are not sampled often enough.
 happens when low frequency signals are sampled too often.
 is a new problem that did not occur with the old displays.
 can be reduced by subsampling and averaging
 both (a) and (d). *

_____/2 About polygon clipping:
 A polygon might gain vertices. *
 A polygon might gain area.
 If a polygon's vertices are all outside the clip region, then it may be deleted.
 Using a 6stage pipeline keeps the latency the same.
 Concave polygons become convex.

_____/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.

_____/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.

_____/2 With a Bspline, 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.

_____/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.

_____/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.

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

_____/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.