• Advertisement


This topic is now archived and is closed to further replies.

Just Wondering

This topic is 5994 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Chris, I'm wondering, for my own reference, if the function PRCL_RayIntersectsTriangle does a acos(dotproduct(xxx)).... I ask this because I'm playing with lightmaps and I'm raytracing shadows. When I first did this I noticed with an object like a high poly sphere over a flat plane, that the some lightmap pixels would detect a collision when there wasn't one (I was using PRCL_RayIntersectsTriangle). So, I decided to write my own ray intersects triangle function and it did the same thing. Running the debugger I found out what the problem was. The dotproduct gives the cos(theta) which can be -1.0 <= cos (theta) <= 1.0. However, the acos function says it can only take values between -1.0 and 1.0. So, when the Dot Product was returning the extremes(-1.0,1.0) the acos was returning an indefinite messing up the calculation. I added extra checking for these exremes and my ray intersects triangle works just fine. Gary Edited by - Gary on September 23, 2001 1:30:41 AM

Share this post

Link to post
Share on other sites

  • Advertisement