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

Robert Futrelle futrelle at ccs.neu.edu
Wed Dec 7 07:04:18 EST 2005


You (Philip) are sending your notes to the entire list.  Not sure 
that you meant to do that.  But for everyone's benefit, I'll say the 
following.  If you reach a complete impasse on doing shadows, SP3, 
then what you should do is the following:

Write a thorough Readme that explains what you tried to do and what 
seemed to work and where it seemed to fail.

Also try to do some debugging with various prints and/or breaks and 
explain how you did that and what you found.

Put extensive comments in your code at the points where you think the 
trouble lies.  Explain in your Readme where these comments can be 
found.

If you produce screenshots from your code that doesn't work, be sure 
to include them.

Seriously consider making up a scene with only two triangles with one 
shadowing part of the other.  I've created a figure that shows how 
you might do this. The figure appears at the bottom of the SP3 page:

http://www.ccs.neu.edu/home/futrelle/teaching/csu540f2005/assignments/sp3.html

So you might try implementing it as one last attempt to get shadows. 
(The orientation of the normal to the green triangle will probably 
not affect your shadow code - if you hit the green from either side, 
your e' is in a shadow.)

  -- Prof. Futrelle


>Robert Futrelle wrote:
>>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
>>
>>
>>
>>_______________________________________________
>>csu540-f05-rpf mailing list
>>csu540-f05-rpf at lists.ccs.neu.edu
>>https://lists.ccs.neu.edu/bin/listinfo/csu540-f05-rpf
>It seems like I can't find a way to fix this problem. I don't know 
>maybe I should just send as it is? and explain what is going on in 
>my readme file? I will give it a try tomorrow again, I've been 
>trying to solve it for hours now and it is too late now 1:12.
>
>Philip
>
>_______________________________________________
>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