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, if I hit anywhere on the second instance, I get sbt and on the last one I get sbt.
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?