Game Development Reference
In-Depth Information
Figure 8.4. A 2D example of a brush, a volume bounded by geometric planes.
8.2.3 Brushes
As mentioned in Section 8.2, our implementation uses brushes, or convex polytopes,
as the primitive building blocks for the CSG tree. A brush is defined as the volume
boundedbyasetofgeometricplanes,asillustratedin Figure8.4 . Wefirstdescribe
how to create the geometry of a brush from a set of geometric planes, after which
we describe how to categorize the polygons of one brush against another brush.
Creating a mesh from a brush. There are several ways to calculate the mesh
surface of a brush. One popular method works by projecting a quad, that is axis-
aligned with the most major axis of the plane's normal, on each of the brush planes
and clipping it by all the remaining planes of the brush. This method is simple to
implement and is reasonably fast even for brushes with a large number of planes.
It does, however, have some drawbacks in practice:
It is necessary to choose a maximum size for the initial polygon quad and to
ensure that no brush exceeds that size. Otherwise, the brush mesh can contain
holes. Unfortunately, the larger the maximum size is, the less accurate the
intersections will be, as the accuracy of floating-point numbers decreases as
the numbers get bigger.
The vertices generated by splitting each quad need to be merged to calculate
adjacency information.
Due to floating-point imprecision, there will be a difference between what
should logically be the same vertex on different polygons. Increasing the size
of the original quad increases this disparity.
Another method of calculating the brush mesh is to first find all valid intersec-
tions between the planes of the brush and then to solve the relationship between
these points analytically. With this method, floating-point inaccuracies are mini-
mized and have no effect on the validity of the structure of the brush itself. Although
 
Search WWH ::




Custom Search