CG ECSE-4750 Computer Graphics Final Exam Solution, RPI, Mon 2017-12-18

Name, RCSID:

WRF solutions

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 30 questions. Check that your copy of this test has all the pages.

Questions:

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

    1. fragment-shader
    2. primitive-assembly
    3. rasterizer
    4. vertex-shader

    answer:

    1. vertex-shader
    2. primitive-assembly
    3. rasterizer
    4. fragment-shader
  2. _____/2 If you do not tell OpenGL to do hidden surface removal, and depth buffer is not in use, and two objects overlap the same pixel, then what color is that pixel?

    1. OpenGL throws an error.
    2. the closer object
    3. the farther object
    4. the first object to be drawn there
    5. the last object to be drawn there

    answer:

    1. the last object to be drawn there
  3. _____/2 What is the purpose of vNormaljs in this line of code?

    var vNormaljs = gl.getAttribLocation( program, "vNormal" );

    It's the name of a shader attribute variable. getAttribLocation returns its location.

  4. _____/2 There is an aliasing problem when raytracing objects that are so small that one ray sent through the center of a pixel might go to the left of the object, and the next ray, through the center of the next pixel, go to its right. Give two ways to modify ray tracing to lessen this problem.

    1. randomize the position of the ray in each pixel.
    2. fire several rays through each pixel and average.
  5. _____/2 Bezier curves do not generally go through the their control points, except for the first and last control points. It would be quite easy to design a curve fitting system so that the curve goes through all the control points. However the CAD community has decided that they don't want this. Why?

    The curve will swing outside the control polygon by a nonintuitive amount.

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

    When the subscript is fractional, this will interpolate between the values of the adjacent texels.

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

    Transforms the universe, including the object, clip region, and projection, to make the clip region a 2x2x2 cube and the projection (x,y,z) -> (x,y,0).

    Clipping and projection are now easier.

  8. (2 pts) The last big update in the OpenGL standard removed many things from the standard. Name two things that we've discussed in class that we now have to implement ourselves if we wish to use.

    Lighting. Fog. Etc.

  9. _____/2 Consider this 2D homogeneous point: (2,3,4). Rotate it by 90 degrees. What is the resulting point, in a Cartesian representation?

    Cart: (1/2, 3/4). Cart rotation matrix: (0, -1 ; 1, 0). Rotated point: (-3/4, 1/2).

  10. _____/2 What is the 3x3 2D homogeneous matrix for a rotation by 90 degrees?

    (0, -1, 0 ; 1, 0, 0; 0, 0, 1)

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

    Projected point is a scaled version of input point.

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

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

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

  12. _____/2 Using homogeneous coordinates for spline control points gives the designer an extra tool. What happens to the curve when the designer changes the weight in a homogeneous control point?

    That attracts the nearby part of the curve closer to that point.

  13. _____/2 Why are the Bresenham line and circle drawing algorithms less useful now?

    Now, HW is faster and has floating point.

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

    Normals, texture coordinates, colors.

  15. _____/2 Given a=(3, 4, 5) compute a matrix M so that, for any p, (a ⋅ p) a = M p

    Mij = ai*aj.

    M = (9 12 15; 12 16 20; 15 20 25)

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

    1. Name this method.

      Painters algorithm.

    2. Describe one complexity with implementing it.

      When 2 objects have close Z values, it's impossible to tell which to draw first. A really bad case is 3 interlocking objects.

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

    Uniform: same value for all vertices. E.g., light position.

    Varying: computed in vertex shader. Interpolated by rasterizer. Input to fragment shader. E.g. color.

  18. _____/2 In this code to compute diffuse lighting:

    float intensity = max(0.0, dot(N, normalize(L)));

    where is the light source when max makes a difference?

    Behind face.

  19. _____/2 Given a sphere of radius one, what's the normal to the surface at the point (0,0,1)?

    (0,0,1)

  20. _____/2 3D clipping is usually implemented with six stages of a viewing pipeline. What are those 6 stages?

    Clip against a top plane, bottom plane, front plane, back plane, left plane, then right plane. (Order doesn't matter).

  21. _____/2 What causes some people to be tetrachromats?

    Two different versions of the green cone, most sensitive to 2 different wavelengths, gene on two X chromosones.

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

    Local control.

    More numerically stable (less roundoff error).

    Curve is more intuitive - small control point changes don't cause big curve changes.

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

    homogeneous.

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

    The number of vertices might stay the same or grow or reduce.

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

    Phong: input: normal at each vertex. interpolate them for each fragment. compute lighting at each fragment.

    Gouraud: input: normal at each vertex. compute lighting at each vertex. Or, input lighting at each vertex. interpolate lighting for each fragment.

    Gouraud faster but not as realistic.

  26. _____/2 What does it mean to separate the geometry from the topology when building a model?

    geometry is the vertex position.

    topology is which vertices define each edge and face.

    separate means to store them in separate arrays. Each vertex is stored only once.

  27. _____/2 Can the volume of a small cube change when its vertices are rotated? (yes or no). Why (not)?

    No since lengths don't change since rotations are rigid.

  28. _____/2 What does this do:

    gl.vertexAttribPointer( vNormal, 3, gl.FLOAT, false, 0, 0 );

    Tells GPU that the array of bytes storing the vertex normals is to be interpreted as groups of 3 floats per normal. vNormal is the address of the shader attribute variable for the normal.

  29. _____/2 What does this JS line do?

    document.getElementById("ButtonX").onclick = function(){axis = xAxis;};

    defines a callback for a button.

  30. _____/2 Where is the 3D homogeneous1point (1,0,0,0)?

    at infinity in the direction (1,0,0).

End of final exam