Defining and creating a ray tracing pipeline
Now that we have defined our Acceleration Structures, we can turn our attention to ray tracing pipelines. As we mentioned previously, ray tracing shaders work differently compared to traditional graphics and compute shaders. Ray tracing shaders are setup to call other shaders according to the shader binding table setup.
If you are familiar with C++, you can think of this setup as a simple form of polymorphism: the interface of a ray tracing pipeline is always the same, but we can dynamically override which shaders (methods) get called at runtime. We don’t have to define all the entry points though.
In this example, for instance, we are going to define only a ray generation, the closest hit, and the miss shader. We are ignoring any-hit and intersection shaders for now.
As the name implies, the shader binding table can be represented in table form. This is the binding table we are going to build in our example: