1e5c31af7Sopenharmony_ci// Copyright 2018-2021 The Khronos Group Inc. 2e5c31af7Sopenharmony_ci// 3e5c31af7Sopenharmony_ci// SPDX-License-Identifier: CC-BY-4.0 4e5c31af7Sopenharmony_ci 5e5c31af7Sopenharmony_ci[[ray-traversal]] 6e5c31af7Sopenharmony_ci= Ray Traversal 7e5c31af7Sopenharmony_ci 8e5c31af7Sopenharmony_ciThe ray traversal process identifies and handles intersections between a ray 9e5c31af7Sopenharmony_ciand geometries in an acceleration structure. 10e5c31af7Sopenharmony_ci 11e5c31af7Sopenharmony_ciRay traversal cannot be started by a Vulkan API command directly - a shader 12e5c31af7Sopenharmony_cimust execute 13e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_query[code:OpRayQueryProceedKHR] 14e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_query+VK_KHR_ray_tracing_pipeline[or] 15e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_pipeline[code:OpTraceRayKHR] 16e5c31af7Sopenharmony_ci. 17e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_pipeline[] 18e5c31af7Sopenharmony_ciWhen the <<features-rayTracingPipeline,pname:rayTracingPipeline>> feature is 19e5c31af7Sopenharmony_cienabled, code:OpTraceRayKHR can: be used for <<ray-tracing, ray tracing>> in 20e5c31af7Sopenharmony_cia <<pipelines-ray-tracing, ray tracing pipeline>>. 21e5c31af7Sopenharmony_ciendif::VK_KHR_ray_tracing_pipeline[] 22e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_query[] 23e5c31af7Sopenharmony_ciWhen the <<features-rayQuery,pname:rayQuery>> feature is enabled, 24e5c31af7Sopenharmony_cicode:OpRayQueryProceedKHR can: be used in any shader stage. 25e5c31af7Sopenharmony_ciendif::VK_KHR_ray_query[] 26e5c31af7Sopenharmony_ci 27e5c31af7Sopenharmony_ci[[ray-intersection-candidate-determination]] 28e5c31af7Sopenharmony_ci== Ray Intersection Candidate Determination 29e5c31af7Sopenharmony_ci 30e5c31af7Sopenharmony_ciOnce tracing begins, rays are first tested against instances in a top-level 31e5c31af7Sopenharmony_ciacceleration structure. 32e5c31af7Sopenharmony_ciA ray that intersects an instance will be transformed into the space of the 33e5c31af7Sopenharmony_ciinstance to continue traversal within that instance; therefore the transform 34e5c31af7Sopenharmony_cimatrix stored in the instance must be invertible. 35e5c31af7Sopenharmony_ci 36e5c31af7Sopenharmony_ciNext, rays are tested against geometries in an bottom-level acceleration 37e5c31af7Sopenharmony_cistructure to determine if a hit occurred between them, initially based only 38e5c31af7Sopenharmony_cion their geometric properties (i.e. their vertices). 39e5c31af7Sopenharmony_ciThe implementation performs similar operations to that of rasterization, but 40e5c31af7Sopenharmony_ciwith the effective viewport determined by the parameters of the ray, and the 41e5c31af7Sopenharmony_cigeometry transformed into a space determined by that viewport. 42e5c31af7Sopenharmony_ci 43e5c31af7Sopenharmony_ciThe vertices of each primitive are transformed from acceleration structure 44e5c31af7Sopenharmony_cispace #~as~# to ray space #~r~# according to the ray origin and direction as 45e5c31af7Sopenharmony_cifollows: 46e5c31af7Sopenharmony_ci 47e5c31af7Sopenharmony_ci[latexmath] 48e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 49e5c31af7Sopenharmony_ci\left( 50e5c31af7Sopenharmony_ci \begin{array}{c} 51e5c31af7Sopenharmony_ci x_{r} \\ 52e5c31af7Sopenharmony_ci y_{r}\\ 53e5c31af7Sopenharmony_ci z_{r} 54e5c31af7Sopenharmony_ci \end{array} 55e5c31af7Sopenharmony_ci\right) = 56e5c31af7Sopenharmony_ci\left( 57e5c31af7Sopenharmony_ci \begin{matrix} 58e5c31af7Sopenharmony_ci a_x^2(1-c) + c & a_xa_y(1-c) - sa_z & a_xa_z(1-c) + sa_y \\ 59e5c31af7Sopenharmony_ci a_xa_y(1-c) + sa_z & a_y^2(1-c) + c & a_ya_z(1-c) - sa_x \\ 60e5c31af7Sopenharmony_ci a_xa_z(1-c) - sa_y & a_ya_z(1-c) + sa_x & a_z^2(1-c) + c 61e5c31af7Sopenharmony_ci \end{matrix} 62e5c31af7Sopenharmony_ci\right) 63e5c31af7Sopenharmony_ci\left( 64e5c31af7Sopenharmony_ci \begin{array}{c} 65e5c31af7Sopenharmony_ci x_{as} - o_x \\ 66e5c31af7Sopenharmony_ci y_{as} - o_y \\ 67e5c31af7Sopenharmony_ci z_{as} - o_z 68e5c31af7Sopenharmony_ci \end{array} 69e5c31af7Sopenharmony_ci\right) 70e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 71e5c31af7Sopenharmony_ci 72e5c31af7Sopenharmony_cilatexmath:[\mathbf{a}] is the axis of rotation from the unnormalized ray 73e5c31af7Sopenharmony_cidirection vector latexmath:[\mathbf{d}] to the axis vector 74e5c31af7Sopenharmony_cilatexmath:[\mathbf{k}]: 75e5c31af7Sopenharmony_ci 76e5c31af7Sopenharmony_ci[latexmath] 77e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 78e5c31af7Sopenharmony_ci\mathbf{a} = \begin{cases} 79e5c31af7Sopenharmony_ci \frac{\mathbf{d} \times \mathbf{k}}{|| \mathbf{d} \times \mathbf{k} ||} & \mathrm{if}\; || \mathbf{d} \times \mathbf{k} || \ne 0 \\ 80e5c31af7Sopenharmony_ci \left(\begin{array}{c} 81e5c31af7Sopenharmony_ci 0 \\ 82e5c31af7Sopenharmony_ci 1 \\ 83e5c31af7Sopenharmony_ci 0 84e5c31af7Sopenharmony_ci \end{array} 85e5c31af7Sopenharmony_ci \right) & \mathrm{if}\; || \mathbf{d} \times \mathbf{k} || = 0 \\ 86e5c31af7Sopenharmony_ci \end{cases} 87e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 88e5c31af7Sopenharmony_ci 89e5c31af7Sopenharmony_cilatexmath:[\mathit{s}] and latexmath:[\mathit{c}] are the sine and cosine of 90e5c31af7Sopenharmony_cithe angle of rotation about latexmath:[\mathbf{a}] from 91e5c31af7Sopenharmony_cilatexmath:[\mathbf{d}] to latexmath:[\mathbf{k}]: 92e5c31af7Sopenharmony_ci 93e5c31af7Sopenharmony_ci[latexmath] 94e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 95e5c31af7Sopenharmony_ci\begin{aligned} 96e5c31af7Sopenharmony_cic &= {{\mathbf{d} \cdot \mathbf{k}}\over{||\mathbf{d}||}} \\ 97e5c31af7Sopenharmony_cis &= \sqrt{1 - c^2} 98e5c31af7Sopenharmony_ci\end{aligned} 99e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 100e5c31af7Sopenharmony_ci 101e5c31af7Sopenharmony_cilatexmath:[\mathbf{k}] is the unit vector: 102e5c31af7Sopenharmony_ci 103e5c31af7Sopenharmony_ci[latexmath] 104e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 105e5c31af7Sopenharmony_ci\mathbf{k} = \left( 106e5c31af7Sopenharmony_ci \begin{array}{c} 107e5c31af7Sopenharmony_ci 0 \\ 108e5c31af7Sopenharmony_ci 0 \\ 109e5c31af7Sopenharmony_ci -1 110e5c31af7Sopenharmony_ci \end{array} 111e5c31af7Sopenharmony_ci\right) 112e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 113e5c31af7Sopenharmony_ci 114e5c31af7Sopenharmony_cilatexmath:[\mathbf{o}] and latexmath:[\mathbf{d}] are the ray origin and 115e5c31af7Sopenharmony_ciunnormalized direction, respectively; the vector described by [eq]#x~as~#, 116e5c31af7Sopenharmony_ci[eq]#y~as~#, and [eq]#z~as~# is any position in acceleration structure 117e5c31af7Sopenharmony_cispace; and the vector described by [eq]#x~r~#, [eq]#y~r~#, and [eq]#z~r~# is 118e5c31af7Sopenharmony_cithe same position in ray space. 119e5c31af7Sopenharmony_ci 120e5c31af7Sopenharmony_ciAn _intersection candidate_ is a unique point of intersection between a ray 121e5c31af7Sopenharmony_ciand a geometric primitive. 122e5c31af7Sopenharmony_ciFor any primitive that has within its bounds a position 123e5c31af7Sopenharmony_cilatexmath:[\mathbf{xyz_{as}}] such that 124e5c31af7Sopenharmony_ci 125e5c31af7Sopenharmony_ci[latexmath] 126e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 127e5c31af7Sopenharmony_ci\begin{aligned} 128e5c31af7Sopenharmony_ci x_r &= 0 \\ 129e5c31af7Sopenharmony_ci y_r &= 0 \\ 130e5c31af7Sopenharmony_cit_\mathit{min} \lt {-{z_r}\over{||\mathbf{d}||}} &\lt t_\mathit{max} & \text{if the primitive is a triangle,} \\ 131e5c31af7Sopenharmony_cit_\mathit{min} \leq {-{z_r}\over{||\mathbf{d}||}} &\leq t_\mathit{max} & \text{otherwise} \\ 132e5c31af7Sopenharmony_ci\end{aligned} 133e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 134e5c31af7Sopenharmony_ci 135e5c31af7Sopenharmony_ci(where latexmath:[t = {-{z_r}\over{||\mathbf{d}||}}]), an intersection 136e5c31af7Sopenharmony_cicandidate exists. 137e5c31af7Sopenharmony_ci 138e5c31af7Sopenharmony_ciTriangle primitive bounds consist of all points on the plane formed by the 139e5c31af7Sopenharmony_cithree vertices and within the bounds of the edges between the vertices, 140e5c31af7Sopenharmony_cisubject to the watertightness constraints below. 141e5c31af7Sopenharmony_ciAABB primitive bounds consist of all points within an implementation-defined 142e5c31af7Sopenharmony_cibound which includes the specified box. 143e5c31af7Sopenharmony_ci 144e5c31af7Sopenharmony_ci[NOTE] 145e5c31af7Sopenharmony_ci.Note 146e5c31af7Sopenharmony_ci==== 147e5c31af7Sopenharmony_ciThe bounds of the AABB including all points internal to the bound implies 148e5c31af7Sopenharmony_cithat a ray started within the AABB will hit that AABB. 149e5c31af7Sopenharmony_ci==== 150e5c31af7Sopenharmony_ci 151e5c31af7Sopenharmony_ci[[raytraversal-ray-intersection-candidate-diagram]] 152e5c31af7Sopenharmony_ciimage::{images}/ray_intersection_candidate.svg[align="center",title="Ray intersection candidate",opts="{imageopts}"] 153e5c31af7Sopenharmony_ci 154e5c31af7Sopenharmony_ciThe determination of this condition is performed in an implementation 155e5c31af7Sopenharmony_cispecific manner, and may: be performed with floating point operations. 156e5c31af7Sopenharmony_ciDue to the complexity and number of operations involved, inaccuracies are 157e5c31af7Sopenharmony_ciexpected, particularly as the scale of values involved begins to diverge. 158e5c31af7Sopenharmony_ciImplementations should: take efforts to maintain as much precision as 159e5c31af7Sopenharmony_cipossible. 160e5c31af7Sopenharmony_ci 161e5c31af7Sopenharmony_ci[NOTE] 162e5c31af7Sopenharmony_ci.Note 163e5c31af7Sopenharmony_ci==== 164e5c31af7Sopenharmony_ciOne very common case is when geometries are close to each other at some 165e5c31af7Sopenharmony_cidistance from the origin in acceleration structure space, where an effect 166e5c31af7Sopenharmony_cisimilar to "`z-fighting`" is likely to be observed. 167e5c31af7Sopenharmony_ciApplications can mitigate this by ensuring their detailed geometries remain 168e5c31af7Sopenharmony_ciclose to the origin. 169e5c31af7Sopenharmony_ci 170e5c31af7Sopenharmony_ciAnother likely case is when the origin of a ray is set to a position on a 171e5c31af7Sopenharmony_cipreviously intersected surface, and its [eq]#t~min~# is zero or near zero; 172e5c31af7Sopenharmony_cian intersection may be detected on the emitting surface. 173e5c31af7Sopenharmony_ciThis case can usually be mitigated by offsetting [eq]#t~min~# slightly. 174e5c31af7Sopenharmony_ci==== 175e5c31af7Sopenharmony_ci 176e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing_motion_blur[] 177e5c31af7Sopenharmony_ciFor a motion primitive or a motion instance, the positions for intersection 178e5c31af7Sopenharmony_ciare evaluated at the time specified in the code:time parameter to 179e5c31af7Sopenharmony_cicode:OpTraceRayMotionNV by interpolating between the two endpoints as 180e5c31af7Sopenharmony_cispecified for the given motion type. 181e5c31af7Sopenharmony_ciIf a motion acceleration structure is traced with code:OpTraceRayKHR, it 182e5c31af7Sopenharmony_cibehaves as a code:OpTraceRayMotionNV with code:time of 0.0. 183e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing_motion_blur[] 184e5c31af7Sopenharmony_ci 185e5c31af7Sopenharmony_ciIn the case of AABB geometries, implementations may: increase their size in 186e5c31af7Sopenharmony_cian acceleration structure in order to mitigate precision issues. 187e5c31af7Sopenharmony_ciThis may: result in false positive intersections being reported to the 188e5c31af7Sopenharmony_ciapplication. 189e5c31af7Sopenharmony_ci 190e5c31af7Sopenharmony_ciFor triangle intersection candidates, the [eq]#b# and [eq]#c# 191e5c31af7Sopenharmony_ci<<primsrast-polygon-barycentrics,barycentric coordinates>> on the triangle 192e5c31af7Sopenharmony_ciwhere the above condition is met are made available to future shading. 193e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_pipeline[] 194e5c31af7Sopenharmony_ciIf the ray was traced with code:OpTraceRayKHR, these values are available as 195e5c31af7Sopenharmony_cia vector of 2 32-bit floating point values in the code:HitAttributeKHR 196e5c31af7Sopenharmony_cistorage class. 197e5c31af7Sopenharmony_ciendif::VK_KHR_ray_tracing_pipeline[] 198e5c31af7Sopenharmony_ci 199e5c31af7Sopenharmony_ciOnce an intersection candidate is determined, it proceeds through the 200e5c31af7Sopenharmony_cifollowing operations, in order: 201e5c31af7Sopenharmony_ci 202e5c31af7Sopenharmony_ci . <<ray-intersection-culling>> 203e5c31af7Sopenharmony_ci . <<ray-intersection-confirmation>> 204e5c31af7Sopenharmony_ci . <<ray-closest-hit-determination>> 205e5c31af7Sopenharmony_ci . <<ray-result-determination>> 206e5c31af7Sopenharmony_ci 207e5c31af7Sopenharmony_ciThe sections below describe the exact details of these tests. 208e5c31af7Sopenharmony_ciThere is no ordering guarantee between operations performed on different 209e5c31af7Sopenharmony_ciintersection candidates. 210e5c31af7Sopenharmony_ci 211e5c31af7Sopenharmony_ci 212e5c31af7Sopenharmony_ci[[ray-traversal-watertight]] 213e5c31af7Sopenharmony_ci=== Watertightness 214e5c31af7Sopenharmony_ci 215e5c31af7Sopenharmony_ciFor a set of triangles with identical transforms, within a single instance: 216e5c31af7Sopenharmony_ci 217e5c31af7Sopenharmony_ci * Any set of two or more triangles where all triangles have one vertex 218e5c31af7Sopenharmony_ci with an identical position value, that vertex is a _shared vertex_. 219e5c31af7Sopenharmony_ci * Any set of two triangles with two shared vertices that were specified in 220e5c31af7Sopenharmony_ci the same <<drawing-triangle-lists, winding order>> in each triangle have 221e5c31af7Sopenharmony_ci a _shared edge_ defined by those vertices. 222e5c31af7Sopenharmony_ci 223e5c31af7Sopenharmony_ciA _closed fan_ is a set of three or more triangles where: 224e5c31af7Sopenharmony_ci 225e5c31af7Sopenharmony_ci * All triangles in the set have the same shared vertex as one of their 226e5c31af7Sopenharmony_ci vertices. 227e5c31af7Sopenharmony_ci * All edges that include the above vertex are shared edges. 228e5c31af7Sopenharmony_ci * All above shared edges are shared by exactly two triangles from the set. 229e5c31af7Sopenharmony_ci * No two triangles in the set intersect, except at shared edges. 230e5c31af7Sopenharmony_ci * Every triangle in the set is joined to every other triangle in the set by 231e5c31af7Sopenharmony_ci a series of the above shared edges. 232e5c31af7Sopenharmony_ci 233e5c31af7Sopenharmony_ciImplementations should: not double-hit or miss when a ray intersects a 234e5c31af7Sopenharmony_cishared edge, or a shared vertex of a closed fan. 235e5c31af7Sopenharmony_ci 236e5c31af7Sopenharmony_ci 237e5c31af7Sopenharmony_ci[[ray-intersection-culling]] 238e5c31af7Sopenharmony_ci== Ray Intersection Culling 239e5c31af7Sopenharmony_ci 240e5c31af7Sopenharmony_ciCandidate intersections go through several phases of culling before 241e5c31af7Sopenharmony_ciconfirmation as an actual hit. 242e5c31af7Sopenharmony_ciThere is no particular ordering dependency between the different culling 243e5c31af7Sopenharmony_cioperations. 244e5c31af7Sopenharmony_ci 245e5c31af7Sopenharmony_ci 246e5c31af7Sopenharmony_ci[[ray-traversal-culling-primitive]] 247e5c31af7Sopenharmony_ci=== Ray Primitive Culling 248e5c31af7Sopenharmony_ci 249e5c31af7Sopenharmony_ciIf the <<features-rayTraversalPrimitiveCulling, 250e5c31af7Sopenharmony_cipname:rayTraversalPrimitiveCulling>> or <<features-rayQuery, 251e5c31af7Sopenharmony_cipname:rayQuery>> features are enabled, the code:SkipTrianglesKHR and 252e5c31af7Sopenharmony_cicode:SkipAABBsKHR ray flags can: be specified when tracing a ray. 253e5c31af7Sopenharmony_ci 254e5c31af7Sopenharmony_ciIf code:SkipTrianglesKHR was included in the `Ray Flags` operand of the ray 255e5c31af7Sopenharmony_citrace instruction, and the intersection is with a triangle primitive, the 256e5c31af7Sopenharmony_ciintersection is dropped, and no further processing of this intersection 257e5c31af7Sopenharmony_cioccurs. 258e5c31af7Sopenharmony_ciIf ename:VK_PIPELINE_CREATE_RAY_TRACING_SKIP_TRIANGLES_BIT_KHR was included 259e5c31af7Sopenharmony_ciin the pipeline, traversal with code:OpTraceRayKHR calls will all behave as 260e5c31af7Sopenharmony_ciif code:SkipTrianglesKHR was included in its `Ray Flags` operand. 261e5c31af7Sopenharmony_ci 262e5c31af7Sopenharmony_ciIf code:SkipAABBsKHR was included in the `Ray Flags` operand of the ray 263e5c31af7Sopenharmony_citrace instruction, and the intersection is with an AABB primitive, the 264e5c31af7Sopenharmony_ciintersection is dropped, and no further processing of this intersection 265e5c31af7Sopenharmony_cioccurs. 266e5c31af7Sopenharmony_ciIf ename:VK_PIPELINE_CREATE_RAY_TRACING_SKIP_AABBS_BIT_KHR was included in 267e5c31af7Sopenharmony_cithe pipeline, traversal with code:OpTraceRayKHR calls will all behave as if 268e5c31af7Sopenharmony_cicode:SkipAABBsKHR was included in its `Ray Flags` operand. 269e5c31af7Sopenharmony_ci 270e5c31af7Sopenharmony_ci 271e5c31af7Sopenharmony_ci=== Ray Mask Culling 272e5c31af7Sopenharmony_ci 273e5c31af7Sopenharmony_ciInstances can: be made invisible to particular rays based on the value of 274e5c31af7Sopenharmony_cislink:VkAccelerationStructureInstanceKHR::pname:mask used to add that 275e5c31af7Sopenharmony_ciinstance to a top-level acceleration structure, and the `Cull Mask` 276e5c31af7Sopenharmony_ciparameter used to trace the ray. 277e5c31af7Sopenharmony_ci 278e5c31af7Sopenharmony_ciFor the instance which is intersected, if [eq]#pname:mask & `Cull Mask` == 279e5c31af7Sopenharmony_ci0#, the intersection is dropped, and no further processing occurs. 280e5c31af7Sopenharmony_ci 281e5c31af7Sopenharmony_ci 282e5c31af7Sopenharmony_ci[[ray-traversal-culling-face]] 283e5c31af7Sopenharmony_ci=== Ray Face Culling 284e5c31af7Sopenharmony_ci 285e5c31af7Sopenharmony_ciAs in <<primsrast-polygons-basic,polygon rasterization>>, one of the stages 286e5c31af7Sopenharmony_ciof ray traversal is to determine if a triangle primitive is back- or 287e5c31af7Sopenharmony_cifront-facing, and primitives can: be culled based on that facing. 288e5c31af7Sopenharmony_ci 289e5c31af7Sopenharmony_ciIf the intersection candidate is with an AABB primitive, this operation is 290e5c31af7Sopenharmony_ciskipped. 291e5c31af7Sopenharmony_ci 292e5c31af7Sopenharmony_ci.Determination 293e5c31af7Sopenharmony_ci 294e5c31af7Sopenharmony_ciWhen a ray intersects a triangle primitive, the order that vertices are 295e5c31af7Sopenharmony_cispecified for the polygon affects whether the ray intersects the front or 296e5c31af7Sopenharmony_ciback face. 297e5c31af7Sopenharmony_ciFront or back facing is determined in the same way as they are for 298e5c31af7Sopenharmony_ci<<primsrast-polygons-basic,rasterization>>, based on the sign of the 299e5c31af7Sopenharmony_cipolygon's area but using the ray space coordinates instead of framebuffer 300e5c31af7Sopenharmony_cicoordinates. 301e5c31af7Sopenharmony_ciOne way to compute this area is: 302e5c31af7Sopenharmony_ci 303e5c31af7Sopenharmony_ci[latexmath] 304e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 305e5c31af7Sopenharmony_cia = -{1 \over 2}\sum_{i=0}^{n-1} 306e5c31af7Sopenharmony_ci x_r^i y_r^{i \oplus 1} - 307e5c31af7Sopenharmony_ci x_r^{i \oplus 1} y_r^i 308e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 309e5c31af7Sopenharmony_ci 310e5c31af7Sopenharmony_ciwhere latexmath:[x_r^i] and latexmath:[y_r^i] are the [eq]#x# and [eq]#y# 311e5c31af7Sopenharmony_ci<<ray-intersection-candidate-determination,ray space coordinates>> of the 312e5c31af7Sopenharmony_ci[eq]##i##th vertex of the [eq]#n#-vertex polygon (vertices are numbered 313e5c31af7Sopenharmony_cistarting at zero for the purposes of this computation) and [eq]#i {oplus} 1# 314e5c31af7Sopenharmony_ciis [eq]#(i {plus} 1) mod n#. 315e5c31af7Sopenharmony_ci 316e5c31af7Sopenharmony_ciBy default, if [eq]#a# is negative then the intersection is with the front 317e5c31af7Sopenharmony_ciface of the triangle, otherwise it is with the back face. 318e5c31af7Sopenharmony_ciIf ename:VK_GEOMETRY_INSTANCE_TRIANGLE_FLIP_FACING_BIT_KHR is included in 319e5c31af7Sopenharmony_cislink:VkAccelerationStructureInstanceKHR::pname:flags for the instance 320e5c31af7Sopenharmony_cicontaining the intersected triangle, this determination is reversed. 321e5c31af7Sopenharmony_ciAdditionally, if [eq]#a# is 0, the intersection candidate is treated as not 322e5c31af7Sopenharmony_ciintersecting with any face, irrespective of the sign. 323e5c31af7Sopenharmony_ci 324e5c31af7Sopenharmony_ci[NOTE] 325e5c31af7Sopenharmony_ci.Note 326e5c31af7Sopenharmony_ci==== 327e5c31af7Sopenharmony_ciIn a left-handed coordinate system, an intersection will be with the front 328e5c31af7Sopenharmony_ciface of a triangle if the vertices of the triangle, as defined in index 329e5c31af7Sopenharmony_ciorder, appear from the ray's perspective in a clockwise rotation order. 330e5c31af7Sopenharmony_ciename:VK_GEOMETRY_INSTANCE_TRIANGLE_FLIP_FACING_BIT_KHR was previously 331e5c31af7Sopenharmony_ciannotated as 332e5c31af7Sopenharmony_ciename:VK_GEOMETRY_INSTANCE_TRIANGLE_FRONT_COUNTERCLOCKWISE_BIT_KHR because 333e5c31af7Sopenharmony_ciof this. 334e5c31af7Sopenharmony_ci==== 335e5c31af7Sopenharmony_ci 336e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_pipeline[] 337e5c31af7Sopenharmony_ciIf the ray was traced with code:OpTraceRayKHR, the code:HitKindKHR built-in 338e5c31af7Sopenharmony_ciis set to code:HitKindFrontFacingTriangleKHR if the intersection is with 339e5c31af7Sopenharmony_cifront-facing geometry, and code:HitKindBackFacingTriangleKHR if the 340e5c31af7Sopenharmony_ciintersection is with back-facing geometry, for shader stages considering 341e5c31af7Sopenharmony_cithis intersection. 342e5c31af7Sopenharmony_ciendif::VK_KHR_ray_tracing_pipeline[] 343e5c31af7Sopenharmony_ci 344e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_query[] 345e5c31af7Sopenharmony_ciIf the ray was traced with code:OpRayQueryProceedKHR, 346e5c31af7Sopenharmony_cicode:OpRayQueryGetIntersectionFrontFaceKHR will return true for intersection 347e5c31af7Sopenharmony_cicandidates with front faces, or false for back faces. 348e5c31af7Sopenharmony_ciendif::VK_KHR_ray_query[] 349e5c31af7Sopenharmony_ci 350e5c31af7Sopenharmony_ci.Culling 351e5c31af7Sopenharmony_ci 352e5c31af7Sopenharmony_ciIf code:CullBackFacingTrianglesKHR was included in the `Ray Flags` parameter 353e5c31af7Sopenharmony_ciof the ray trace instruction, and the intersection is determined as with the 354e5c31af7Sopenharmony_ciback face of a triangle primitive, the intersection is dropped, and no 355e5c31af7Sopenharmony_cifurther processing of this intersection occurs. 356e5c31af7Sopenharmony_ci 357e5c31af7Sopenharmony_ciIf code:CullFrontFacingTrianglesKHR was included in the `Ray Flags` 358e5c31af7Sopenharmony_ciparameter of the ray trace instruction, and the intersection is determined 359e5c31af7Sopenharmony_cias with the front face of a triangle primitive, the intersection is dropped, 360e5c31af7Sopenharmony_ciand no further processing of this intersection occurs. 361e5c31af7Sopenharmony_ci 362e5c31af7Sopenharmony_ciThis culling is disabled if 363e5c31af7Sopenharmony_ciename:VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR was included 364e5c31af7Sopenharmony_ciin slink:VkAccelerationStructureInstanceKHR::pname:flags for the instance 365e5c31af7Sopenharmony_ciwhich the intersected geometry belongs to. 366e5c31af7Sopenharmony_ci 367e5c31af7Sopenharmony_ciIntersection candidates that have not intersected with any face ([eq]#a == 368e5c31af7Sopenharmony_ci0#) are unconditionally culled, irrespective of ray flags and geometry 369e5c31af7Sopenharmony_ciinstance flags. 370e5c31af7Sopenharmony_ci 371e5c31af7Sopenharmony_ci 372e5c31af7Sopenharmony_ci=== Ray Opacity Culling 373e5c31af7Sopenharmony_ci 374e5c31af7Sopenharmony_ciEach geometry in the acceleration structure may: be considered either opaque 375e5c31af7Sopenharmony_cior not. 376e5c31af7Sopenharmony_ciOpaque geometries continue through traversal as normal, whereas non-opaque 377e5c31af7Sopenharmony_cigeometries need to be either confirmed or discarded by shader code. 378e5c31af7Sopenharmony_ciIntersection candidates can: also be culled based on their opacity. 379e5c31af7Sopenharmony_ci 380e5c31af7Sopenharmony_ci.Determination 381e5c31af7Sopenharmony_ci 382e5c31af7Sopenharmony_ciEach individual intersection candidate is initally determined as opaque if 383e5c31af7Sopenharmony_ciename:VK_GEOMETRY_OPAQUE_BIT_KHR was included in the 384e5c31af7Sopenharmony_cislink:VkAccelerationStructureGeometryKHR::pname:flags when the geometry it 385e5c31af7Sopenharmony_ciintersected with was built, otherwise it is considered non-opaque. 386e5c31af7Sopenharmony_ci 387e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_pipeline[] 388e5c31af7Sopenharmony_ciIf the intersection candidate was generated by an <<shaders-intersection, 389e5c31af7Sopenharmony_ciintersection shader>>, the intersection is initially considered to have 390e5c31af7Sopenharmony_ciopacity matching the AABB candidate that it was generated from. 391e5c31af7Sopenharmony_ciendif::VK_KHR_ray_tracing_pipeline[] 392e5c31af7Sopenharmony_ci 393e5c31af7Sopenharmony_ciHowever, this opacity can be overridden when it is built into an instance. 394e5c31af7Sopenharmony_ciSetting ename:VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_KHR in 395e5c31af7Sopenharmony_cislink:VkAccelerationStructureInstanceKHR::pname:flags will force all 396e5c31af7Sopenharmony_cigeometries in the instance to be considered opaque. 397e5c31af7Sopenharmony_ciSimilarly, setting ename:VK_GEOMETRY_INSTANCE_FORCE_NO_OPAQUE_BIT_KHR will 398e5c31af7Sopenharmony_ciforce all geometries in the instance to be considered non-opaque. 399e5c31af7Sopenharmony_ci 400e5c31af7Sopenharmony_ciThis can again be overridden by including code:OpaqueKHR or code:NoOpaqueKHR 401e5c31af7Sopenharmony_ciin the `Ray Flags` parameter when tracing a ray. 402e5c31af7Sopenharmony_cicode:OpaqueKHR forces all geometries to behave as if they are opaque, 403e5c31af7Sopenharmony_ciregardless of their build parameters. 404e5c31af7Sopenharmony_ciSimilarly, code:NoOpaqueKHR forces all geometries to behave as if they are 405e5c31af7Sopenharmony_cinon-opaque. 406e5c31af7Sopenharmony_ci 407e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_query[] 408e5c31af7Sopenharmony_ciIf the ray was traced with code:OpRayQueryProceedKHR, to determine the 409e5c31af7Sopenharmony_ciopacity of AABB intersection candidates, 410e5c31af7Sopenharmony_cicode:OpRayQueryGetIntersectionCandidateAABBOpaqueKHR can: be used. 411e5c31af7Sopenharmony_ciThis instruction will return code:true for opaque intersection candidates, 412e5c31af7Sopenharmony_ciand code:false for non-opaque intersection candidates. 413e5c31af7Sopenharmony_ciendif::VK_KHR_ray_query[] 414e5c31af7Sopenharmony_ci 415e5c31af7Sopenharmony_ci.Culling 416e5c31af7Sopenharmony_ci 417e5c31af7Sopenharmony_ciIf code:CullOpaqueKHR is included in the `Ray Flags` parameter when tracing 418e5c31af7Sopenharmony_cia ray, an intersection with a geometry that is considered opaque is dropped, 419e5c31af7Sopenharmony_ciand no further processing occurs. 420e5c31af7Sopenharmony_ci 421e5c31af7Sopenharmony_ciIf code:CullNoOpaqueKHR is included in the `Ray Flags` parameter when 422e5c31af7Sopenharmony_citracing a ray, an intersection with a geometry that is considered non-opaque 423e5c31af7Sopenharmony_ciis dropped, and no further processing occurs. 424e5c31af7Sopenharmony_ci 425e5c31af7Sopenharmony_ci 426e5c31af7Sopenharmony_ci[[ray-intersection-confirmation]] 427e5c31af7Sopenharmony_ci== Ray Intersection Confirmation 428e5c31af7Sopenharmony_ci 429e5c31af7Sopenharmony_ciDepending on the opacity of intersected geometry and whether it is a 430e5c31af7Sopenharmony_citriangle or an AABB, candidate intersections are further processed to 431e5c31af7Sopenharmony_cidetermine the eventual hit result. 432e5c31af7Sopenharmony_ciCandidates generated from AABB intersections run through the same 433e5c31af7Sopenharmony_ciconfirmation process as triangle hits. 434e5c31af7Sopenharmony_ci 435e5c31af7Sopenharmony_ci 436e5c31af7Sopenharmony_ci=== AABB Intersection Candidates 437e5c31af7Sopenharmony_ci 438e5c31af7Sopenharmony_ciFor an intersection candidate with an AABB geometry generated by 439e5c31af7Sopenharmony_ci<<ray-intersection-candidate-determination>>, shader code is executed to 440e5c31af7Sopenharmony_cidetermine whether any hits should be reported to the traversal 441e5c31af7Sopenharmony_ciinfrastructure; no further processing of this intersection candidate occurs. 442e5c31af7Sopenharmony_ciThe occurrence of an AABB intersection candidate does not guarantee the ray 443e5c31af7Sopenharmony_ciintersects the primitive bounds. 444e5c31af7Sopenharmony_ciTo avoid propagating false intersections the application should: verify the 445e5c31af7Sopenharmony_ciintersection candidate before reporting any hits. 446e5c31af7Sopenharmony_ci 447e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_pipeline[] 448e5c31af7Sopenharmony_ciIf the ray was traced with code:OpTraceRayKHR, an <<shaders-intersection, 449e5c31af7Sopenharmony_ciintersection shader>> is invoked from the <<shader-binding-table>> according 450e5c31af7Sopenharmony_cito the <<shader-binding-table-indexing-rules, specified indexing>> for the 451e5c31af7Sopenharmony_ciintersected geometry. 452e5c31af7Sopenharmony_ciIf this shader calls code:OpReportIntersectionKHR, a new intersection 453e5c31af7Sopenharmony_cicandidate is generated as described 454e5c31af7Sopenharmony_ci<<aabb-intersection-candidate-generation, below>>. 455e5c31af7Sopenharmony_ciIf the intersection shader is ename:VK_SHADER_UNUSED_KHR (which is only 456e5c31af7Sopenharmony_ciallowed for a zero shader group) then no further processing of the 457e5c31af7Sopenharmony_ciintersection candidate occurs. 458e5c31af7Sopenharmony_ciendif::VK_KHR_ray_tracing_pipeline[] 459e5c31af7Sopenharmony_ci 460e5c31af7Sopenharmony_ci[[aabb-intersection-candidate-generation]] 461e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_pipeline[] 462e5c31af7Sopenharmony_ciEach new candidate generated as a result of this processing is a generated 463e5c31af7Sopenharmony_ciintersection candidate that intersects the AABB geometry, with a [eq]#t# 464e5c31af7Sopenharmony_civalue equal to the `Hit` parameter of the code:OpReportIntersectionKHR 465e5c31af7Sopenharmony_ciinstruction. 466e5c31af7Sopenharmony_ciThe new generated candidate is then independently run through 467e5c31af7Sopenharmony_ci<<ray-intersection-confirmation>> as a 468e5c31af7Sopenharmony_ci<<ray-triangle-and-generated-intersection-candidates, generated 469e5c31af7Sopenharmony_ciintersection>>. 470e5c31af7Sopenharmony_ciendif::VK_KHR_ray_tracing_pipeline[] 471e5c31af7Sopenharmony_ci 472e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_query[] 473e5c31af7Sopenharmony_ciIf the ray was traced with code:OpRayQueryProceedKHR, control is returned to 474e5c31af7Sopenharmony_cithe shader which executed code:OpRayQueryProceedKHR, returning code:true. 475e5c31af7Sopenharmony_ciThe resulting ray query has a candidate intersection type of 476e5c31af7Sopenharmony_cicode:RayQueryCandidateIntersectionAABBKHR. 477e5c31af7Sopenharmony_cicode:OpRayQueryGenerateIntersectionKHR can: be called to commit a new 478e5c31af7Sopenharmony_ciintersection candidate with committed intersection type of 479e5c31af7Sopenharmony_cicode:RayQueryCommittedIntersectionGeneratedKHR. 480e5c31af7Sopenharmony_ciFurther ray query processing can: be continued by executing 481e5c31af7Sopenharmony_cicode:OpRayQueryProceedKHR with the same ray query, or intersection can: be 482e5c31af7Sopenharmony_citerminated with code:OpRayQueryTerminateKHR. 483e5c31af7Sopenharmony_ciendif::VK_KHR_ray_query[] 484e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_pipeline+VK_KHR_ray_query[] 485e5c31af7Sopenharmony_ciUnlike rays traced with code:OpTraceRayKHR, candidates generated in this way 486e5c31af7Sopenharmony_ciskip generated intersection candidate confirmation; applications should: 487e5c31af7Sopenharmony_cimake this determination before generating the intersection. 488e5c31af7Sopenharmony_ciendif::VK_KHR_ray_tracing_pipeline+VK_KHR_ray_query[] 489e5c31af7Sopenharmony_ci 490e5c31af7Sopenharmony_ciThis operation may: be executed multiple times for the same intersection 491e5c31af7Sopenharmony_cicandidate. 492e5c31af7Sopenharmony_ci 493e5c31af7Sopenharmony_ci 494e5c31af7Sopenharmony_ci[[ray-triangle-and-generated-intersection-candidates]] 495e5c31af7Sopenharmony_ci=== Triangle and Generated Intersection Candidates 496e5c31af7Sopenharmony_ci 497e5c31af7Sopenharmony_ciFor triangle and <<aabb-intersection-candidate-generation, generated 498e5c31af7Sopenharmony_ciintersection candidates>>, additional shader code may: be executed based on 499e5c31af7Sopenharmony_cithe intersection's opacity. 500e5c31af7Sopenharmony_ci 501e5c31af7Sopenharmony_ciIf the intersection is opaque, the candidate is immediately confirmed as a 502e5c31af7Sopenharmony_civalid hit and passes to the next stage of processing. 503e5c31af7Sopenharmony_ci 504e5c31af7Sopenharmony_ciFor non-opaque intersection candidates, shader code is executed to determine 505e5c31af7Sopenharmony_ciwhether a hit occurred or not. 506e5c31af7Sopenharmony_ci 507e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_pipeline[] 508e5c31af7Sopenharmony_ciIf the ray was traced with code:OpTraceRayKHR, an <<shaders-any-hit, any-hit 509e5c31af7Sopenharmony_cishader>> is invoked from the <<shader-binding-table>> according to the 510e5c31af7Sopenharmony_cispecified indexing. 511e5c31af7Sopenharmony_ciIf this shader calls code:OpIgnoreIntersectionKHR, the candidate is dropped 512e5c31af7Sopenharmony_ciand no further processing of the candidate occurs. 513e5c31af7Sopenharmony_ciIf the <<shaders-any-hit, any-hit shader>> identified is 514e5c31af7Sopenharmony_ciename:VK_SHADER_UNUSED_KHR, the candidate is immediately confirmed as a 515e5c31af7Sopenharmony_civalid hit and passes to the next stage of processing. 516e5c31af7Sopenharmony_ciendif::VK_KHR_ray_tracing_pipeline[] 517e5c31af7Sopenharmony_ci 518e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_query[] 519e5c31af7Sopenharmony_ciIf the ray was traced with code:OpRayQueryProceedKHR, control is returned to 520e5c31af7Sopenharmony_cithe shader which executed code:OpRayQueryProceedKHR, returning code:true. 521e5c31af7Sopenharmony_ciAs only triangle candidates participate in this operation with ray queries, 522e5c31af7Sopenharmony_cithe resulting candidate intersection type is always 523e5c31af7Sopenharmony_cicode:RayQueryCandidateIntersectionTriangleKHR. 524e5c31af7Sopenharmony_cicode:OpRayQueryConfirmIntersectionKHR can: be called on the ray query to 525e5c31af7Sopenharmony_ciconfirm the candidate as a hit with committed intersection type of 526e5c31af7Sopenharmony_cicode:RayQueryCommittedIntersectionTriangleKHR. 527e5c31af7Sopenharmony_ciFurther ray query processing can: be continued by executing 528e5c31af7Sopenharmony_cicode:OpRayQueryProceedKHR with the same ray query, or intersection can: be 529e5c31af7Sopenharmony_citerminated with code:OpRayQueryTerminateKHR. 530e5c31af7Sopenharmony_ciIf code:OpRayQueryConfirmIntersectionKHR has not been executed, the 531e5c31af7Sopenharmony_cicandidate is dropped and no further processing of the candidate occurs. 532e5c31af7Sopenharmony_ciendif::VK_KHR_ray_query[] 533e5c31af7Sopenharmony_ci 534e5c31af7Sopenharmony_ciThis operation may: be executed multiple times for the same intersection 535e5c31af7Sopenharmony_cicandidate unless ename:VK_GEOMETRY_NO_DUPLICATE_ANY_HIT_INVOCATION_BIT_KHR 536e5c31af7Sopenharmony_ciwas specified for the intersected geometry. 537e5c31af7Sopenharmony_ci 538e5c31af7Sopenharmony_ci 539e5c31af7Sopenharmony_ci[[ray-closest-hit-determination]] 540e5c31af7Sopenharmony_ci== Ray Closest Hit Determination 541e5c31af7Sopenharmony_ci 542e5c31af7Sopenharmony_ciUnless the ray was traced with the code:TerminateOnFirstHitKHR ray flag, the 543e5c31af7Sopenharmony_ciimplementation must: track the closest confirmed hit until all geometries 544e5c31af7Sopenharmony_cihave been tested and either confirmed or dropped. 545e5c31af7Sopenharmony_ci 546e5c31af7Sopenharmony_ciAfter an intersection candidate is confirmed, its [eq]#t# value is compared 547e5c31af7Sopenharmony_cito [eq]#t~max~# to determine which intersection is closer, where [eq]#t# is 548e5c31af7Sopenharmony_cithe parametric distance along the ray at which the intersection occurred. 549e5c31af7Sopenharmony_ci 550e5c31af7Sopenharmony_ci * If [eq]#t < t~max~#, [eq]#t~max~# is set to [eq]#t# and the candidate is 551e5c31af7Sopenharmony_ci set as the current closest hit. 552e5c31af7Sopenharmony_ci * If [eq]#t > t~max~#, the candidate is dropped and no further processing 553e5c31af7Sopenharmony_ci of that candidate occurs. 554e5c31af7Sopenharmony_ci * If [eq]#t = t~max~#, the candidate may: be set as the current closest 555e5c31af7Sopenharmony_ci hit or dropped. 556e5c31af7Sopenharmony_ci 557e5c31af7Sopenharmony_ciIf code:TerminateOnFirstHitKHR was included in the `Ray Flags` used to trace 558e5c31af7Sopenharmony_cithe ray, once the first hit is confirmed, the ray trace is terminated. 559e5c31af7Sopenharmony_ci 560e5c31af7Sopenharmony_ci 561e5c31af7Sopenharmony_ci[[ray-result-determination]] 562e5c31af7Sopenharmony_ci== Ray Result Determination 563e5c31af7Sopenharmony_ci 564e5c31af7Sopenharmony_ciOnce all candidates have finished processing the prior stages, or if the ray 565e5c31af7Sopenharmony_ciis forcibly terminated, the final result of the ray trace is determined. 566e5c31af7Sopenharmony_ci 567e5c31af7Sopenharmony_ciIf a closest hit result was identified by <<ray-closest-hit-determination>>, 568e5c31af7Sopenharmony_cia closest hit has occurred, otherwise the final result is a miss. 569e5c31af7Sopenharmony_ci 570e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_pipeline[] 571e5c31af7Sopenharmony_ciFor rays traced with code:OpTraceRayKHR, if a closest hit result was 572e5c31af7Sopenharmony_ciidentified, a <<shaders-closest-hit, closest hit shader>> is invoked from 573e5c31af7Sopenharmony_cithe <<shader-binding-table>> according to the 574e5c31af7Sopenharmony_ci<<shader-binding-table-indexing-rules, specified indexing>> for the 575e5c31af7Sopenharmony_ciintersected geometry. 576e5c31af7Sopenharmony_ciControl returns to the shader that executed code:OpTraceRayKHR once this 577e5c31af7Sopenharmony_cishader returns. 578e5c31af7Sopenharmony_ciThis shader is skipped if either the ray flags included 579e5c31af7Sopenharmony_cicode:SkipClosestHitShaderKHR, or if the <<shaders-closest-hit, closest hit 580e5c31af7Sopenharmony_cishader>> identified is ename:VK_SHADER_UNUSED_KHR. 581e5c31af7Sopenharmony_ci 582e5c31af7Sopenharmony_ciFor rays traced with code:OpTraceRayKHR where no hit result was identified, 583e5c31af7Sopenharmony_cithe <<shaders-miss, miss shader>> identified by the `Miss Index` parameter 584e5c31af7Sopenharmony_ciof code:OpTraceRayKHR is invoked. 585e5c31af7Sopenharmony_ciControl returns to the shader that executed code:OpTraceRayKHR once this 586e5c31af7Sopenharmony_cishader returns. 587e5c31af7Sopenharmony_ciThis shader is skipped if the miss shader identified is 588e5c31af7Sopenharmony_ciename:VK_SHADER_UNUSED_KHR. 589e5c31af7Sopenharmony_ciendif::VK_KHR_ray_tracing_pipeline[] 590e5c31af7Sopenharmony_ci 591e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_query[] 592e5c31af7Sopenharmony_ciIf the ray was traced with code:OpRayQueryProceedKHR, control is returned to 593e5c31af7Sopenharmony_cithe shader which executed code:OpRayQueryProceedKHR, returning code:false. 594e5c31af7Sopenharmony_ciIf a closest hit was identified by <<ray-closest-hit-determination>>, the 595e5c31af7Sopenharmony_ciray query will now have a committed intersection type of 596e5c31af7Sopenharmony_cicode:RayQueryCommittedIntersectionGeneratedKHR or 597e5c31af7Sopenharmony_cicode:RayQueryCommittedIntersectionTriangleKHR. 598e5c31af7Sopenharmony_ciIf no closest hit was identified, the committed intersection type will be 599e5c31af7Sopenharmony_cicode:RayQueryCommittedIntersectionNoneKHR. 600e5c31af7Sopenharmony_ci 601e5c31af7Sopenharmony_ciNo further processing of a ray query occurs after this result is determined. 602e5c31af7Sopenharmony_ciendif::VK_KHR_ray_query[] 603