[csu540-f05-rpf] [csu540-f05] SP3 question
Matt Rancourt
mrancourt at gmail.com
Tue Dec 6 20:49:24 EST 2005
Philip,
I had the same problem you did. The way I was able to get around it was by
adding a check on the T-value in the same function that checks the alpha,
beta, and gamma values. Make sure that it is between 0 and 1. As soon as I
did this it worked. I THINK what was happening is that the same triangle
was getting hit, and generating a negative t-value. Hope that helps.
- Matt
On 12/6/05, Robert Futrelle <futrelle at ccs.neu.edu> wrote:
>
> Here's the answer to the question a number of you have asked me.
>
> Q. How do you get the coordinates of the point where the first ray
> hits a triangle? (Needed because that's the new eyepoint for
> launching a ray in the direction of the light source.)
>
> A. At the top of pg. 205, you see that the ray you start with has the
> form:
> p = e + td, where p, e, and d are all points/vectors in 3-space. You
> know the values of p, e, and d.
>
> When you hit a triangle, you can figure out the value of t. You
> simply use that value in the equation for p and that gives you the
> point in 3-space where the ray hits the triangle. So if T is the
> value of t where the first hit occurs, then that point is p = e + Td.
> That point becomes the new eyepoint, e', for launching the ray in the
> direction of the light, so e' = e + Td.
>
> If L is a unit vector toward the light source, you can write your new ray
> as
>
> p = e' + wL
>
> using w instead of t, and L instead of d.
>
> Hope this helps.
>
> - Prof. Futrelle
>
>
>
> >I'll answer you in about an hour, soon as I get home.
> >
> > rpf
> >
> >>I have a quick question. When you do the ray trace and your ray
> >>hits a point in a triangle, how do you get the z-coordinate of that
> >>point? I am having difficulties trying to ray trace back to the
> >>light source from a point on a triangle.
> >>
> >>Thanks.
> >>
> >>_______________________________________________
> >>csu540-f05-rpf mailing list
> >>csu540-f05-rpf at lists.ccs.neu.edu
> >>https://lists.ccs.neu.edu/bin/listinfo/csu540-f05-rpf
> >
> >
> >_______________________________________________
> >csu540-f05-rpf mailing list
> >csu540-f05-rpf at lists.ccs.neu.edu
> >https://lists.ccs.neu.edu/bin/listinfo/csu540-f05-rpf
>
>
> _______________________________________________
> csu540-f05-rpf mailing list
> csu540-f05-rpf at lists.ccs.neu.edu
> https://lists.ccs.neu.edu/bin/listinfo/csu540-f05-rpf
>
--
Matthew Rancourt
MRancourt at gmail.com
rancourt at ccs.neu.edu
-------------- next part --------------
HTML attachment scrubbed and removed
More information about the csu540-f05-rpf
mailing list