Pixar in a Box
- 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
Want to join the conversation?
- I have heard the term implicit before; what does it mean?(1 vote)
- An explicit equation shows a clear relation between x and y, such as y=3x+7. This way it is very clear what the relationship between x and y is. If x=2, then it is easy to compute y=3(2)+7=13. An implicit equation, on the other hand, represents an implied relationship between x and y, such as 5x+2y=7. It is not as obvious that y=-4 when x=3.
In everyday use, I might say I prefer not working with numbers, which might be an implicit way of saying I don't like math.(5 votes)
- How do you do this (ray/line intercept) with a line drawn in 3D space? It seems like the slope intercept form would not be usefull in this case?(2 votes)
- At2:08A(2.973,2) B(2.973,-1) => AB: 3x-8.92=0 (vertical line case)
I just can't figure it out, how c has become -8.92 from the Δyx-Δxy+Δxi=0 <=> ax+by+c=0 identity. I know it is true, but this conversion not takes me there.
If c=Δx*i, the constant would be 0 * i = 0! There is no change in x, this way only 3x=0 remains. What did I miss out?(1 vote)
- It's a good question, which was glossed over. The issue is that you need to find out what
Δxis 0 and
iis undefined since there is no intercept for a vertical line. And yet we can still do it.
Remember one way to write the equation of a line is:
y = (Δy/Δx)x + i
If we multiply by
Δx(so we can avoid dividing by 0), then we get
yΔx = xΔy + iΔx
iΔx = yΔx - xΔy.
For the case A = (2.973, 2) and B = (2.973, -1),
Δx = 0and
Δy = 3, so we have:
iΔx = 0y - 3x = -3x- notice we are keeping the left hand side as
iΔxsince this is what we want to calculate.
Then we just plug in a value for
xthat we know, maybe
Ax, but it doesn't matter since all
xon the line will be the same.
Ax = 2.972, so
iΔx = -3(2.972) = -8.916(-8.92 when rounded).
xΔy - yΔx + iΔx = 0becomes
3x - 0y + (-8.92) = 0.
3x - 8.92 = 0
This is why we multiply by
Δxso we can get numbers we can deal with rather 1/0 multiplied by 0.(2 votes)
- how do you find the y-intercept given 2 points without having to divide by zero if there is no change in x?(1 vote)
- If there is no change in x then the line will be vertical, and so parallel to the y-axis. Parallel lines don't intersect so it's not possible to find the y-intercept for a vertical line.(1 vote)
- i have a question y do we have to do this(0 votes)
- You really don't need to.
This is the mathematics of rendering, not rendering itself. This is explaining how ray-tracing works.(1 vote)
- There's a detail that we need to attend to: there's a slight problem with the slope intercept form of the sine geometry. The problem is that if AB is vertical, the slope isn't defined. To see that, look at the slope intercept form in general: y equals m x plus i, where m is the slope and i is the y-intercept. The slope m is the change in y divided by the change in x, meaning that if AB is a vertical line, there is no change in x. So, computing the slope would mean dividing by zero, which is bad. (bell) But we can eliminate this problem by multiplying through by the change in x. So, multiplying through by the change in x, we get change in x times y equals change in y times x plus i times change in x. It's common to move everything to one side and re-write this as change in y times x minus change in x times y plus i times change of x equals zero. Call this term, change in y, a value: a; this term, negative change in x, a value: b; and this term, i times change of x, a value: c; meaning we can write an equation for the line as a x plus b y plus c equals zero. An equation like this for a line goes by several names. It is sometimes called the line equation. It's also called the implicit form for the line. Let's do an example for this specific line, AB. Change in y is negative three. Change in x is one, and i is 11. So, negative three x minus y plus 11 equals zero. That line equation is shown here. Notice that as I move A and B around, the line equation updates accordingly. The line equation can be used with the parametric form of array to compute intersection points, this time, for any type of line, even vertical ones. Use the next exercise to practice computing intersection points using line equations.