CS465 Fall 2006 Homework 2 Solution ------------------- 1. You will get a correct but upside down image of whatever is behind the camera. Comment: The ray direction is computed by subtracting the viewpoint from the image plane point. When the two points are swapped, your ray direction will be the negative of the correct ray direction. 2. You will get an image with blotchy shadows where there should be no shadows. Comment: Because floating point numbers are discrete, the start of the shadow ray will be above the surface some of the time and under the surface some other time. If the start of the shadow ray is under the surface, the ray will intersect the surface and the program will think that the light source is occluded by the surface. 3. The surface will be incorrectly shaded -- the farther a point is from the light source, the brighter it will be. Comment: Lambertian shading has the following formula: k_d*dot(n,v_l). If v_l is just the vector to the light, its the result of the dot product is wrong by a factor of d, where d is the distance to the light. If the distance is more than one the shading will be too bright; if it is less, it will be too dark. 4. You will see objects that are behind other objects. 5. You will always get normal perspective view; that is, no tilted image plane is possible. 6. You will see a black image. Comment: A shadow ray is meant to check for intersections along the line segment from the shading point to the light. If we just intersect the ray and accept any intersection, without checking that it happens between the light and the surface, we will see shadows from objects that are behind the light source, which should not cast shadows. Since the scene is closed, there is always an object behind the light source and every point will always be in shadow. For this one you were pretty close if you recognized that objects that should not cast shadows would cast shadows. 7. The surface of the sphere will be incorrectly shaded -- the larger the sphere is, the brighter it will be. Comment: Let's take Phong shading as an example; Phong shading has the following formula: k_d*dot(n,v_l) + k_s*dot(n,v_h)^p. Normally one computes n by normalizing the radius vector from the sphere's center to the shading point. If the normalization is skipped both dot products are wrong by a factor of r, the sphere's radius. For r > 1 the shading will be too bright (and the specular component will be way too bright), and for r < 1 the shading will be too dark (and the specular component will be way too dark).