I’m trying to use IAS to manage mesh instances in my scene, one level IAS and one GAS for each instance. Each of my mesh instance has MULTIPLE sbt records (i.e. multiple sub-meshes in a mesh, one material for each sub-mesh). I’m using one triangle build input for each mesh instance.
But it seems that buildInput.triangleArray.sbtIndexOffsetBuffer become useless after using IAS. All triangles are shaded with the same material 0. (I’ve checked the data of vertexBuffer/indexBuffer/sbtIndexOffsetBuffer).
- Question: Should I modify my codes to map one SUB-MESH to one IAS OptixInstance::sbtOffset? Should I abandon GAS buildInput.triangleArray.sbtIndexOffsetBuffer if I use IAS?
From my point of view, it’s reasonable that in closest hit shader:
currentHitSbtOffset = instanceSbtOffset + primitiveSbtOffset
But now my primitiveSbtOffset seems to be all 0s no matter how i change the content of GAS sbtIndexOffsetBuffer, that’s really weird.