Optix closest-hit program query for hit or miss

hi. I am trying OptiX for ray tracing. Now I do not need rendering or material information or anything like that.

Just I want to check the mesh’s closest-hit or miss information by rays.

I think miss program and hit program records on GPU memory and copy to CPU memory.

if I want to check the closest-hit(or miss) information, is it correct to calculate
“group-typeRecordBase + sbt-index * group-typeRecordStrideInBytes”.

now using OptiX 7.5 and i study “Siggraph OptiX 7/7.3 Course Tutorial Code” and manual.

I wonder if there are other example programs that ou can recommend. thank you so much.

Hi there @jwyou0626! Welcome to the NVIDIA developer forums!

Nice to see your interest in OptiX and Ray Tracing.

I took the liberty and moved your post to the OptiX category where our experts are sure to help.


Welcome @jwyou0626!

It sounds like you might want to study the OptiX SDK sample called optixRaycasting, which gathers hit into into a buffer and then shades using a CUDA kernel. You could skip the shading and do whatever you want with the hit info buffer. For people new to OptiX, we also recommend perusing the OptiX Programming Guide, read especially the first three sections, and then skim through the rest or keep it handy for reference as you go.