Main content

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

Lesson 2: Mathematics of depth of field# Mathematics of pinhole cameras

In this video we'll find the intersection point of a light ray and our image plane.

## Want to join the conversation?

- at1:37why is the slope y0/x0?(5 votes)
- The definition of slope is the change in vertical direction divided by change in horizontal direction between two points. It's practically a number telling you how steep is the curve. Bigger the number, steeper the curve. Because we know the light ray from captured object(x0,y0) comes through the pinhole (0,0), the change in horizontal direction is x0 - 0 and on vertical y0-0. The slope of the ray of captured object is therefore x0/y0. And because the point (x1,y1) on the image plane is the same light ray, therefore it lies on the same line as the captured object (x0,y0), it has the same slope. So we know that y1/x1=y0/x0. We can solve this equation for y1=(y0/x0)*x1, as was done in the video. Hope this helps, you can explore this idea further in lessons on slope in Math:Algebra 1 section here on Khan Academy ( https://www.khanacademy.org/math/algebra/two-var-linear-equations/slope/v/introduction-to-slope ).(19 votes)

- what software are you gonna have to use or is it any to make 3d image(5 votes)
- I didn't understand a single bit.(8 votes)
- Is it just me, or do the circles of confusion look really pretty when blurred?(4 votes)
- It's not just you. I think they're pretty, as well(8 votes)

- How is animation related to maths?(4 votes)
- is it only me or do people get confused when math is involved(3 votes)
- this is so. confusing!1(2 votes)
- I am in third grade and I don't understand the math.(2 votes)
- In the next set of problems, why is the image plane always 6 units away from the pinhole? Is it for simplicity?(2 votes)
- ok ok ok right now I'm being honest but does it reflect when the object AKA light hit?(2 votes)

## Video transcript

- In the last lesson, we explored the geometric behavior of cameras. We saw how light bounces off objects, passes through a small hole or aperture, and hits an image plane. One of the important concepts we covered was depth of field,
which is a region where objects appear in focus. Outside that region,
objects appear blurry. When a point at an image is out of focus, it grows into a blurry circle known as the circle of confusion. In this lesson, we'll develop
the algebraic equations which tell us exactly where
things come into focus, and how big the circle
of confusion will be if something isn't in focus. And these equations
will allow us to create virtual cameras to create stunning images, such as this shot. To begin, let's return
to our pinhole camera. As usual, when bridging the gap between geometry and algebra, we'll need to introduce
a coordinate system. It's convenient to choose
our coordinate system so that the pinhole is at
the origin, right here. And let's imagine that our
scene is off to the right. Suppose the image plane inside our camera is at some distance to
the left of the pinhole. Let's call this distance i. Now consider a point on
some object in our scene. Call this point x zero, y zero. When light in the
environment hits this point, some of it will bounce toward the camera, through the pinhole and
hit the image plane. Let's call the place it hits
the image plane x one, y one. So our first question is
what is x one and y one? One way to solve this is to use the slope intercept form of a line. The slope of the ray
is y zero over x zero, and the y-intercept is zero because we said this ray
passes through the origin. That is, the equation of the ray is just y equals y zero over x
zero, times x, plus zero. Or, simply, y equals y
zero over x zero, times x. Now the point we're
looking for, x one, y one, is also on this ray, so it must
satisfy that line equation. Meaning y one equals y zero
over x zero, times x one. And notice the diagram tells
us that x one is negative and a distance i away from the origin. That is, we know x one equals minus i. Finally, to get y one, we
just substitute to give us y one equals minus y zero
over x zero, times i. Notice that the point
was originally positive but the corresponding point
on the plane is negative. And that's the image flip. Okay, let's pause here to give
you some experience with this before we add a lens to our camera.