Vulkan Ray Query no hit

Hi all, i have a simple fragment shader same as vk_ray_tracing_rayquery. I used also nvidia nsight to check that the tlas is correctly populated and it is ok. It seems that rayqueryproceedext is hitting anything even if origin direction and tlas are correct. Debug layer are quiet… any suggestion? Thanks!

RTX 3060 driver 537.34

That would require some more information to figure out what is going wrong.
For example a minimal and complete reproducer in failing state.

Maybe have a look through the Vulkan Raytracing tutorials and examples inside the NVIDIA nvpro-samples on github first:

Please work through the two Vulkan Raytracing tutorials there:

That should provide you with minimal working examples with increasing complexity which you could compare against your impementation.

Thanks for your reply. I write my own sample following exactly what you are suggesting. What i don’t understand i why there is no hit if Nsight show me the tlas and blas populated correctly and rendered in the acceleration structure interface. I see it there and it is correct. The culling flags are 0xFF in the instance and in the rayQueryInitializeEXT, culling is disabled too.

vec3 origin = inData.pos;
vec3 direction =;
float tMin = 0.1;
float tMax = 1000.0;

rayQueryEXT rayQuery;
rayQueryInitializeEXT(rayQuery, tlas, gl_RayFlagsTerminateOnFirstHitEXT, 0xFF, origin, tMin, direction, tMax);


if(rayQueryGetIntersectionTypeEXT(rayQuery, true) != gl_RayQueryCommittedIntersectionNoneEXT )
  col = vec4(0.0,0.0,0.0,1.0);

Again, to be able to answer that you either need to provide a minimal and complete reproducer, or better use a working example and change that to your needs.

For example I neither know what your scene geometry is, nor what your ray setup is, nor in what program domain you’re calling that code excerpt.

The example code matching your code excerpt most is this:

Please work through that example and compare the rest of the application with your code.
Maybe there is something totally different which is not properly setup, like the scene geometry or shaders.

Solved! The problem was in the TLAS build command. I think that, even if Nsight show you the rendered TLAS, what you see is not the real acceleration structure but only the rendered geometry buffer of the BLAS, identified by the address contained in the instance structure, but this not guarantees that the the TLAS is correct.
What i was doing is create an empty TLAS with the BUILD flag only allocating an empty structure, then i updated the Instance buffer and then i called only an UPDATE (refit) on the TLAS previously created but this seems not the right way to create acceleration structure. Now i’m rebuilding the TLAS every frame and eveything is working fine. What i don’t understand is why Nvidia Nsight doesn’t catch this error because everything looks tha same. Thanks for suggestions!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.