optixGetSbtDataPointer() points only to first entry of the instance

I have a structure with multiple instances. Each instance consists of multiple meshes which are set as triangle arrays. I only have one material per triangle array, so numSbtRecords is set to 1. The shader binding table entries are set up for all the meshes in the order they are put in the buildInput array. And for every instance, the sbtOffset is increased by the number of meshes of the previous instance.

The problem is, in the closest hit program, I try to access the sbt entry corresponding to the hit point, but optixGetSbtDataPointer() only gets me the first element of the instance. So for example, I have 3 instances. The first one consists of 5 meshes (buildInputs), the second one of 10 and the third one of 3. If the hitpoint if anywhere on the first instance, I get sbt[0], if I hit anywhere on the second instance, I get sbt[5] and on the last one I get sbt[15].

So the sbtOffset set in the instances works. But I don’t get the correct sbt entry for the meshes within the instances, e.g. between 0 and 5 or between 5 and 15 or 15 and 18.

Does anyone have any idea, why this is? The code is quite complex, so it will be hard to extract a minimal working example to replicate this error. But maybe anyone has an idea based on my description?

Hi @58964123587,

What is the value you used for SBTstride in your optixTrace() call? I believe using a value of zero could cause this behavior. Take a look at the SBT indexing formula: you should be getting a unique SBT GAS index per build input, but you can force the build inputs in a GAS to all use the same SBT index by setting the stride to zero.

So, one thing to check is what you get from optixGetSbtGASIndex(); this should show you a different value for each build input. If you are already using a non-zero stride, then I’m not immediately sure what else could cause this.

Another thing to try is enabling OptiX validation mode in your OptixDeviceContextOptions.


Hi @dhart,

Thats it! I have been trying to fix this for days now and it turns out I just had to set one parameter from 0 to 1…
Thank you very much!!

1 Like