Graphics Reference
In-Depth Information
2.4.4 Multi-pass Tracing
To properly implement the multi-pass intersection testing scheme described in
Section 2.3, we need to store some additional information and take some addi-
tional precautions. First of all, we need to remember the ray grid cell in which
the expansion of each ray stopped in the previous pass of ray grid construction.
As we only ever continue ray expansion for rays that have not yet hit any geom-
etry in the previous passes, we can simply reuse some of the ray hit information
storage for that purpose. In each ray-marching pass we store the ray offset of the
last grid cell each ray was expanded to and continue expansion with that offset
in the next pass.
Active ray filtering. To keep track of which rays are still active and which rays may
be terminated, we check the distance attribute of their hit information record.
We use two special values to distinguish between rays that have already left the
scene bounds without any intersections and rays for which no intersection has
been found yet, but which are still in bounds. Recall that for atomic ray up-
date to work, our distance attribute is a signed integer. Therefore, we may use
MissedRayDepth = 0x7ffffffe and MaxRayDepth = 0x7fffffff , respectively. Be-
fore we continue expanding rays in subsequent ray grid construction passes, we
filter out all terminated rays and compact the indices of remaining active rays
into one consecutive array. This array is then processed by the ray marching
shader.
Hit point ordering. Finally, it is important to enforce strict front-to-back intersec-
tion testing. Just like in classic ray tracing where an acceleration data structure
is traversed in an ordered fashion, we may find intersection points that lie beyond
the cells that the ray has been expanded to in the current pass. In other words,
the intersection is found on a section of the ray that would only be tested in a
later pass.
This is especially likely for large triangles that span many ray grid cells, when
rays slowly converge toward the triangle plane and are inserted into several cells
that hold the triangle but not the actual point of intersection. If we accepted these
premature hit points, we would be prone to missing other in-between geometry
that lies only in cells beyond those the ray has thus far been expanded to. We
can remedy this problem by strictly accepting only those hit points that lie inside
the cell that caused their detection. Rejected points will then be re-detected in
the proper cells, possibly during a later pass. Thus, rays will not be terminated
prematurely.
2.4.5 Ray Generation
In our implementation, we demonstrate the tracing of incoherent secondary rays
with reflection rays. We simply generate these rays from the G-buffer created by
Search WWH ::




Custom Search