Unexpexted behaviour when using primitive sphere

I have created a scene where a sphere is moving away from a stationary camera. In my closest hit program, I shoot a new ray (reflection ray) assuming a perfect mirror surface, the angle of incidence = angle of reflection.

When using a ray depth of 0, everything works as expected with both - a primitive sphere and a triangle mesh. I color the pixel in the closest hit / miss program and the shape ends up being visible as expected.

When I’m loading the sphere as .obj using the OptiXMesh loader everything works as expected and the screen stays dark.
http://i67.tinypic.com/34ht5e1.jpg

When using a ray depth of 1 and a primitive sphere i get artifacts. The rays refleced/shot from the sphere surface should all evoke miss programs and I expect a black screen:

I utilize the sphere.cu file from the tutorial to create a primitve sphere, with its intersection and boundary program, and I get some unexpected hits.
http://i68.tinypic.com/a9nu2x.jpg

This gets worse when the sphere moves further away.
http://i63.tinypic.com/v6ugpi.jpg

Is it possible that this has something to do with the intersection program?
Any help/suggestion is appreciated. Thanks.

I am using VS2013 with OptiX 3.8.0 and CUDA v7.0 under 64 bit Windows 7.



It looks like you might be running into self-intersections. This is likely due to the epsilon you are using. A few questions you can look into to root cause this:

  • Is the magenta color shown in your pictures set by your exception program?
  • Have you enabled exceptions and called rtPrintExceptionEnabled() in your exception program? I am guessing you will see stack_overflow exceptions due to self intersections
  • Have you tried either the robust_interesection method on our SDK’s sphere intersectors?
  • Have you tried intersection_refinement from our SDK?

thanks
keith

There are indeed self-intersections. The robust_intersection method fixed the problem.

Thanks a lot!!!