Artifacts due to Hit Programs [FIXED]

Hi,
I am seeing artifacts that appear to be related to the Acceleration structure grid.

Here is a pure Opengl render of the mesh:

Here is the render with OptiX:

I’ve checked the winding order of polygons, and confirmed my mesh renders ok with pure opengl.

Some triangles appear to be “cut out”. However, upon closer look, some edges of the artifacts are straight and track with the acceleration grid as the camera moves. Therefore I suspect its not a triangle issue.

Here is what happens when I do “NoAccel”:

My Optix graph is as follows:
top_object → Group → Transform → Geometry Group → Geom Instance → Geometry

I am using a OptiX 6.5.0 with driver 452.06

Any ideas?

Found the problem!

It was in my code after all (not surprisingly!)

Here is how I was setting the closest & any hit programs:

std::string ptx_file = fname + “.ptx”;
Program ch_program = CreateProgramOptix ( ptx_file, cast_prog );
Program ah_program = CreateProgramOptix ( ptx_file, shadow_prog );

// ray types
omat->setClosestHitProgram ( 0, ch_program );
omat->setAnyHitProgram ( 0, ah_program );
omat->setClosestHitProgram ( 1, ch_program );
omat->setAnyHitProgram ( 1, ah_program );

It wasn’t clear to me from the programming guide if I should set a closest hit and any hit program on each ray type. Once I tried this it worked:

std::string ptx_file = fname + “.ptx”;
Program ch_program = CreateProgramOptix ( ptx_file, cast_prog );
Program ah_program = CreateProgramOptix ( ptx_file, shadow_prog );

// ray types
omat->setClosestHitProgram ( 0, ch_program );
omat->setAnyHitProgram ( 1, ah_program );

I needed to only set either the closest hit or any hit program for each ray type ID.