If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content
Current time:0:00Total duration:2:28

Video transcript

we saw in the previous lesson that to write a ray tracer you need a mathematical way to answer a bunch of questions where does a ray intersect a scene object does a shadow ray reach the light source before it intersects another object how does the surface reflect light how far away is the light source and finally where is the camera in the remainder of this lesson we're going to focus on the first sub problem that of Ray object intersection we're going to start our study by first looking at the simpler problem of how to do ray object intersection in two dimensions so what does ray tracing look like in two dimensions let's start with our three-dimensional situation and take a cross-section through this white plane that contains the camera and the viewing direction notice too that the white plane intersects the image plane in a line which we'll call the image line that means if we draw just what's in the white plane we get a picture like this and to make the problem even easier we'll try first intersecting with the simplest object possible a line segment so here's our scene just a line segment connecting two points a and B to render this scene just as in three dimensions we need to pick a location for our camera call the camera Point C next we pick a viewing direction shown here in red in three dimensions the camera location and viewing Direction defines an image plane but in two dimensions it gives us an image line that's the line on which our image will be formed now let's pick a point P on the image line to denote the pixel we want to determine the color of recall that the Ray tracer builds array from C through P often to the scene we need a mathematical way to compute intersection points like this one called I to develop the math we first introduced a coordinate system the math we need comes from looking at the algebra of intersecting array with a line segment we've introduced quite a few ideas in this video so use the next exercise to make sure you're comfortable with two-dimensional ray tracing