VK_NV_RayTracing with procedural geometries

Has anyone managed to get ray tracing working with procedural geometries defined by AABBs using VK_GEOMETRY_TYPE_AABBS_NV ?

I’ve got a normal ray tracing pipeline working with triangles and a closest hit shader. But when I try with AABBs and an intersection shader, I get nothing on the screen.

I’ve even tried the simplest intersection shader:

void main()
	reportIntersectionNV(10, 0);

Is there a way to test that the shader is even called?

I’ve tried to visualise the Acceleration Structure using NSight Graphics, but it doesn’t seem to work as soon as I add the AABBs (the debugger just goes into an infinite loop). Either I’ve messed up the AABB acceleration structures or the debugger isn’t working.

Any open source example would be greatly appreciated. So far I’m swimming in complete darkness.


So far I believe the AABB acceleration structure is working as advertised.

I’ve put an infinite loop in the intersection shader. As expected, the application hangs when the camera points towards where the AABB should be, and runs fine when it’s off camera.

The closest-hit shader seems to be working as well. It correctly renders triangle based geometry when I move these instances to the same hit group as my procedural geometry.

Am I naive in thinking that the above simple call to reportIntersectionNV(10, 0) should allow me to see the exact AABB on the screen?

I think I’ve found the issue. The intersection shader does not seem to behave correctly if it does not declare a hitAttribute at global scope.

hitAttributeNV vec3 HitAttribute;

I’ve some experience with custom raytracing, the AABBs do work. Yes, you need in fact specify a hitAttributeNV, which is required to match your anyhit or closest hit shader ones if they use it. You can use a

hitAttributeNV bool _unused;

in your intersection shader if you want.


OMG, thank you!