In my program, I launch multiple rays, each of which may intersect with multile triangles. In order to realize that, I use the optixIgnoreIntersection() function. Now I want to count the number of miss by adding a counter in miss-program, and I find that it is equal to the number of rays. Does optixIgnoreIntersection() clear the intersection information of ray so that the miss-program is always called?
If you always call optixIgnoreIntersection inside your anyhit program on every invocation, the ray will never intersect with anything, means it will never reach the closesthit program, and will always reach the miss program.
Only if the anyhit program doesn’t call optixIgnoreIntersection on some code path, or if it calls optixTerminateRay, the potential intersection is accepted and will shrink the tmax and the closesthit progam can be reached.
Note that optixIgnoreIntersection and optixTerminateRay will immediately return! If you want to update any payload data etc. inside the anyhit program invocation you must do that before these calls.