## ECSE-4750 Computer Graphics, Rensselaer Polytechnic Institute, Final Exam, 13 Dec 2012

NAME: _______________________________________________EMAIL:__________________________ RIN:_________________________________

Subtotal of questions 1-5:____________/40, 6-15:________/40, 16-22:________/40, TOTAL: ___________/120

- There are 30 questions. There are 7 pages. Each question is worth 4 points.
- You may mark
**FREE**as the (correct) answer to any two questions. - 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.

*Math:*

- ________ Consider a cubic 3D Bezier curve with Cartesian control points
P0(0,0,0), P1(8,8,8), P2(8,8,8), P3(0,0,0). Compute the point P for
t=.5.

*For the next 3 questions, use 2D homogeneous coordinates:* - ________ What is the equation of the line through the points (0,0,3) and
(1,0,1). Write your answer in the form ax+by+cw=0, giving numbers for
a,b,c. Reduce a,b,c so that they have no common factors.

- ________ What is the equation of the line through the points (0,1,1) and (2,2,2)?

- ________ What is the point where those 2 lines intersect?

- ________ Consider the triangle with Cartesian vertices (0,0,0),
(1,0,0),(0,1,0). What is the normal to its surface? Your answer must be normalized.

- ________ Here is a 2D homogeneous transformation matrix. Prove that it
is, or is not, a rotation. If it is, then what is the angle of rotation?
{$ \left[ \begin{array}{ccc} 0 & -3 & 0 \\ 3 & 0 & 0 \\ 0 & 0 & 3 \end{array} \right] $}

- ________ What is the quaternion for a 180 degree rotation about the X axis?

- ________ What is the quaternion for a 180 degree rotation about the Y axis?

- ________ What is the quaternion for the first rotation about followed by the second?

- ________ What is its axis and angle?

*Graphics:* - ________ Suppose that you want to move a robot arm along a path that is a
spline curve. What is wrong with using a piecewise quadratic spline?
*The curve looks bad*is not acceptable here.

- _______ Write the equations for the following projection: The camera is at (0,0,0). The projection plane is x+y+z=3. Use cartesian coordinates.

- ________ Write the homogeneous 4x4 matrix for the above transformation.

- ________ When texture mapping for a scene with a perspective projection, it is usually not possible to create a single texture map whose texels will be the same size as pixels for all objects in the scene. Why?

- ________ Suppose that you are writing a flight simulator, where we are looking at the scene from outside the airplane. One obvious technique is to render the background before rendering the airplane. Name this technique.

- _______ Name the rendering technique where diffuse light bounces from object to object.

- _______ Name the type of mapping that can have a shiny doorknob reflect its surroundings.

- _______ Name the type of mapping that combines a diffuse object color with a light texture.

- ________ With view normalization,
- Do distances change?
*y/n* - Do angles change?
*y/n* - Do straight lines stay straight?
*y/n* - Do parallel lines stay parallel?
*y/n*

- Do distances change?
- _______ It can happen that two objects appear to be the same color under incandescent light but differently colored under fluorescent light.
- What are these color pairs called?

- How can this happen?

*Opengl:* - What are these color pairs called?
- _______ Place these 3 steps in order from earliest to latest.
- fragment processing
- rasterizing
- vertex processing

- ________ Consider these 4 types of lighting:
- user-specified color at each vertex.
*y/n, y/n* - user-specified ambient lights with ambient material colors.
*y/n, y/n* - user-specified diffuse lights with diffuse material colors.
*y/n, y/n* - user-specified specular lights with specular material colors.
*y/n, y/n*

- For each of those say whether the color changes when only the light moves, by circling y or n in the first y/n group above.
- For each of those say whether the color changes when only the camera moves, by marking the 2nd y/n group.

uniform vec3 lightPos[3]; varying vec3 N, L[3]; void main(void) { // vertex MVP transform gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; vec4 V = gl_ModelViewMatrix * gl_Vertex; // eye-space normal N = gl_NormalMatrix * gl_Normal; // Light vectors for (int i = 0; i < 3; i++) L[i] = lightPos[i] - V.xyz; // Copy the primary color gl_FrontColor = gl_Color; }

- user-specified color at each vertex.
- ________ Is this a vertex shader or a fragment shader?

- ________ Where does the variable gl_Vertex get its value?

- ________ Where does the variable lightPos get its value?

- ________ Who uses the value of variable N after this shader finishes?

- ________ What is this code doing? What is lightPos?
uniformLoc = glGetUniformLocation(progObj, "lightPos"); if (uniformLoc != -1) glUniform3fv(uniformLoc, 1, lightPos0Eye);

- _______ In a shader, what is the difference between a
*uniform*variable and a*varying*variable?

- _______ In a shader, what does this code do:
`v.yxzw = v.xyzw`

?

- ________ In the following code, the 2nd line clearly defines a nurbs curve.
gluBeginTrim(nurbsObject); gluNurbsCurve(nurbsObject, 10, curveKnots, 2, curvePoints[0], 4, GLU_MAP1_TRIM_2); gluEndTrim(nurbsObject);

- What is this curve being used for?

- The curve is being created from control points stored in curvePoints.
In what coordinate space are those points defined?

- What is this curve being used for?

*END*