Intel® Embree Ray Tracing Kernels
Discussion forum on the open source ray tracing kernels for fast photo-realistic rendering on Intel® CPUs.
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

A small bug in Embree, and a solution

We'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 Regards
Matt Taylor
0 Kudos
1 Reply
New Contributor I
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.