I am currently working on a OptiX 7 renderer where i have multiple GAS objects and multiple IAS objects. The GAS objects are never rendered directly, and are only rendered by being refereed to by a IAS.
I am currently able to render with a single GAS and multiple IAS referring to it, without any issue.
The problem arise when i try to render with two GAS objects and two IAS objects, one IAS for each of the GAS objects.
I know the problem has something to do with my SBT as i get the same value from optixGetSbtDataPointer in the closest hit program irregardless of which object is hit. So the second IAS refering to the second GAS is getting the SBT data for the first GAS, which causes illegal memory access in my code. If i comment out the internals of my closest hit program i can see that OptiX is getting the correct geometry data as the black outline of the 3D objects looks correct against the color set by my miss program.
The problem is that i am unsure where to change the SBT to correct this issue.
The documentation describes the formula:
sbt-index = sbt-instance-offset + (sbt-GAS-index * sbt-stride-from-trace-call) + sbt-offset-from-trace-call
Am i supposed to use the instance offset variable? This seems a bit strange to me as it seems far more natural that the GAS should store where it’s data in the SBT Hitgroup records is, rather than letting the IAS store it.
I may be misunderstanding how to use the SBT properly, so any guidance would be highly appreciated. I was unable to find any Optix 7 example code that where using multiple GAS objects at the same time.