Lighting Question Question submitted by (24 August 1999) |
Return to The Archives |
What's a good method for determining whether or not a line intersects a polygon (specifically, a triangle)? I'm trying to do some cheap static lighting on my terrain by using vertex coloring, and I'm having trouble figuring out if my light ray actually reaches a vertex or if it has been intersected by some intervening terrain. | ||
This all depends on how you store your data, and how your application
will work with the intersection code. There are quite a lot of
intersection routines, each of which has its advantages and
disadvantages. Try this: ftp://ftp.grafix3d.tzo.com/pub/3D-References/RayTracing/ray_tri_intersect.zip Also, a good place to find tidbits of information of this type are in the Graphics Gems series of books. If you don't already have them, they're definatly worth their weight in gold to any 3D programmer on the move. :-) Response provided by Paul Nettle |
||
This article was originally an entry in flipCode's Fountain of Knowledge, an open Question and Answer column that no longer exists. |