New Vulkan example on raytracing using VK_NV_ray_tracing

RTX2060

With all the new Turing extensions that NVIDIA has released alongside it’s new GPU architecture, I decided to replace my GTX 980 with a RTX 2060, mainly for the purpose of doing RTX ray-tracing related Vulkan stuff and also checking out things like mesh and task shaders.

Getting my first RTX accelerated ray tracing example up and running was pretty easy, thanks to tutorials like the one from NVIDIA and iOrange.

New example

With the first ray tracing example added to my Vulkan C++ example repository I tried to be as simple and straight forward as possible, with all the relevant bits and parts related to setting up and tracing the rays being in a single file, hopefully making this a good starting-point for those that want to get started with RTX ray-tracing using VK_NV_ray_tracing.

Similar to the basic rasterization sample, it’ll display a single colored triangle. The example contains a basic ray generation shader with camera movement, a ray miss shader (that just sets the background color) and a closest hit shader that’ll calculate the barycentric coordinates for coloring the triangle:

Updated SPIR-V Visual Studio extension

I have also updated my SPIR-V Visual Studio extension to support all new turing shader extensions, including the ones for ray tracing. So if you’ve been using this extensions to compile GLSL to SPIR-V you may want to update it.

Debugging

If you need to debug your VK_NV_ray_tracing applications, or just want to see how everything works together, NVIDIA has added full support for RTX Vulkan ray tracing in the latest release of the stand-alone NSight Graphics, allowing you to inspect all parts of the ray tracing pipeline, down to the geometry used by the acceleration structures: