A small bug in Embree, and a solution

A small bug in Embree, and a solution

HiWe're using Embree in the latest incarnation of our mental ray compatible raytracer, and we've noticed a bug concerning axis aligned rays. When Embree calculates the reciprocal direction vector, it doesn't check for divide by 0, which then causes it to fail to intersect. Here's a simple fix - in ray.h#define BIGNUM(3.4E38f)/*! Constructs a ray from origin, direction, and ray segment. Near
* has to be smaller than far. */
__forceinline Ray(const Vec3f& org, const Vec3f& dir, const float&
near = zero, const float& far = inf)
: org(org), dir(dir), near(near), far(far)
rdir.x = (dir.x==0.0f)? BIGNUM
: 1.0f/dir.x;
rdir.y = (dir.y==0.0f)? BIGNUM
: 1.0f/dir.y;
rdir.z = (dir.z==0.0f)? BIGNUM
: 1.0f/dir.z;
I'm sure you guys will have a better solution, but this seems to work, at least. :-)Congratulations on Embree, it's really zippy! If you're interested in hearing more about our raytracer, let me know!Best RegardsMatt Taylor

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Thanks for reporting this bug. It is fixed in version 1.0 final.

And yes, I'm interested in hearing more about your ray tracer. Please send an email to Embree support.

Leave a Comment

Please sign in to add a comment. Not a member? Join today