Jump to content
  • Advertisement

Archived

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

Gary

Just Wondering

This topic is 6170 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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!