Rasterization has been the dominant method to produce interactive
graphics, but increasing performance of graphics hardware has made ray
tracing a viable option for interactive rendering. Being able to
integrate ray tracing with traditional rasterization makes it easier for
applications to incrementally add ray traced effects to existing
applications or to do hybrid approaches with rasterization for primary
visibility and ray tracing for secondary queries.
Ray queries are available to all shader types, including graphics,
compute, and ray tracing pipelines. Ray queries are not able to launch
additional shaders, instead returning traversal results to the calling
shader.
This extension adds support for the following SPIR-V extension in
Vulkan:
Example of ray query in a GLSL shader, illustrating how to use ray
queries to determine whether a given position (at ray origin) is in
shadow or not, by tracing a ray towards the light, and checking for any
intersections with geometry occluding the light.
rayQueryEXT rq;
rayQueryInitializeEXT(rq, accStruct, gl_RayFlagsTerminateOnFirstHitEXT, cullMask, origin, tMin, direction, tMax);
// Traverse the acceleration structure and store information about the first intersection (if any)
rayQueryProceedEXT(rq);
if (rayQueryGetIntersectionTypeEXT(rq, true) == gl_RayQueryCommittedIntersectionNoneEXT) {
// Not in shadow
}
Issues
What are the changes between the public provisional
(VK_KHR_ray_tracing v8) release and the final
(VK_KHR_acceleration_structure v11 / VK_KHR_ray_query v1) release?
refactor VK_KHR_ray_tracing into 3 extensions, enabling
implementation flexibility and decoupling ray query support from ray
pipelines: