ECSE-4750 Computer Graphics, Rensselaer Polytechnic Institute, WR Franklin, Final Exam questions 2014, plus unused and old questions, with some solutions

 


NAME: ___W. Randolph Franklin



EMAIL:__________________________ RIN:__________________________




TOTAL: ___________/140


  • There are 35 questions. Answer them all. However, you may write free as the correct answer to any two questions.
  • Each question is worth 4 points.
  • There are 10 pages.
  • This exam is closed book; you may have two 2-sided letter-size note sheets. You may not use computers or communication devices, or share material with other students.


  1. ________ If a=(5,1,2) then write {$(a\cdot p)\, a$} as a matrix M, depending only on {$a$}, times {$p$}.
    {$ \begin{pmatrix} 25& 5 & 10 \\ 5 & 1 & 2 \\ 10 & 2 & 4 \end{pmatrix} $}
  2. ________ Why can the following not possibly be a 3D Cartesian rotation matrix? {$ \begin{pmatrix} 2& 0 &0\\1 & 0 &0\\0& 0 &2\end{pmatrix} $}
    Any of the following suffice: The determinant is not 1. No column's length is 1. The columns are not perpendicular.
  3. ________ Consider a 3D triangle with vertices (1,2,3), (5,0,1), (0,2,0). What is the z value of the point in the triangle with x=0, y=1?
    The equation of the plane is 3x+7y-z=14. So z= -7.
  4. ________ Write the vector formula for the 3D rotation by 60 degrees about the Z axis.
  5. ______ Can the volume of a small cube change when its vertices are rotated? Justify your answer.
  6. ________ Does projection preserve straight lines? Justify your answer.
  7. ________ Does projection preserve angles? Justify your answer.
  8. ________ Name the effect which accentuates the visibility of the common edge between two adjacent bands of slightly different brightness.
    The Mach band effect.
  9. ________ 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. Texture coordinates.
  10. ______ Before memory was cheap enough for depth buffers to be practical, one hidden surface technique involved sorting the objects by distance and then drawing them into the color buffer back-to-front. Name this method.
    The painter's algorithm.
  11. ______ Clouds and crowds are examples of what type of system?
  12. ________ 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.
  13. _______ What is this technique in shader programs called: p.xyzw = q.wyzx
    Swizzling.
  14. _______ Can the standard OpenGL pipeline easily handle light scattering from object to object? Why (not)?
    No, because it processes objects independently from each other.
  15. ________ 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.
  16. ________ When using 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.
  17. ________ When using 2D homogeneous coordinates, what is the equation of the line through the points (0,1,1) and (2,2,2)?
  18. ________ When using 2D homogeneous coordinates, at what point do the lines x+y+w=0 and x+2y+3w=0 intersect?
  19. ________ Consider the triangle with Cartesian vertices (0,0,0), (1,0,0),(0,1,1). What is the normal to its surface? Your answer must be normalized.
  20. ________ 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?
    {$ \begin{pmatrix} 0 & -4 & 0 \\ 4 & 0 & 0 \\ 0 & 0 & 4 \end{pmatrix} $}
  21. ________ What is the quaternion for a 90 degree rotation about the X axis?
    q = cos(45) + sin(45) i = .7 + .7i
  22. ________ What is the quaternion for a 180 degree rotation about the Z axis?
  23. ________ Assume that one rotation is expressed as the quaternion j and that a 2nd rotation is the quaternion k. What is the quaternion for those two rotations in order combined?
  24. ________ What is its axis and angle?
  25. ________ 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? Saying, "the curve looks bad", is not informative enough.
  26. _______ Write the equations for the following projection: The camera is at (0,0,0). The projection plane is x+y+z=4. Use cartesian coordinates. In other words tell me what the general point {$(x_0 , y_0 , z_0 ) $} projects to.
    The point will scale by {$ \frac{4}{x_0 + y_0 + z_0} $}. {$ x_0 \rightarrow \frac{4}{x_0 + y_0 + z_0} x_0 $}. {$ y_0 \rightarrow \frac{4}{x_0 + y_0 + z_0} y_0 $}. {$ z_0 \rightarrow \frac{4}{x_0 + y_0 + z_0} z_0 $}.
  27. ________ Write the homogeneous 4x4 matrix for the above transformation.
  28. ________ 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?
    Even if you could compute the appropriate texel size for an object at a certain position, if it moves, as the object's distance from the camera changes, the projected size of the texels will change.
  29. ________ 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.
  30. _______ Name the rendering technique where diffuse light bounces from object to object.
  31. _______ Name the type of mapping that can have a shiny doorknob reflect its surroundings.
  32. _______ Name the type of mapping that combines a diffuse object color with a light texture.
  33. ________ With view normalization,
    1. Do distances change? y         /       n
    2. Do angles change? y         /       n
    3. Do straight lines stay straight? y         /       n
    4. Do parallel lines stay parallel? y         /       n
  34. _______ It can happen that two objects appear to be the same color under incandescent light but differently colored under fluorescent light.
    1. What are these color pairs called?
    2. How can this happen?
  35. _______ Place these 3 steps in order from earliest to latest.
    • fragment processing
    • rasterizing
    • vertex processing
    vertex processing, rasterizing, fragment 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

v

  * user-specified specular lights with specular material colors.     y         /       n,     y         /       n
  1. ______ 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.
  2. ______ For each of those say whether the color changes when only the camera moves, by marking the 2nd y / n group.
    Look at this shader program:
      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;
    }
    
    
  3. ________ Is this a vertex shader or a fragment shader?
  4. ________ Where does the variable gl_Vertex get its value?
  5. ________ Where does the variable lightPos get its value?
  6. ________ Who uses the value of variable N after this shader finishes?
  7. ________ What is this code doing? What is lightPos?
        uniformLoc = glGetUniformLocation(progObj, "lightPos");
        if (uniformLoc != -1)
            glUniform3fv(uniformLoc, 1, lightPos0Eye);
    
    
  8. _______ In a shader, what is the difference between a uniform variable and a varying variable?
    From https://www.opengl.org/wiki/Uniform_%28GLSL%29: A uniform is a global GLSL variable declared with the "uniform" storage qualifier. These act as parameters that the user of a shader program can pass to that program. ... Uniforms are so named because they do not change from one execution of a shader program to the next within a particular rendering call. This makes them unlike shader stage inputs and outputs, which are often different for each invocation of a program stage.
    From https://www.opengl.org/sdk/docs/tutorials/ClockworkCoders/varying.php: Varying variables provide an interface between Vertex and Fragment Shader. Vertex Shaders compute values per vertex and fragment shaders compute values per fragment. If you define a varying variable in a vertex shader, its value will be interpolated (perspective-correct) over the primitive being rendered and you can access the interpolated value in the fragment shader.
  9. _______ In a shader, what does this code do: v.yxzw = v.xyzw ?
  10. ________ 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);
    
    
    1. What is this curve being used for?
    2. The curve is being created from control points stored in curvePoints. In what coordinate space are those points defined?
  11. ______ Designers usually use Bezier curves, where the curve goes near (but not through) the interior control points. They do not usually use Catmull-Rom curves, where the curve goes through all the control points. Why?
    In that case, the curve would be forced to swing widely outside the convex hull of the control points by an unintuitive amount (or else have a sharp bend). It was considered preferable to keep the curve smooth and inside the control polygon but have it not go through the interior control points.
  12. ______ Imagine a 2-D quadratric Cartesian Bezier curve with control points P0(0,0), P1(1,0), P2(0,1). What are the points on the curve with t=0, t=1/2, t=1?
  13. ______ Imagine a 2-D quadratric Cartesian Bezier curve with control points P0(0,0), P1(1,0), P2(0,1). Imagine that you are joining a 2nd Bezier curve to the end of this one, so that there is C1 continuity at the joint. What are the 1st and 2nd control points of this new curve?
  14. ______ How many degrees of freedom would a 2-D quadratric Cartesian Bezier curve have?
  15. ______ What do these lines do:
    1. ______ glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, order, controlPoints[0]);
    2. ______ glEnable(GL_MAP1_VERTEX_3);
    3. ______ glMapGrid1f(100, 0.0, 1.0);
    4. ______ glEvalMesh1(GL_LINE, 0, 100);
    5. ______ glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 6, controlPoints[0][0]);
    6. ______ glMapGrid2f(20, 0.0, 1.0, 20, 0.0, 1.0);
    7. ______ glEvalMesh2(GL_LINE, 0, 20, 0, 20);
    8. ______ glEvalCoord1f(u);
    9. ______ glEnable(GL_MAP2_VERTEX_3);
  16. ______ What are the usually used conditions at the joint between 2 cubic Bezier curves so that the joint is invisible?
  17. ______ How many degrees of freedom would a 3D cubic homogeneous Bezier patch have?

n

  1. ______ Give 3 reasons why we usually use a sequence of low-degree curves instead of one high degree curve.
    (These answers overlap; other answers are ok.) Local control. More intuitive relation between the control points and the curve. Less roundoff error during the computation. Better numerical conditioning in the solution equation - small changes in coefficients cause small changes in the curve. The higher degree curve doesn't give you any new capability.
  2. ______ Give 1 reason why we use parametric curves instead of explicit curves.
  3. ______ What do evaluators provide a way to do?
  4. ______ Give 1 reason why we use parametric curves instead of explicit curves.
  5. ______ What kind of curves can evaluators be used to draw?
  6. ______ What does the word Rational in NURBS mean?
  7. ______ What does the phrase non uniform in NURBS mean?
  8. ______ When are 3D texture maps useful?
  9. ______ An evaluator is often used to generate vertex positions. Name 3 other things an evaluator might generate.
  10. ______ What do the following lines do:
    1. ______ nurbsObject = gluNewNurbsRenderer();
    2. ______ gluNurbsProperty(nurbsObject, GLU_SAMPLING_METHOD, GLU_PATH_LENGTH);
    3. ______ gluNurbsProperty(nurbsObject, GLU_SAMPLING_TOLERANCE, 10.0);
    4. ______ gluBeginCurve(nurbsObject);
    5. ______ gluNurbsCurve(nurbsObject, 34, knots, 3, ctrlpoints[0], 4, GL_MAP1_VERTEX_3);
    6. ______ gluEndCurve(nurbsObject);
    7. ______ gluBeginSurface(nurbsObject);
    8. ______ gluNurbsSurface(nurbsObject, 19, uknots, 14, vknots, 30, 3, controlPoints[0][0], 4, 4, GL_MAP2_VERTEX_3);
    9. ______ gluNurbsSurface(nurbsObject, 4, uTextureknots, 4, vTextureknots, 4, 2, texturePoints[0][0], 2, 2, GL_MAP2_TEXTURE_COORD_2);
    10. ______ gluEndSurface(nurbsObject);
    11. ______ gluBeginTrim(nurbsObject);
    12. ______ gluNurbsCurve(nurbsObject, 10, curveKnots, 2, curvePoints[0], 4, GLU_MAP1_TRIM_2);
    13. ______ gluEndTrim(nurbsObject);
  11. ______ What is the tristimulus theory of color?
  12. ______ Why were experiments on people necessary to devise the CIE chromaticity diagram?
  13. ______ What did Philo T Farnsworth invent?
  14. ______ Define local control.
    One control point affects only a local part of the spline near it. Distant parts of the spline are not affected. They are affected only by the control points near them. In contrast, if you interpolate one polynomial through a set of points, then changing any point completely changes the entire polynomial.
  15. ______ A material's color is represented by 10 numbers. Name them.
  16. ______ What coordinate system do you define a trim line in?
  17. ______ What preprocessing technique handles a texel being much smaller (or much larger) than a pixel?
  18. ______ Aliasing becomes a problem when objects are what compared to a pixel's size?
    1. smaller
    2. larger
    3. the same
    4. The pixel size is irrelevant; aliasing happens when objects are all the same size.
  19. ______ The Bresenham line algorithm was devised to operate efficiently with (or without) what property of hardware?
  20. ______ What might clipping do to the number of vertices?
    1. The number of vertices might stay the same or reduce but not grow.
    2. The number of vertices might stay the same or grow but not reduce.
    3. The number of vertices might stay the same or grow or reduce.
    4. The number of vertices must stay the same.
  21. ______ In the 12 stage pipeline devised by Jim Clark, six stages are used for what operation?
  22. ______ What is the aliasing problem (in Computer Graphics)?
  23. ______ What are some solutions?
  24. ______ What is a mipmap?
  25. ______ What conditions are usually required when two cubic Bezier curves meet at a joint?
  26. ______ What happens if they're not met?
  27. ______ Define cubic Bezier curve.
  28. ______ What is a spline?
  29. ______ What is a bumpmap, and why is it useful?
    A texture is used to perturb the normal at each pixel of a polygon. The perturbed normal is input to the lighting equation. This is a cheap way to emulate small 3D relief on the polygon.
  30. ______ What is a texture sampler, and how is it more powerful than an array?
  31. ______ If you want to create a highlight in the middle of a triangle, can you do that by computing the color at each vertex and interpolating (rastering) the color across the triangle? Justify your answer.
  32. ______ In this code to compute diffuse lighting:
    float intensity = max(0.0, dot(N, normalize(L)));
    what's the point of max?
    It keeps the surface's brightness from going negative when the light is behind the polygon.
  33. ______ When I write C code to multiply a vector and a matrix, I probably write a for loop. However, in shaders you see simply this:
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
    Why don't you write a loop there?
    GLSL overloads operators like * for matrices and vectors. You could use a loop but it would probably be slower.
  34. ______ What is immediate mode?
  35. ______ What are the major advantages and disadvantages of immediate mode
  36. ______ Name a function that is immediate mode.
  37. ______ What happened to immediate mode in the current OpenGL? Why?
  38. ______ Name several things removed from the current (or recent) OpenGL.
  39. ______ Vertex buffer object:
    1. What is it?
    2. What are its major advantages and disadvantages?
  40. ______ What was the latest shader added to the OpenGL pipeline?
  41. ______ What does it do?
  42. ______ What does Primitive Assembly mean?
  43. ______ What is Face Culling?
  44. ______ What new shader computes the positions, normals, etc of new vertices created in a tesselation?
  45. ______ Which shader outputs a depth value and color values that will potentially be written (without any more interpolation or other processing) to the frame buffer?
  46. ______ What does this do: glEnableClientState(GL_COLOR_ARRAY);
  47. ______ What does this do: glVertexPointer(3, GL_FLOAT, 0, vertices);
  48. ______ What does this do: glViewport (0, 0, (GLsizei)w, (GLsizei)h);
  49. ______ What does this do: glMatrixMode(GL_PROJECTION);
  50. ______ What does this do: glLoadIdentity();
  51. ______ What does this do: glArrayElement(i);
  52. ______ What does this do: bufferData = (float*)glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
  53. ______ What does this do: glGenBuffers(2, buffer);
  54. ______ What does this do: glBindBuffer(GL_ARRAY_BUFFER, buffer[VERTICES]);
  55. ______ glWhat does this do: BufferData(GL_ARRAY_BUFFER, sizeof(vertices) + sizeof(colors), NULL, GL_STATIC_DRAW);
  56. ______ What does this do: glLinkProgram(programId);
  57. ______ What does this do: glEnableClientState(GL_VERTEX_ARRAY);
  58. ______ What does this do: glColorPointer(3, GL_FLOAT, 0, colors);
  59. ______ What does this do: glMatrixMode(GL_MODELVIEW);
  60. ______ What does this do: glClearColor(1.0, 1.0, 1.0, 0.0);
  61. ______ What does this do: glDrawElements(GL_TRIANGLE_STRIP, 10, GL_UNSIGNED_INT, stripIndices);
  62. ______ What does this do: programId = glCreateProgram();
  63. ______ Why is it inefficient to do computations in the display routine that could be done at initialization time.
  64. ______ What does this do:
    <body onload="webGLStart(); resizeCanvas(600); flipAnim()">
  65. ______ Look at the following block of code:
      attribute vec2 aVertexPosition;
      attribute vec3 aPlotPosition;
      varying vec3 vPosition;
      void main(void)  {
        gl_Position = vec4(aVertexPosition, 1.0, 1.0);
        vPosition = aPlotPosition; }
    
    
    1. In two words, what is this block of code?
    2. What does attribute mean?
    3. What does varying mean?
    4. What variable(s) are output to the next stage?
    5. What is the next stage?
  66. ______ Why are Euler angles not recommended for animating rotations?
    Smooth changes in the Euler angles cause nonsmooth changes in the object's orientation.
  67. ______ Given a sphere of radius one, what's the normal to the surface at the point (3/13, 4/13, 12/13)?
    A sphere's normals point straight out, so (3/13, 4/13, 12/13). Note that its length is already 1.
  68. ______ Describe a type of scene better suited for processing with radiosity than with ray tracing.
    Surfaces that reflect light onto each other diffusely.
  69. ______ What advantage does a cubic spline have over a quadratic spline?
    A cubic Bezier twists through space and is not confined to one plane. It's impossible to simulate that effect with a spline of planar, i.e., quadratic, pieces. Also, you can match curvature at the joint.
  70. ______ What type of light and surface specially handles a light source that is just above the horizon, compared to a light that is high up.
    Diffuse.
  71. ______ How would you make a spline that does not have a continuous tangent at a joint?
    Bunch up the control points. Three overlapping control points will make the tangent discontinuous at that joint, for a piecewise cubic spline.
  72. ______ Why do you need to clip away stuff that is behind the camera? I.e., what's especially bad about this stuff as opposed to stuff that is just outside the clip region?
    That stuff, which should be invisible, will project mixed in with stuff in front of the camera.
  73. ______ Why is the normalization transformation useful?
    It makes the clip volume to be a cube, and the projection to be straight down, which are easier to work with.
  74. ______ What's a mipmap and what's it good for?
    A pyramid of coarser and coarser texture maps, computed from the input hi-res texture map. Therefore it's easier to find a level whose texels are closer to the pixel size.
  75. ______ Why is 3D clipping usually implemented with six stages of a viewing pipeline?
    Each stage clips one side of the viewing cube. Breaking up the clipping operation like this makes it easier to implement.
  76. ______ What does this do:
    gl.vertexAttribPointer( vNormal, 3, gl.FLOAT, false, 0, 0 );
    Declare that the current buffer contains 3 floats per vertex.
  77. ______ What does this do:
    gl.bufferData( gl.ARRAY_BUFFER, flatten(normalsArray), gl.STATIC_DRAW );
    Write a array of normals, flattened to remove metadata, into the current buffer.
  78. ______ In the previous question, what does flatten mean?
    A 2D Javascript array has other data besides the array elements, such as its size. Flatten converts the array to a simple list of floats w/o any of this metadata. (Therefore the callee has to know the array size.)
  79. ______ What causes some people to be tetrachromats?
    For females, the two X chromasomes for the green retina cones are different, so they have two, slightly different, green cones. They can see four primaries: red, green-1, green-2, blue.
  80. ________ If a=(5,6,7) then write {$(a\cdot p)\, a$} as a matrix M, depending only on {$a$}, times {$p$}.
  81. ________ Why can the following not possibly be a 3D Cartesian rotation matrix? {$ \begin{pmatrix} 2& 0 &0\\1 & 0 &0\\0& 0 &1\end{pmatrix} $}
  82. ________ Consider a 3D triangle with vertices (1,2,3), (5,0,10), (0,20,0). What is the z value of the point in the triangle with x=3, y=1?
  83. ________ Write the vector formula for the 3D rotation by 60 degrees about the Z axis.
  84. ______ Can the volume of a small cube change when its vertices are rotated? Justify your answer.
  85. ________ Does projection preserve straight lines? Justify your answer.
  86. ________ Does projection preserve angles? Justify your answer.
    No. For example, a square may project to a rectangle (in a parallel projection) or trapezoid (in a perspective projection). The angle that the diagonal makes with an edge is no longer 45 degrees.
  87. ________ Name the effect which accentuates the visibility of the common edge between two adjacent bands of slightly different brightness.
  88. ________ 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.
  89. ______ Before memory was cheap enough for depth buffers to be practical, one hidden surface technique involved sorting the objects by distance and then drawing them into the color buffer back-to-front. Name this method.
  90. ______ Clouds and crowds are examples of what type of system?
  91. ________ 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.
  92. _______ What is this technique in shader programs called: v.xyz = u.yzx
  93. _______ Can the standard OpenGL pipeline easily handle light scattering from object to object? Why (not)?
  94. ________ 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.
  95. ________ When using 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.
  96. ________ When using 2D homogeneous coordinates, what is the equation of the line through the points (0,1,1) and (2,2,2)?
  97. ________ When using 2D homogeneous coordinates, at what point do the lines x+y+w=0 and x+2y+3w=0 intersect?
    (1,-2,1)
  98. ________ Consider the triangle with Cartesian vertices (0,0,0), (1,0,0),(0,1,1). What is the normal to its surface? Your answer must be normalized.
    (0, -.7, .7) or (0, .7, -.7)
  99. ________ 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?
    {$ \begin{pmatrix} 0 & -4 & 0 \\ 4 & 0 & 0 \\ 0 & 0 & 4 \end{pmatrix} $}
    Convert to a Cartesian 2x2 matrix. The determinant is -1, so it's not a rotation. Extra: It's a combo of a rotation and a reflection, which some people call an improper rotation.
  100. ________ What is the quaternion for a 90 degree rotation about the X axis?
  101. ________ What is the quaternion for a 180 degree rotation about the Z axis?
  102. ________ Assume that one rotation is expressed as the quaternion j and that a 2nd rotation is the quaternion k. What is the quaternion for those two rotations in order combined?
    q = jk = i
  103. ________ What is its axis and angle?
    Axis = X axis = (1,0,0). Angle = 180 degrees.
  104. ________ 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? Saying, "the curve looks bad", is not informative enough.
    Each piece is a quadratic Bezier curve and is planar. So, at each joint, the robot would suddenly have to switch from moving smoothly in one place to moving in another plane. IOW, its velocity would not be continuous. That's impossible for physical objects (unless it slowed to a stop at the joint).
  105. _______ 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.
  106. ________ Write the homogeneous 4x4 matrix for the above transformation.
  107. ________ 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?
  108. ________ 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.
  109. _______ Name the rendering technique where diffuse light bounces from object to object.
  110. _______ Name the type of mapping that can have a shiny doorknob reflect its surroundings.
  111. _______ Name the type of mapping that combines a diffuse object color with a light texture.
  112. ________ With view normalization,
    1. Do distances change? y         /       n
    2. Do angles change? y         /       n
    3. Do straight lines stay straight? y         /       n
    4. Do parallel lines stay parallel? y         /       n
  113. _______ It can happen that two objects appear to be the same color under incandescent light but differently colored under fluorescent light.
    1. What are these color pairs called?
    2. How can this happen?
  114. _______ 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. n, n
    • user-specified ambient lights with amfbient material colors. n, n
    • user-specified diffuse lights with diffuse material colors. y, n
    • user-specified specular lights with specular material colors. y, y
  115. ______ 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.
  116. ______ For each of those say whether the color changes when only the camera moves, by marking the 2nd y / n group.
    Look at this shader program:
      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;
    }
    
    
  117. ________ Is this a vertex shader or a fragment shader?
    It's a vertex shader since it refers to gl_Vertex.
  118. ________ Where does the variable gl_Vertex get its value?
    It's input from OpenGL program, perhaps set by glVertex.
  119. ________ Where does the variable lightPos get its value?
    It's imput from the OpenGL program, in which it will have been linked to a user variable.
  120. ________ Who uses the value of variable N after this shader finishes?
    The next stage in the pipeline. The next stage is typically the rasterizer or the Tesselation Control Shader.
  121. ________ What is this code doing? What is lightPos?
        uniformLoc = glGetUniformLocation(progObj, "lightPos");
        if (uniformLoc != -1)
            glUniform3fv(uniformLoc, 1, lightPos0Eye);
    
    
  122. _______ In a shader, what is the difference between a uniform variable and a varying variable?
  123. _______ In a shader, what does this code do: v.yxzw = v.xyzw ?
    It swizzles, that is, does a parallel assignment of 4 vector components.
  124. ________ 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);
    
    
    1. What is this curve being used for?
    2. The curve is being created from control points stored in curvePoints. In what coordinate space are those points defined?
  125. ______ Designers usually use Bezier curves, where the curve goes near (but not through) the interior control points. They do not usually use Catmull-Rom curves, where the curve goes through all the control points. Why?
  126. ______ Imagine a 2-D quadratric Cartesian Bezier curve with control points P0(0,0), P1(1,0), P2(0,1). What are the points on the curve with t=0, t=1/2, t=1?
    (0,0), (1/2, 1/4), (0,1)
  127. ______ Imagine a 2-D quadratric Cartesian Bezier curve with control points P0(0,0), P1(1,0), P2(0,1). Imagine that you are joining a 2nd Bezier curve to the end of this one, so that there is C1 continuity at the joint. What are the 1st and 2nd control points of this new curve?
    Q0(0,1), Q1(-1,2)
  128. ______ How many degrees of freedom would a 2-D quadratric Cartesian Bezier curve have?
  129. ______ What do these lines do:
    1. ______ glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, order, controlPoints[0]);
    2. ______ glEnable(GL_MAP1_VERTEX_3);
    3. ______ glMapGrid1f(100, 0.0, 1.0);
    4. ______ glEvalMesh1(GL_LINE, 0, 100);
    5. ______ glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 6, controlPoints[0][0]);
    6. ______ glMapGrid2f(20, 0.0, 1.0, 20, 0.0, 1.0);
    7. ______ glEvalMesh2(GL_LINE, 0, 20, 0, 20);
    8. ______ glEvalCoord1f(u);
    9. ______ glEnable(GL_MAP2_VERTEX_3);
  130. ______ What are the usually used conditions at the joint between 2 cubic Bezier curves so that the joint is invisible?
  131. ______ How many degrees of freedom would a 3D cubic homogeneous Bezier patch have?
    16 points with 4 coords gives 48 d.f.
  132. ______ Give 3 reasons why we usually use a sequence of low-degree curves instead of one high degree curve.
    The high degree curve: does not have local control, does not have as much of an intuitive relation between the control points and the curve, is more subject to numerical instability (loss of significant digits, roundoff error), is not necessary to achieve visible smoothness.
  133. ______ Give 1 reason why we use parametric curves instead of explicit curves.
    An explicit curve is single valued. If you rotated it, you'd have to cut it into pieces. A parametric curve can bend back onto itself, so this is not a problem.
  134. ______ What do evaluators provide a way to do?
  135. ______ Give 1 reason why we use parametric curves instead of explicit curves.
  136. ______ What kind of curves can evaluators be used to draw?
  137. ______ What does the word Rational in NURBS mean?
    You compute cartesian coordinates as the ratio of homogeneous coords.
  138. ______ What does the phrase non uniform in NURBS mean?
  139. ______ When are 3D texture maps useful?
  140. ______ An evaluator is often used to generate vertex positions. Name 3 other things an evaluator might generate.
    Color, surface normal, texture coordinates.
  141. ______ What do the following lines do:
    1. ______ nurbsObject = gluNewNurbsRenderer();
    2. ______ gluNurbsProperty(nurbsObject, GLU_SAMPLING_METHOD, GLU_PATH_LENGTH);
    3. ______ gluNurbsProperty(nurbsObject, GLU_SAMPLING_TOLERANCE, 10.0);
    4. ______ gluBeginCurve(nurbsObject);
    5. ______ gluNurbsCurve(nurbsObject, 34, knots, 3, ctrlpoints[0], 4, GL_MAP1_VERTEX_3);
    6. ______ gluEndCurve(nurbsObject);
    7. ______ gluBeginSurface(nurbsObject);
    8. ______ gluNurbsSurface(nurbsObject, 19, uknots, 14, vknots, 30, 3, controlPoints[0][0], 4, 4, GL_MAP2_VERTEX_3);
    9. ______ gluNurbsSurface(nurbsObject, 4, uTextureknots, 4, vTextureknots, 4, 2, texturePoints[0][0], 2, 2, GL_MAP2_TEXTURE_COORD_2);
    10. ______ gluEndSurface(nurbsObject);
    11. ______ gluBeginTrim(nurbsObject);
    12. ______ gluNurbsCurve(nurbsObject, 10, curveKnots, 2, curvePoints[0], 4, GLU_MAP1_TRIM_2);
    13. ______ gluEndTrim(nurbsObject);
  142. ______ What is the tristimulus theory of color?
  143. ______ Why were experiments on people necessary to devise the CIE chromaticity diagram?
  144. ______ What did Philo T Farnsworth invent?
  145. ______ Define local control.
  146. ______ A material's color is represented by 10 numbers. Name them.
    3 ambient color reflectivity components (R,G,B). 3 diffuse color components. 3 specular color components. Shininess exponent.
  147. ______ What coordinate system do you define a trim line in?
    In the parametric coordinate system of the patch that you're trimming.
  148. ______ What preprocessing technique handles a texel being much smaller (or much larger) than a pixel?
  149. ______ Aliasing becomes a problem when objects are what compared to a pixel's size?
    1. smaller
    2. larger
    3. the same
    4. The pixel size is irrelevant; aliasing happens when objects are all the same size.
  150. ______ The Bresenham line algorithm was devised to operate efficiently with (or without) what property of hardware?
    No floating point, and even multiplication was expensive.
  151. ______ What might clipping do to the number of vertices?
    1. The number of vertices might stay the same or reduce but not grow.
    2. The number of vertices might stay the same or grow but not reduce.
    3. The number of vertices might stay the same or grow or reduce.
    4. The number of vertices must stay the same.
  152. ______ In the 12 stage pipeline devised by Jim Clark, six stages are used for what operation?
  153. ______ What is the aliasing problem (in Computer Graphics)?
  154. ______ What are some solutions?
  155. ______ What is a mipmap?
  156. ______ What conditions are usually required when two cubic Bezier curves meet at a joint?
  157. ______ What happens if they're not met?
  158. ______ Define cubic Bezier curve.
  159. ______ What is a spline?
  160. ______ What is a bumpmap, and why is it useful?
  161. ______ What is a texture sampler, and how is it more powerful than an array?
    You input coordinates and output a color. More powerfully than an array, if the coordinates are not exactly at a texel, the sampler interpolates as necessary, using the rule that you specified, e.g., nearest, perhaps even between mipmap levels.
  162. ______ If you want to create a highlight in the middle of a triangle, can you do that by computing the color at each vertex and interpolating (rastering) the color across the triangle? Justify your answer.
    No because linear interpolation creates values inside the triangle that are never more than the brightest vertex.
  163. ______ In this code to compute diffuse lighting:
    float intensity = max(0.0, dot(N, normalize(L)));
    what's the point of max?
  164. ______ When I write C code to multiply a vector and a matrix, I probably write a for loop. However, in shaders you see simply this:
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
    Why don't you write a loop there?
  165. ______ What is immediate mode?
  166. ______ What are the major advantages and disadvantages of immediate mode
  167. ______ Name a function that is immediate mode.
  168. ______ What happened to immediate mode in the current OpenGL? Why?
    It was removed. Repeatedly sending the data to the GPU is too slow, so now we store data in the GPU in buffer objects. Implementing immediate mode takes effort.
  169. ______ Name several things removed from the current (or recent) OpenGL.
  170. ______ Vertex buffer object:
    1. What is it?
    2. What are its major advantages and disadvantages?
  171. ______ What was the latest shader added to the OpenGL pipeline?
  172. ______ What does it do?
  173. ______ What does Primitive Assembly mean?
    Assembling groups of vertices into higher objects, e.g., lines, triangles, or patches.
  174. ______ What is Face Culling?
  175. ______ What new shader computes the positions, normals, etc of new vertices created in a tesselation?
  176. ______ Which shader outputs a depth value and color values that will potentially be written (without any more interpolation or other processing) to the frame buffer?
  177. ______ What does this do: glEnableClientState(GL_COLOR_ARRAY);
  178. ______ What does this do: glVertexPointer(3, GL_FLOAT, 0, vertices);
  179. ______ What does this do: glViewport (0, 0, (GLsizei)w, (GLsizei)h);
  180. ______ What does this do: glMatrixMode(GL_PROJECTION);
  181. ______ What does this do: glLoadIdentity();
  182. ______ What does this do: glArrayElement(i);
  183. ______ What does this do: bufferData = (float*)glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
  184. ______ What does this do: glGenBuffers(2, buffer);
  185. ______ What does this do: glBindBuffer(GL_ARRAY_BUFFER, buffer[VERTICES]);
    It binds the buffer object name buffer[VERTICES], which you got with glGenBuffers, so that it will contain vertex array data.
  186. ______ What does this do: glBufferData(GL_ARRAY_BUFFER, sizeof(vertices) + sizeof(colors), NULL, GL_STATIC_DRAW);
    It creates a buffer object, whose name you had reserved with glGenBuffers, with sizeof(vertices) + sizeof(colors) bytes reserved. The application will set the once data later, and the data will be used for drawing.
  187. ______ What does this do: glLinkProgram(programId);
    It links a program object (that runs on the GPU) incorporating any shaders that you have attached to it, to create an executable that will run on the shaders.
  188. ______ What does this do: glEnableClientState(GL_VERTEX_ARRAY);
    Sets a flag so that future calls to glDrawArrays etc will use the vertex position information that you earlier specified in a vertex array.
  189. ______ What does this do: glColorPointer(3, GL_FLOAT, 0, colors);
    It specifies an array of colors, called colors, which the system will use in the future. Each color is 3 floats. There is no other data interleaved between the colors.
  190. ______ What does this do: glMatrixMode(GL_MODELVIEW);
    Says that any future call that affects a matrix will affect only the modelview matrix.
  191. ______ What does this do: glClearColor(1.0, 1.0, 1.0, 0.0);
    Says that when you clear the color buffer in future, it will be cleared to white.
  192. ______ What does this do: glDrawElements(GL_TRIANGLE_STRIP, 10, GL_UNSIGNED_INT, stripIndices);
    Draws a triangle strip with 10 vertices whose numbers are listed in the stripIndices array, which is unsigned ints. The numbers are indexed into a vertex array earlier specified perhaps with glVertexPointer.
  193. ______ What does this do: programId = glCreateProgram();
    It creates an empty program object, which you will later attach shaders to, link, etc.
  194. ______ Why is it inefficient to do computations in the display routine that could be done at initialization time.
    You're doing the computation many times instead of once.
  195. ______ What does this do:
    <body onload="webGLStart(); resizeCanvas(600); flipAnim()">
    In an HTML page, it defines a javascript callback to be called when the page is loaded. The listed routines initialize webgl, set the canvas size and set a flag that the webgl program will use.
  196. ______ Look at the following block of code:
      attribute vec2 aVertexPosition;
      attribute vec3 aPlotPosition;
      varying vec3 vPosition;
      void main(void)  {
        gl_Position = vec4(aVertexPosition, 1.0, 1.0);
        vPosition = aPlotPosition; }
    
    
    1. In two words, what is this block of code?
    2. What does attribute mean?
    3. What does varying mean?
    4. What variable(s) are output to the next stage?
    5. What is the next stage?