CSCI 480/580 Lecture 7 - In-Class Problems

HW1 #2 asks you to derive the intersection point of a ray p + td with a general plane containing a point a on the plane and a plane normal vector n. Here, let's solve a special case (an axis-algined plane) but add bounds so that we can intersect rays with axis-aligned rectangles. Using a handful of these, we'll be able to model an empty version of the famous Cornell Box scene (minus the light source):

Generate Cornell Box — generate_cornell • rayrender

  1. Let's start with the back wall of the box; if our camera is in canonical position, which two coordinate axes is this plane parallel to?

  2. Write pseudocode for an intersection routine on such an axis-aligned bounded rectangle in the scene:

  1. Assume that you have also implemented analogous xzrect_intersect and yzrect_intersect functions. Also suppose we've defined corresponding structs XYRect and so on to store a rectangle and its parameters (instantiated using, e.g., XYRect(rect_z, min_x, max_x, min_y, max_y, color). The perspective camera is in canonical pose with and , and the back of the box is at . Model the scene (again, ignoring the light on the ceiling) by listing the five rectangles that make up the faces of the cube.
  2. Suppose the camera used an orthographic projection instead of perspective projection. What would the scene look like?