i
i
i
i
i
i
i
i
824 17. Collision Detection
More sophisticated collision response is based on physics, and involves
creating a system of equations that is solved using an ordinary differen-
tial equation (ODE) solver. In such algorithms, a point of collision and
a normal at this point is needed. The interested reader should consult
the SIGGRAPH course notes by Witkin et al. [1363] and the paper by
Dingliana et al. [258]. Also, O’Sullivan and Dingliana present experiments
that show that it is hard for a human to judge whether a collision response
is correct [977, 978]. This is especially true when more dimensions are
involved (i.e., it is easier in one dimension than in three). To produce a
real-time algorithm, they found that when there was not time enough to
compute an accurate response, a random collision response could be used.
These were found to be as believable as more accurate responses.
17.6.5 GPU-Based Collision Detection
It has been long known that rasterization can be used detect collisions
[1168]. The major difference between what has been described so far in
this chapter is that algorithms based on GPUs are often performed in
image space. This is in contrast to the techniques operating directly on the
geometry.
There is a wealth of algorithms for performing CD on the GPU, and
here we will present only one of the algorithms, called CULLIDE [436]. The
basic idea is to use occlusion queries (see Section 14.6.1) to perform a test
that determines whether an object, O, is “fully visible” (i.e., not colliding
with) another set of objects, S. Recall that an occlusion query is usually
used with a less-or-equal depth test. The occlusion query can count the
number of fragments that pass the depth test, and if no fragments pass,
then we can be certain that the rendered object (or its bounding box) is
occluded with respect to the contents of the depth buffer.
For collision detection, we are instead interested in finding objects that
definitely do not overlap with other objects. Govindaraju et al. suggest
that this is done by reversing the depth test, so that we use greater-or-
equal, and writing to the depth buffer is turned off. If both the front and
the back faces of an object are rendered, and no fragment pass the depth
test, we can conclude that the object is fully visible with respect to the
depth buffer. In this way, we test for overlap in the depth direction, and
in the image plane.
Next, we describe how this test can be used to implement a broad-phase
collision detection algorithm on the GPU. Assume there are n objects, de-
noted O
i
,1≤ i ≤ n.ThatO
i
does not collide with any other object simply
means that it does not collide with any of the objects, O
1
,...,O
i−1
,nor
with any of O
i+1
,...,O
n
. This can be formulated as an efficient rendering
algorithm. In a first pass, the objects are rendered in order, and we test