Explaining hitgroup records creation in sutil vs path tracer

The main difference between the two applications with respect to the shader binding table (SBT) is that the optixPathTracer only uses a single geometry acceleration structure (GAS) with multiple SBT hit record entries to handle the different colors of the polygons, while the optixMeshViewer is using a two-level acceleration structure, means a single instance acceleration structure (IAS) as root traversable where each mesh GAS is referenced by an instance in that IAS. Therefore the SBT layout needs to be different.

Please read this chapter of the OptiX Programming Guide
and concentrate on the SBT index calculation formula in chapter 7.3.
That is crucial to understand with which values from the instance and optixTrace arguments the traversal decides which hit or miss record to call inside your SBT.
Work through the examples given there. The SBT is very flexible and there are some possible structures when using instancing.

Please also refer to these previous posts which explained possible SBT layouts:

1 Like