## ECSE-4750 Computer Graphics, Rensselaer Polytechnic Institute, Final Exam (v2), Fall 2011, 15 Dec 2011 3-6pm, DCC330

ANSWERS

EMAIL:______________________________________________ RIN:_________________________________

Subtotal of questions 1-8:_______________, q 9-17:____________, q 18-25:____________, TOTAL: ______________

Answer every question.There are 6 pages with 25 questions. Each question is worth 4 points.

This exam is open book: you may use calculators and any paper books and notes that you brought with you. You may not use computers or communication devices, or share material with other students.

- ________ Consider a 3D triangle with vertices (0,0,0), (5,0,10), (0,20,0). What is the z value of the point in the triangle with x=3, y=1? The question is, what linear combo of the 3 vertices matches the x and y components of (3,1,z)? (3,1) = .6 (5,0) + .05 (0,20). So the answer is z= .6x10+.5x0 = 6.
- ________ Why can the following not possibly be a 3D Cartesian rotation matrix? {$ \begin{pmatrix} 1& 0 &0\\1 & 0 &0\\0& 0 &1\end{pmatrix} $} column 2 doesn't have length =1. Various other reasons are also ok.
- ________ If
*a=(4,3,5)*then write {$(a\cdot p)\, a$} as a matrix M, depending only on {$a$}, times {$p$}. {$$M = \left(\begin{array}{ccc} 16 & 12 & 20 \\ 12 & 9 & 15\\ 20 & 15 & 25 \end{array} \right). $$} {$$ p' = M p $$} - ________ What is the 4x4 homogeneous matrix for a 3D rotation by 90 degrees about the X axis,
followed by this translation:
*x'=x-1, y'=y+1, z'=z+2*. {$$M = \left(\begin{array}{rrrr} 1 & 0 & 0 & -1\\ 0 & 0 & -1 & 1\\ 0 & 1 & 0 & 2\\ 0 & 0 & 0 & 1\end{array} \right)$$} - ________ Write the vector formula for the 3D rotation by 60 degrees about the Y axis. {$$ p' = \frac{1}{2} \left(p + ((1,0,0)\cdot p)\, (1,0,0) \right) + \frac{\sqrt{3}}{2} (1,0,0)\times p $$} That can be written various equivalent ways.
- ______ Write the quaternion for the 3D rotation by 60 degrees about the Y axis. {$$ q = \frac{\sqrt{3}}{2} + \frac{1}{2} j $$}
- ________ What is one problem with interpolating a spline through the control points instead of approximating a spline near the points? The curve will swing outside the convex hull of the control points, by an amount that is not intuitive. If the control points are almost collinear, the curve might not be. IOW, it's harder to predict the curve from the control points.
- ______ What advantage do cubic splines have over quadratic splines? You can match the curve sections with their first two derivatives and the joint, making the joint generally invisible.
- ________ What technique computes the surroundings visible as a reflected image in a shiny object? environment mapping
- ________ When projected objects are less than one pixel large, there is a lot of fictitious high frequency clutter in the image. Name the technique used to fix this. anti-aliasing
- ________ In the graphics pipeline, does the rasterizer send its output to the
*vertex*or*fragment*shader? (Pick one, or pick both.) fragment shader. - ________ In the graphics pipeline, when a triangle is processed, the (x,y,z) coordinates of the vertices are interpolated across the whole triangle to give the coordinates of each fragment. Name two other things that may commonly be specified at the vertices and then interpolated across the triangle to give a value for each fragment. colors, normals.
- ________ Where in the graphics pipeline does texture mapping take place? fragment shader.
- ________ When clipping in 3D, how many independent clippers are required in the pipeline? 6 .
- ______ Do a view normalization of this square A(3,3), B(3,4), C(4,4), D(4,3) that is being viewed from (0,0) and projected into the plane x=1. The transformed square, when seen with a parallel projection from x= -infinity should look the same as the original square when seen in perspective from (0,0). That is, write the transformed coordinates for ABCD. Also, draw a figure showing the projection. See the figures in Gfiles:final-v2-ans-figs.pdf.
- ______ Are vertices assembled into objects in the vertex shader, in the fragment shader, or in the rasterizer? rasterizer.
- ________ Draw an example where clipping a polygon causes it to split into two pieces (connected by edges running along the edge of the clip window). See the figures.
- ________ Draw 1/8 of a circle of radius R=12 using the Bresenham method. Show your work. See the figures.
- ________ Following the principle that
*less is more*, the OpenGL designers decided not to include some functionality that a program that processes images would probably need. Name it. Reading and writing image files. - ________ When compositing several images, the limited precision of the color (frame) buffers may hurt the image quality. Therefore, OpenGL also has another buffer to composit into. Name it. Accumulation buffer.
- ______ Is the following code a vertex shader or a fragment shader?
`void main(void) { gl_FragColor = gl_FrontColor;}`

Fragment shader. - ______ Do you set a texture coordinate thus
`glTexCoord2f(s0, t0);`

before or after the vertex it applies to? Before. - _______ Can the standard OpenGL pipeline easily handle light scattering from
object to object? Why (not)?
No, because it processes vertices independently, often in separate graphics cores, and they cannot easily interact with each other.
Look at this fragment shader:
// diffuse.fs: per-pixel diffuse lighting varying vec3 N, L; void main(void) { // output the diffuse color float intensity = max(0.0, dot(normalize(N), normalize(L))); gl_FragColor = gl_Color; gl_FragColor.rgb *= intensity; }

- ______ Where do the variables N and L get their values from? Computed by the rasterizer (from per-vertex values supplied by the vertex shader).
- _______ What uses the value of the variable
`gl_FragColor`

? It becomes the color of the pixel, if this fragment passes other tests like the depth buffer.

*END*