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

Start here!

Overview of this lesson

Ready to dive into some math?

In this lesson we are going to explore the most fundamental calculation a ray tracer performs: ray object intersection.

Since objects in our scenes are modeled using millions of tiny triangles, each intersection is betweena ray and a triangle.
In this lesson we'll start with the a simpler version of this problem, the intersection of a ray and a line in 2D:
Finally we'll extend these ideas from two dimensions to work in three dimensions. By the end of this lesson we'll need to solve a pretty meaty system of equations with 4 unknowns:
Sound like fun? By the end of this lesson you can say you have a basic understanding of ray tracing along with a mathematical view of the underlying geometry which makes it all work. How cool is that?

What do I need to know before starting?

  • You should be familiar with the slope-intercept form of a line. Click here to review a video or click here to do an exercise
  • We'll also be using the parametric form which requires you understand weighted averages of two points. We covered weighted averages of two points in the Environment Modeling lesson.
  • Finally we'll need weighted averages of three points which we covered in the Character Modeling lesson.
  • You should also have experience solving systems of equations.
Okay, you're ready to go!

Want to join the conversation?

  • starky tree style avatar for user Mel Zorns
    How exactly to the pixels turn into a picture/drawing?
    (6 votes)
    Default Khan Academy avatar avatar for user
  • piceratops ultimate style avatar for user Khan Gressman
    I have a question about the rendering equation. I haven't officially learned about integrals yet, but I've only seen integrals with nothing on the top or bottom, or with something on both the top and bottom. What does it mean when there is only something on the bottom. Also, for each direction, there is a separate point and a separate direction to that point. Yet there is only one variable for that point (yi in the source I used) and one variable for the direction (wi in the source I used). If you looped through "all" the possible directions, then you could calculate each of those vectors, but how does it work in the integral since there is only one of each?
    (5 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Jake
    is there a subject for pixar in a box that doesnt require 103857395938th grade math?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • duskpin ultimate style avatar for user SaltyJoke
      This kind of so-called high level math isn't actually hard; schools just teach math slowly. Any first-grader with a good grasp of arithmetic can learn Algebra I on their own if they try hard enough. Khan Academy happens to be an excellent place to do this.
      (6 votes)
  • starky seed style avatar for user bproulx
    m,kay what is it i have a bit of a dyscalculia problem
    (4 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user larahgerard
    I haven't officially learned about integrals yet, but I've only seen integrals with nothing on the top or bottom, or with something on both the top and bottom. What does it mean when there is only something on the bottom. Also, for each direction, there is a separate point and a separate direction to that point. Yet there is only one variable for that point (yi in the source I used) and one variable for the direction (wi in the source I used). If you looped through "all" the possible directions, then you could calculate each of those vectors, but how does it work in the integral since there is only one of each?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • aqualine tree style avatar for user Miika
    I haven't officially learned about integrals yet, but I've only seen integrals with nothing on the top or bottom, or with something on both the top and bottom. What does it mean when there is only something on the bottom. Also, for each direction, there is a separate point and a separate direction to that point. Yet there is only one variable for that point (yi in the source I used) and one variable for the direction (wi in the source I used). If you looped through "all" the possible directions, then you could calculate each of those vectors, but how does it work in the integral since there is only one of each?
    (0 votes)
    Default Khan Academy avatar avatar for user
  • piceratops ultimate style avatar for user Blaze
    how close together is each pixel
    (0 votes)
    Default Khan Academy avatar avatar for user