ClosestHit not triggering in 3D ray tracing project

Hello, I am working on a simulation to trace a single type of ray traversing through meshes, spheres, and capsules in 3D space, to determine what materials a ray of light might pass through and how much energy from it is absorbed by different materials.

Currently my simulation is designed such that an instance acceleration structure is created to combine handles from three GAS:

  1. an enclosed triangular surface mesh, (Triangle GAS)
  2. a set of spheres superimposed upon the triangle meshes, (Sphere GAS)
  3. and a set of capsules superimposed upon the triangle meshes (Custom GAS).

There is one instance acceleration structure for tracking rays entering the superimposed 3D primitives, and one instance acceleration structure for tracking rays exiting the primitives.

Currently I am not getting any calls to the closesthit device function, which I rely on for tracking these intersections. Do you know what could be causing this issue and what some next steps are for diagnosing the bug?

I saw in the documentation that “OptiX uses handles as references to traversable objects. These traversable handles are 64-bit opaque values that are generated from device memory pointers for the graph nodes. The handles identify the connectivity of these objects.”

Could you explain further how the connectivity of the traversable handles and calls to optixTrace determine which AABB trigger closesthit?

Edit:
If you can point me towards debugging or logging features for the acceleration structure setup, that could be helpful as well.

Thanks,
Aiden

Hi @AidenLewis,

I would think maybe the first thing to do is turn on validation mode and double check there are no warnings or errors. The primary debugging feature for AS setup would be validation mode.

Second thing to check is the SBT setup, perhaps the closest hit programs aren’t sitting where OptiX expects them in the table? This can be a little mystifying to debug at first since a null program entry in your SBT will quietly do nothing. Do you have closest hit programs for each geometry type, or a single closest hit program? Do you have all three geometry types represented in your test?

Could you explain further how the connectivity of the traversable handles and calls to optixTrace determine which AABB trigger closesthit?

The documentation is basically just saying that your BVH is a tree structure, and the GAS handles are what are held by the IAS. The IAS contains a bounding box and a handle for each GAS. During traversal of the IAS, when a ray hits a bounding box, the GAS associated with that bounding box is traversed, and that GAS is simply identified by it’s handle.


David.

Thanks, I have already been using validation mode, but I’ll double check my shader binding table. I am using a single closesthit function for all GAS, but a separate intersection function from the defaults for just the custom GAS.