CS384G  Midterm Examination  Spring 2008

Each problem section is worth the indicated number of points. Show all work on these pages and don’t forget to put your name on one of them!

1. (15 pts) In the two dimensional cross section of a scene shown below, there are two lights, one point light and one directional light, as shown. Note that for the directional light, the arrow is in the direction the light travels rather than the direction of a vector pointing toward the light.

a) If the two spheres are assumed to have matte surfaces, indicate the brightest spot on the each sphere if the directional light is the only one turned on by placing an “d” at that spot on each sphere.

b) If the two spheres are assumed to have matte surfaces, indicate the brightest spot on the each sphere if the point light is the only one turned on by placing an “p” at that spot on each sphere.

c) Shade the portion of each sphere, if any, that will be completely unlit if both lights are on but there is no ambient light.

2. (5 pts) A matte surface in a scene you are creating has a normal vector of (1,1). If you forget to normalize (unitize) this vector before using it to calculate the diffusely reflected light, what will happen? (choose all that apply)

a) The diffuse reflected light will be too bright.

b) The diffuse reflected light will be too dim.

c) The diffuse reflected light will be correct.

d) The diffuse reflected light will be the wrong hue.

e) There will be no diffuse reflected light.

3. (5 pts) A matte surface in a scene you are creating has a normal vector of (1,1). If you forget to normalize (unitize) this vector before using it to calculate the ambient reflected light, what will happen? (choose all that apply)

a) The ambient reflected light will be too bright.

b) The ambient reflected light will be too dim.

c) The ambient reflected light will be correct.

d) The ambient reflected light will be the wrong hue.

e) There will be no ambient reflected light.

4. (10 pts) You are standing on a building at a height h above the ground. 200 yards in front of you is another building of equal height. A high wire is strung very tightly between the buildings, and there is a perfectly still, perfectly reflective 100 yard long swimming pool centered 50 yards from each of the two buildings. There are markers along the side of the pool at each yard, starting at the end opposite you, with numbers indicating the number of yards from that end of the pool. You are part of a high wire act, in which your blind partner starts walking along the wire toward you and at the earliest possible non-fatal moment falls off the wire into the water (too early and it’s much too concrete a fall). Your job (as the unseen assistant) is to tell the acrobat when to fall. (You have a radio transmitter and she has an earpiece, just in case you needed to know this). This has to be accurate, so you have to use the image of the acrobat in the pool and the markers along the side of the pool to figure out the distances rather than estimating them by eyeballing the position of the acrobat.

(a) What does the marker indicate as the position of the image of the acrobat when she starts along the wire from the edge of the building? (Show how you get your answer.)

(b) What does the marker indicate as the position of the image of the acrobat when she should be told to jump into the pool? (Show how you get your answer.)

5. (5 pts) You are using the procedural texture defined ( in Java-like pseudocode) to be

Color HunozTexture(float u, float v) {
  float i = abs(cos(pi * u) * cos(pi * v));
  Color c.Red = i;
  c.Green = i;
  c.Blue = i;
  return c;
}

where pi is a constant containing the value of pi. You are mapping this texture onto a flat rectangle in which the vertices have u,v coordinates of (0,0), (0,1), (1,0), (1,1) respectively. Sketch the rectangle, labeling the center point, each of the vertices, and the midpoints of each edge with their colors in RGB.

6. (10 pts) You are ray tracing the scene shown below in two-dimensional cross section, and you have just calculated that primary ray R starting at the eye and passing through the window hits object O as shown. Object O is a transparent polished glass sphere which reflects light from its surface as well as passing transparent light through. It is also shiny, meaning it has a specular highlight, but it doesn’t reflect any light diffusely and it doesn’t reflect any ambient light. All other objects in the scene are opaque Lambertian reflectors with no other type of reflection. Light sources are labelled as such. Sketch every ray cast by a Whitted-style raytracer which originates at the intersection point I of R and O and which is needed to calculate the color of the intersection point I. Make sure to indicate clearly any object or light source that each ray hits. Do any objects cast shadows on I? If so, which ones?

7. (20 pts) Suppose you have a regular tetrahedron modelled as a set of planes. The planes are each represented by the coefficients [A B C D] of a planar equation, Ax + By + Cz + D = 0, where [A B C] define a vector normal to the plane’s surface and pointing to the outside of the tetrahedron. One can take the coefficients of each plane as a column vector N = [A B C D] and premultiply that vector by a matrix T that transforms it in the same way that a matrix M can be used to transform a point P, that is, TN defines the same plane as MP applied to 3 points P on the plane.

(a) Show how to define T in terms of M. (HINT: another way to write the plane equation is N⃗^{T} P = 0 for any point P on the plane, where N⃗ = [A B C D] is a column vector.)

(b) What matrix T corresponds to M = [ \begin{matrix}cos θ & − sin θ & 0 & 0 \\ sin θ & cos θ & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{matrix} ]

(b) What matrix T corresponds to M = [ \begin{matrix}S_{x} & 0 & 0 & 0 \\ 0 & S_{y} & 0 & 0 \\ 0 & 0 & S_{z} & 0 \\ 0 & 0 & 0 & 1 \end{matrix} ]

(c) What matrix T corresponds to M = [ \begin{matrix}1 & 0 & 0 & T_{x} \\ 0 & 1 & 0 & T_{y} \\ 0 & 0 & 1 & T_{z} \\ 0 & 0 & 0 & 1 \end{matrix} ] 8. (10 pts.) You are familiar with parametric representations of line segments in 2-D of the form x =

x_{1} + t(x_{2} − x_{1}), y = y_{1} + t(y_{2} − y_{1}), where the endpoints of the line segment are (x_{1}, y_{1}) and (x_{2}, y_{2}) respectively. In this form, as the parameter t ranges from 0 to 1, all points on the line segment starting from (x_{1}, y_{1}) and ending at (x_{2}, y_{2}) are specified.

(a) Give a parametric representation for a line segment in terms of a new parameter s such that when s = −1, the endpoint (x_{1}, y_{1}) is specified, when s = 1, the endpoint (x_{2}, y_{2}) is specified, and when s = 0 the midpoint of the line segment is specified.

(b) Give a parametric representation for a circle of radius r centered at (x_{c}, y_{c}) in terms of a parameter t such that when t = 0 the leftmost point on the circle is specified, when t = 1 the topmost point is specified, when t = 2 the rightmost point is specified, and when t = 3 the bottommost point is specified.

9. (10 pts) Consider the following homogeneous two-dimensional transformation.

[ \begin{matrix}x′ \\ y′ \\ 1 \end{matrix} ] = [ \begin{matrix}3\frac{\sqrt{2}}{2} & −3\frac{\sqrt{2}}{2} & 7 \\ −2\sqrt{2} & −2\sqrt{2} & −5 \\ 0 & 0 & 1 \end{matrix} ] [ \begin{matrix}x \\ y \\ 1 \end{matrix} ]

(a) Give a sequence of three basic transformations which will produce this transformation. Put them in the order they would have to be multiplied together to produce this matrix.

(b) You would like to be able to decompose a transformation matrix into a scale and a translation operation. If you simply examine the entries in the matrix to be decomposed, is there a condition you can check which will tell you no rotations need be used? If so, what is the condition? If not, explain why not.