Graphics Reference
In-Depth Information
Camera
data
1. Ray creation
...
vox m
vox5
vox4vox3
vox2
vox1
vox0
Grid
texture
...
2. Ray tracing
786
69
27
17
4
0
vox1
vox0
Triangle list
texture
...
3. Intersection test
45
3
1
21
3
0
...
tri m
tri3
tri2
tri1
tri0
Triangle
texture
...
xyz v0
v1
v2
xyz
xyz
xyz
xyz
...
...
xyz
xyz
xyz
xyz
xyz
xyz
xyz
xyz
xyz
xyz
Shading
data
4. Shading
Figure 2.15 Flow of the GPU ray tracing method proposed by Purcell et al. (After [Purcell et al. 02].)
That texel holds the index of the first texel in another texture map containing the
scene triangles arranged by grid cell. Each triangle is represented as an index into
a group of three RGB texture maps: the x -, y -, and z -coordinates of a triangle ver-
tex are stored in the red, green, and blue components of an RGB texel. There are
three texture maps; corresponding texels in these maps contain the three vertices
of each triangle. Another triad of texture maps stores the triangle vertex normals,
and the colors are stored in yet another texture map. This configuration makes it
possible to perform the intersection tests and shading computations entirely with
texture map operations.
By defining all the data in textures it is possible to formulate the process in
terms of input and output streams. The kernel can access each pixel from the
input texture (stream) and store the result in the output texture (stream). The
algorithm starts by creating a screen-sized rectangle texture map used to store the
rays from the viewpoint (Step 1) with each pixel corresponding to a ray. Step 2 is
the process of traversing the grid. This requires multiple passes, as each ray must
pass through only one cell at a time. At each cell, the ray/cell pair is streamed
through the intersection test kernel (Step 3), which tests for intersection with each
triangle in the triangle list texture. If there is a hit, it is passed to the shader
(Step 4). The current state of each ray is recorded in the stencil buffer.
Whitted-style ray tracing is recursive, but in 2002 graphics hardware was not;
in fact, nested loops were not even available then. Purcell's algorithm works
Search WWH ::




Custom Search