setDefaultIntersectionProgram() doesn't set my program


I have an issue if I try to set a default intersection program for an object. It won’t get called when I run my OptiX scene. For debugging the code within the intersection program consists of only one rtPrintf command. I already activated the print buffer, so that I can easily print out.
Here is what I have done in my host code:

m_geometry_group_front = m_context->createGeometryGroup();

Program intersect = m_context -> createProgramFromPTXFile( "./ptx/raytracing.ptx", "intersection");

OptiXMesh loader_front( m_context, m_geometry_group_front, m_accel_desc );
loader_front.loadBegin_Geometry( std::string (m_filepath + "front.obj") );
loader_front.setOptiXMaterial(0, m_material );

Is this the right way to set an intersection program for my object? I used the materials example as a template.

I really need help in this topic. I try to get the information, whether the object geometry gets hit or not. My attempt doesn’t seem to work, although I defined my intersection program.

If your intersection program only consists of the rtPrintf command, the BVH traversal isn’t really happening. You won’t be able to check if an object gets hit or not this way.
Assuming the bounding box is set correctly. Otherwise there is nothing at all to traverse. Related thread: [url][/url]

If you do not have calls to actually intersect a geometry and the calls to rtPotentialIntersection(t) and rtReportIntersection(materialId) that might not work properly. Possible rtPrintf issues aside, I would recommend to implement the proper intersection program and then put the rtPrintf either between the rtPotentialIntersection() and rtReportIntersection() calls, where all the attribute calculations belong, or into the closest hit program which actually tells you if a closest hit was found.

Please always list the following system information when reporting issues to reduce turnaround times:
OS version, installed GPU(s), display driver version, OptiX version, CUDA Toolkit version used to compile the PTX code.

Thank you very much for your help! I’ve added my specs now into the signature, sorry for that.

Are you saying that you solved the problem?

OptiX version number 3.9 alone is not precise enough. There exist OptiX 3.9.0 and 3.9.1 and I would recommend using 3.9.1 then.

You could also check against the recently released OptiX 4.0.0 version just in case there is an issue with rtPrintf in 3.x.

I’ve not solved it yet, but I’m just about to do that. I have Optix 3.9.0 installed, then I will update to Optix 3.9.1 to be safe. I will give you feedback, if I solved the problem. Thanks for your good support.

Ok problem got solved. I found a good sample implementation for a mesh intersection and boundingbox progam in the and use this in my program.
First I still had no responding program, but then I realized that the setDefaultIntersectionProgram() and setDefaultBoundingBoxProgram() methods have to be called before the loadBegin_Geometry() command. Now everything is working, thanks!