Graphics Reference
In-Depth Information
clipping) and by picking a view direction to maximize on-screen projection. As will
be discussed further on, image-spaced-based techniques also have problems with
polygons edge-on to the viewer (in that these are not rasterized).
By carefully arranging data into textures, it is also possible to perform general-
purpose computations on a GPU through programmable pixel shaders (or even
through blending operations). For example, a static triangle mesh can be repre-
sented by a number of textures, encoding the component values of the vertices and
(implicitly) the vertex-face connectivity. With an appropriate pixel shader program
it is then possible to perform a ray intersection test against all encoded triangles in
parallel. Using GPUs for general-purpose calculations is a new, highly active, area of
research at present. For example, [Carr02] and [Purcell02] describe efforts aimed at
accelerating ray-triangle intersection tests in the domain of ray tracing using GPUs.
This chapter looks at how image-spaced-based collision detection techniques can
be used to determine the intersection between both convex and concave objects.
An image-space collision-filtering algorithm is also described. Because the area of
GPU-accelerated mathematics and geometry calculations is still young, it is not
yet clear how useful or practical such techniques are for collision detection prob-
lems in general. Therefore, GPU-supported acceleration of calculations is not further
explored here.
10.1 Interfacing with the GPU
Using GPUs as computation devices — a task they were not quite designed for —
means that there are some practical issues to resolve. On the GPU input side, this
means that data must be packeted in terms of vertex streams or as textures. Such
packeting requires some care but is largely straightforward. The larger problem is
that of moving results, computed on the GPU, back to main memory. On most
current systems, reading data back from the GPU incurs a large performance penalty,
in part caused by stalls and lost parallelism due to the readback. In some cases, buffer
readbacks are unavoidable, but often algorithms can be structured to avoid these
through the use of hardware-supported occlusion queries . Even when buffer readbacks
are necessary, it is often possible through careful design to limit the amount of data
read back. The next two sections discuss buffer readbacks in more detail, elaborating
on how they can be reduced and even fully avoided.
10.1.1 Buffer Readbacks
Several algorithms have been proposed that in some fashion rely on reading back
image buffers to main memory and analyzing their content to determine collisions
(including [Boyles99] and [Dinerstein02]). For example, in OpenGL rectangular
areas of a buffer can be read back using glReadPixels() , from the buffer specified
Search WWH ::




Custom Search