[csu540-f05-rpf] [csu540-f05] SP3 question

Robert Futrelle futrelle at ccs.neu.edu
Tue Dec 6 21:27:12 EST 2005


If you get a hit on a triangle and N dot L is positive, then your 
shadow ray, from e', will be directed away from the surface, which is 
fine.  As I mentioned in class, there's a slight chance that due to 
roundoff, it will hit the surface it is supposedly directed *away* 
from - the reason I suggested adjusting e' to be slightly away from 
the surface by adding a few pixels in the N direction.

I'm not absolutely sure why Matt's strategy worked - have to look at 
his code. But if it worked and shadows appeared, great!

In my TinyRayTrace, I made d so large that if t < 1.0, the hit was 
inside the basic volume containing the scene. You could also make |d| 
= 1.0, a unit
vector and test for t being less than some value such as 2,000, again 
meaning that the hit was inside your basic volume.  The nice thing 
about making |d| = 1.0 is that t then becomes a measure of how far 
along the ray from the eyepoint your hit is, measured in pixels.

The gamma and beta tests are unchanged by your choice of |d| and the 
t limit test.

   -- RPF



>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 
><<mailto:futrelle at ccs.neu.edu>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
>>><mailto:csu540-f05-rpf at lists.ccs.neu.edu>csu540-f05-rpf at lists.ccs.neu.edu
>>><https://lists.ccs.neu.edu/bin/listinfo/csu540-f05-rpf>https://lists.ccs.neu.edu/bin/listinfo/csu540-f05-rpf
>>
>>
>>_______________________________________________
>>csu540-f05-rpf mailing list
>><mailto:csu540-f05-rpf at lists.ccs.neu.edu>csu540-f05-rpf at lists.ccs.neu.edu
>><https://lists.ccs.neu.edu/bin/listinfo/csu540-f05-rpf> 
>>https://lists.ccs.neu.edu/bin/listinfo/csu540-f05-rpf
>
>
>_______________________________________________
>csu540-f05-rpf mailing list
><mailto:csu540-f05-rpf at lists.ccs.neu.edu>csu540-f05-rpf at lists.ccs.neu.edu
><https://lists.ccs.neu.edu/bin/listinfo/csu540-f05-rpf>https://lists.ccs.neu.edu/bin/listinfo/csu540-f05-rpf
>
>
>
>
>--
>Matthew Rancourt
><mailto:MRancourt at gmail.com> MRancourt at gmail.com
><mailto:rancourt at ccs.neu.edu>rancourt at ccs.neu.edu
>
>_______________________________________________
>csu540-f05-rpf mailing list
>csu540-f05-rpf at lists.ccs.neu.edu
>https://lists.ccs.neu.edu/bin/listinfo/csu540-f05-rpf




More information about the csu540-f05-rpf mailing list