“one IAS for each of the GAS objects.”
That is exactly what I’m doing in my OptiX 7 apps all the time.
“Am i supposed to use the instance offset variable?”
Yes.
If your SBT is setup to contain a hitgroupRecord entry per instance per raytype then the formula
sbt-index = sbt-instance-offset + (sbt-GAS-index * sbt-stride-from-trace-call) + sbt-offset-from-trace-call
means:
sbt-index == From where in the SBT optixGetSbtDataPointer() gets the data field of the hitrecord.
sbt-instance-offset == OptixInstance::sbtOffset
sbt-GAS-index == 0 // If GAS build input numSbtRecords == 1 this will be always zero.
sbt-stride-from-trace-call == NUM_RAYTYPES
sbt-offset-from-trace-call == IDX_RAYTYPE
which gives:
sbt-index = OptixInstance::sbtOffset + IDX_RAYTYPE from trace
Means your OptixInstance::sbtOffset needs to be setup to match its index position inside the SBT hitgroupRecordBase memory. That in turn normally has one entry per instance per raytype, like this:
m_sbt.hitgroupRecordCount = NUM_RAYTYPES * numInstances;
m_sbt.hitgroupRecordBase must contain the necessary record headers per instance data per ray type.
So OptixInstance::sbtOffset is set to the index inside that SBT data, something like its instance index in a vector * NUM_RAYTYPES for the case of GAS with one SBT entry.
(There are other ways to setup an SBT for this case as well.)