Ray-Box Intersection in Vulkan Ray Tracing Pipeline

Hi all,

I have been working on one problem which require use of ray - AABB intersection, but i have noticed that in Vulkan, ray box intersection can happen in RT core itself, but it does not expose distance of where this ray has hit the box unlike ray-triangle intersection.

What i want is this kind of run :
RT Traversal → any-hit → RT Traversal → any-hit …

I’m using ray tracing pipeline(vkCmdTraceRaysKHR()), and calculating this hit distance would require me to add another shader stage of intersection test which will significantly slow down my task.

There is another way, that is using ray-query loop which i think could solve the problem as it does not involve any separate shader stages and I could just find intersection(box entry exit distances) in the compute shader itself. But after some reading, I found out that this idea have issues with having high register pressure of its own traversal state and as I need to maintain a 24 floats buffer also for the entire ray life which would add even more pressure. However, I believe experimenting with this idea is probably a better way to conclude that.

Also, I don’t want to use triangulated AABB as that could increase build BVH time. Also I would love to know if someone has any thoughts on difference in build BVH times of triangulated AABB and regular AABB.

I would like to know if there is anyway i could get hit distance fast for a ray-box intersection with raytracing pipeline? I’m new in ray-tracing and Vulkan programming. Any help would mean a lot. Thanks!