Re: some advice on muller trumbore code for ray-triangle intersection.
- From: Kaba <none@xxxxxxxx>
- Date: Sun, 27 Jul 2008 13:43:38 +0300
Ron Francis wrote:
if (*t>-DBL_EPSILON && *t<DBL_EPSILON )
Makes sense to me if you want to just determine if the origin is very close
to the triangle.
Right. However, the mathematical problem is of determining if there is
an intersection between a ray and a triangle and in this context the
test does not make sense.
One can parametrize a ray r with
r(t) = P + tD
where P is the origin point of the ray and D is a vector.
The domain of the function r is either [0, oo[, or ]0, oo[ depending on
if you count the origin as part of the ray or not. But clearly none of
the r(t) for negative t are part of the ray.
In my code I often need to find the nearest intersection in either direction
along a line, so negative values aren't discarded.
(I use a boolean parameter to determine if the vector direction is
relevant.)
*t<=0 is not a test for self intersection for two reasons.
The intent is not to test for self-intersection, but to catch the case
when a line corresponding to the ray intersects the triangle but the ray
does not.
Self-intersections enter the picture when one traces reflections or
refractions from a surface. If one considers the ray as not containing
its origin, then mathematically the ray should not intersect the surface
it is leaving from. However, because of roundoff this is often not the
case. This is usually solved by a hack by translating the ray an epsilon
off the surface. In my opinion the translation should not be part of the
ray-triangle intersection test, but rather done explicitly. Then the
test should be either *t <= 0 or *t < 0.
--
http://kaba.hilvi.org
.
- References:
- some advice on muller trumbore code for ray-triangle intersection.
- From: broli
- Re: some advice on muller trumbore code for ray-triangle intersection.
- From: broli
- Re: some advice on muller trumbore code for ray-triangle intersection.
- From: Kaba
- Re: some advice on muller trumbore code for ray-triangle intersection.
- From: Ron Francis
- some advice on muller trumbore code for ray-triangle intersection.
- Prev by Date: Re: best fit linear filter
- Next by Date: Re: approximate a curve using splines
- Previous by thread: Re: some advice on muller trumbore code for ray-triangle intersection.
- Next by thread: shortest distance between two segments
- Index(es):
Relevant Pages
|