Search code examples
nvidiavulkanraytracing

How to getting all ray hits instead of only the closest hit


I found this example (https://developer.nvidia.com/rtx/raytracing/vkray) on how to use the ray-tracing extension.

But I need to get all hits on a ray with the model, not the closet hit (first intersection coordinates).

Is any solution to this? Thanks!


Solution

  • Yes, simply use the any-hit shader type instead of the closest-hit shader.

    Details on the different Vulkan NV ray tracing shader types can be found at https://devblogs.nvidia.com/vulkan-raytracing/.