Graphics Reference
In-Depth Information
2.2.2 Collision Versus Rendering Geometry
Although it is possible to pass rendering geometry directly into a collision system,
there are several reasons it is better to have separate geometry with which collision
detection is performed.
1. Graphics platforms have advanced to the point where rendering geometry is
becoming too complex to be used to perform collision detection or physics. In
addition, there is a usually a limit as to how accurate collisions must be. Thus, rather
than using the same geometry used for rendering, a simplified proxy geometry can
be substituted in its place for collision detection. For games, for example, it is com-
mon to rely on simple geometric shapes such as spheres and boxes to represent the
game object, regardless of object complexity. If the proxy objects collide, the actual
objects are assumed to collide as well. These simple geometric shapes, or bound-
ing volumes , are frequently used to accelerate collision queries regardless of what
geometry representation is used. Bounding volumes are typically made to encap-
sulate the geometry fully. Bounding volumes are discussed in detail in Chapter 4.
2. For modern hardware, geometry tends to be given in very specific formats (such as
triangle strips and indexed vertex buffers), which lend themselves to fast rendering
but not to collision detection. Rather than decoding these structures on the fly
(even though the decoded data can be cached for reuse), it is usually more efficient
to provide special collision geometry. In addition, graphics hardware often enforces
triangle-only formats. For collision geometry, efficiency sometimes can be had by
supporting other, nontriangle, primitives.
3. The required data and data organization of rendering geometry and collision
geometry are likely to vary drastically. Whereas static rendering data might be
sorted by material, collision data are generally organized spatially. Rendering
geometry requires embedded data such as material information, vertex colors,
and texture coordinates, whereas collision geometry needs associated surface
properties. Separating the two and keeping all collision-relevant information
together makes the collision data smaller. Smaller data, in turn, leads to efficiency
improvements due to better data cache coherency.
4. Sometimes the collision geometry differs from the rendered geometry by design.
For example, the knee-deep powder snow in a snowboarding game can be mod-
eled by a collision surface two feet below the rendered representation of the snow
surface. Walking in ankle-deep swaying grass or wading in waist-deep murky
water can be handled similarly. Even if rendering geometry is used as collision
geometry, there must be provisions for excluding some rendering geometry from
(and for including additional nonrendering geometry in) the collision geometry
data set.
5. For simulation purposes, collision data must be kept around even when rendering
data can be thrown out as not visible. With the collision geometry being smaller
Search WWH ::




Custom Search