File: sept11.txt Contents: plan/notes from the day For next time - triangle ray tracing, graphics pipeline. hw4 questions/discussion - project ideas people found? - so far, leading suggestion is the rubic's cube solver/simulation exam next week - sample test over the weekend From last time - shadow rounding errors? This time... * Example with ray tracing + radius 1 spheres at: (0,0,0) red, (1, 2, -3) blue, (-2, 0, -3) green + eye is at (0,0,5) + projection screen at z=3, 60 degree vertical field of view total + LCD is 1920 x 1080 + pixel (800 over, 500 up) + y_screen = 500. + y_screen -> (5/sqrt(3)) * (yscreen - 540) / 540 + y_screen = 500 -> -.231 + x_screen -> (16*5/(9*sqrt(3)))*(xscreen - 960)/960 + xscreen = 800 -> -.321 * conclusion... * don't use simplified formula from notes... * would probably hit the (0,0,0) circle (but go ahead and work it out...) * Pseudocode for ray-tracer (will turn into real code) tValue rayTraceSphere(material properties of sphere, cX, cY, cZ, radius, // where is the sphere pX, pY // pixel on the screen we want eX, eY, eZ, // eye coordinates zz, // where is projection screen fov, // field of view pXMax, pYMax ) { // convert pixel to coordinates on the projection screen // scaling of pixel coordinates to projection screen coordinates // viewing ray - r(t) = p + t * d // intersection equation with viewing ray and sphere // that gives t value(s) where intersection happens // if imaginary, then no intersection. } rayTraceTriangle() { // next time... } rayTraceScene() { zBuffer = one number per pixel on the screen, what is the closest object at that pixel so far colorBuffer = RGB for each pixel for each pixel on the screen pX, pY { for each object in the world { t = rayTraceSphere(....) if this sphere closer than previous closest { update the zBuffer put color into that pixel. } } } }