Skip to main content

The Shader Binding Table Demystified

  • Chapter
Ray Tracing Gems II

Abstract

When a ray hits a geometry in the scene, the ray tracing hardware needs some way to determine which shader to call to perform intersection tests or shading calculations. The Shader Binding Table (SBT) provides this information. The SBT is a lookup table that associates each geometry in the scene with a set of shader function handles and parameters for these functions. Each set of function handles and parameters is referred to as a shader record. When a geometry is hit by a ray, a set of parameters specified on both the host and device sides of the application combine to determine which shader record is called. The three GPU ray tracing APIs (DirectX Raytracing, Vulkan KHR Ray Tracing, and OptiX) use the SBT to run user code when tracing rays in the scene. These APIs provide a great deal of flexibility as to how the SBT can be set up and indexed during rendering, providing a number of options to applications. However, this generality makes properly setting up the SBT an especially thorny part of these APIs for new users, as incorrect SBT access often leads to crashes or difficult bugs. Translating knowledge from one API to another can also be difficult due to subtle naming differences between them. This chapter looks at the similarities and differences of each API's SBT to develop a holistic understanding of the programming model. A few common configurations of the scene, SBT, and renderer are also discussed to provide guidance through hands-on examples.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Open Access This chapter is licensed under the terms of the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License (http://creativecommons.org/licenses/by-nc-nd/4.0/), which permits any noncommercial use, sharing, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license and indicate if you modified the licensed material. You do not have permission under this license to share adapted material derived from this chapter or parts of it.

The images or other third party material in this chapter are included in the chapter’s Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the chapter’s Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder.

Reprints and permissions

Copyright information

© 2021 NVIDIA

About this chapter

Cite this chapter

Usher, W. (2021). The Shader Binding Table Demystified. In: Marrs, A., Shirley, P., Wald, I. (eds) Ray Tracing Gems II. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-7185-8_15

Download citation

Publish with us

Policies and ethics