Main content

## Pixar in a Box

### Course: Pixar in a Box > Unit 15

Lesson 2: Mathematics of rendering- Start here!
- 1. Ray tracing intuition
- 2D rendering intuition
- 2. Parametric form of a ray
- Parametric ray intuition
- 3. Calculate intersection point
- Solve for t
- 4. Using the line equation
- Ray intersection with line
- 5. 3D ray tracing part 1
- Ray intersection with plane
- 6. 3D ray tracing part 2
- Triangle intersection in 3D

© 2023 Khan AcademyTerms of usePrivacy PolicyCookie Notice

# 3. Calculate intersection point

Now we are ready to calculate an intersection point using our ray CP (parametric form) and our line AB (slope-intercept form).

## Want to join the conversation?

- So a lot of people seem to feel lost in this as well huh(7 votes)
- Does someone have a better explanation of what t* represents?(4 votes)
- t* represents the weight in finding the weighted average of the points C and B. We can find the point of intersection of the ray and the line by finding the value of t* where R(t*)=I, or what weight in the weighted average of the points C and B gives us the point of intersection along the ray.(3 votes)

- What confuses me so far is that lines are well defined functions so we can 'easily' figure out any point along the line. However when creating a scene in a program the geometry isn't mathematically positioned, but rather arbitrarily. So would we have to subtract the vector of each triangle's position by the vector of the camera's position to figure out the length of the ray between them?(3 votes)
- Can someone please explain what variable does what?(3 votes)
- So let's say we had a parametric equation in 5 dimensions. Would we have to write out
`Ie₀ = T(e₀)`

Ie₁ = T₁(e*)

...

Ie₄ = T₄(e****)

, or is there an easier way?(3 votes) - what is t this is confusing(2 votes)
- OMG why is this so boring? I was having fun with this until I got to here, this lesson is not very interesting (To me at least.) I want it to be fun.(1 vote)
- 0:03

- Now that you have a feel for how t works,0:05

we're ready to calculate our intersection point I0:08

between our ray CP and our line segment AB.0:11

Recall from the previous video that0:13

the slope intercept form of the line AB0:15

is y equals negative three x plus 110:18

and the parametric representation of the ray CP0:21

is the function R of t equals one minus t0:25

times C plus t times P.0:29

Different values of the parameter t0:31

locate different points on the ray.0:36

The intersection point that we're after0:38

is one such point on the ray so there0:40

must be some value of t, call it t star,0:44

such that I equals R of t star.0:49

This is really two equations, one for the x-coordinate0:52

of I and one for the y-coordinate.0:55

These two equations are I sub x equals R sub x0:59

of t star, which equals one minus t star1:03

times C sub x plus t star times P sub x.1:09

In the same way I sub y equals R sub y of t star,1:14

which equals one minus t star times C sub y1:18

plus t star times P sub y.1:22

In this particular case C, our camera position,1:26

has coordinates zero, zero1:28

and P has coordinates two, 1/2.1:33

So we have I sub x equals t star times two1:38

and I sub y equals t star times 1/2.

•1:42

I is also on the line segment AB meaning that1:46

I satisfies the slope intercept form for AB,1:50

that is I sub y equals negative three1:53

times I sub x plus 11.1:57

So we have three equations and three unknowns,2:01

I sub x, I sub y and t star.2:06

We can solve the system of equations2:08

by substituting the first two equations2:10

into the third to get an equation just in t star.2:14

1/2 t star equals negative three2:18

times two times t star plus 11.2:23

Solve this for t star, then plug that value2:26

of t star into the first two equations2:28

to get I sub x and I sub y.2:32

And that's how it's done.2:33

Before we continue get some experience using this2:36

kind of parametric function in the next exercise.(0 votes) - 0:03

- Now that you have a feel for how t works,0:05

we're ready to calculate our intersection point I0:08

between our ray CP and our line segment AB.0:11

Recall from the previous video that0:13

the slope intercept form of the line AB0:15

is y equals negative three x plus 110:18

and the parametric representation of the ray CP0:21

is the function R of t equals one minus t0:25

times C plus t times P.0:29

Different values of the parameter t0:31

locate different points on the ray.0:36

The intersection point that we're after0:38

is one such point on the ray so there0:40

must be some value of t, call it t star,0:44

such that I equals R of t star.0:49

This is really two equations, one for the x-coordinate0:52

of I and one for the y-coordinate.0:55

These two equations are I sub x equals R sub x0:59

of t star, which equals one minus t star1:03

times C sub x plus t star times P sub x.1:09

In the same way I sub y equals R sub y of t star,1:14

which equals one minus t star times C sub y1:18

plus t star times P sub y.1:22

In this particular case C, our camera position,1:26

has coordinates zero, zero1:28

and P has coordinates two, 1/2.1:33

So we have I sub x equals t star times two1:38

and I sub y equals t star times 1/2.

•1:42

I is also on the line segment AB meaning that1:46

I satisfies the slope intercept form for AB,1:50

that is I sub y equals negative three1:53

times I sub x plus 11.1:57

So we have three equations and three unknowns,2:01

I sub x, I sub y and t star.2:06

We can solve the system of equations2:08

by substituting the first two equations2:10

into the third to get an equation just in t star.2:14

1/2 t star equals negative three2:18

times two times t star plus 11.2:23

Solve this for t star, then plug that value2:26

of t star into the first two equations2:28

to get I sub x and I sub y.2:32

And that's how it's done.2:33

Before we continue get some experience using this2:36

kind of parametric function in the next exercise.(0 votes)

## Video transcript

- Now that you have a feel for how t works, we're ready to calculate our intersection point I between our ray CP and our line segment AB. Recall from the previous video that the slope intercept form of the line AB is y equals negative three x plus 11 and the parametric representation of the ray CP is the function R of t equals one minus t times C plus t times P. Different values of the parameter t locate different points on the ray. The intersection point that we're after is one such point on the ray so there must be some value of t, call it t star, such that I equals R of t star. This is really two equations, one for the x-coordinate of I and one for the y-coordinate. These two equations are I sub x equals R sub x of t star, which equals one minus t star times C sub x plus t star times P sub x. In the same way I sub y equals R sub y of t star, which equals one minus t star times C sub y plus t star times P sub y. In this particular case C, our camera position, has coordinates zero, zero and P has coordinates two, 1/2. So we have I sub x equals t star times two and I sub y equals t star times 1/2. I is also on the line segment AB meaning that I satisfies the slope intercept form for AB, that is I sub y equals negative three times I sub x plus 11. So we have three equations and three unknowns, I sub x, I sub y and t star. We can solve the system of equations by substituting the first two equations into the third to get an equation just in t star. 1/2 t star equals negative three times two times t star plus 11. Solve this for t star, then plug that value of t star into the first two equations to get I sub x and I sub y. And that's how it's done. Before we continue get some experience using this kind of parametric function in the next exercise.