When performing ray casting, we implicitly know the order in which a ray intersects cells. However, when performing cell projection using any of the previously discussed algorithms, we must first determine the visibility order so that we can project the cells in the proper order.
Formally, the visibility-sorting problem is that of finding a
relationship among cells for a given viewpoint. We define the
relationship
such that if any part of cell
occludes any part
of cell
, then
. We require our visibility-sorting
algorithm to build an array
such that
. There is no guarantee
that such an array will exist.
Figure 1.8 demonstrates how as little
as three convex cells can be mutually occluding. We call this mutual
occlusion a visibility cycle.
When faced with a visibility cycle, a visibility-sorting algorithm has only two choices. The first choice is the ostrich algorithm: ignore the problem and hope that visibility cycles either do not happen or do not make noticeable visual artifacts. The second choice is to split cells so that the cycle is broken.
Newell, Newell, and Sancha [70] developed a direct
algorithm for performing visibility sorting of polygons in the early
1970's. Their algorithm relies on a routine that determined whether a cell
occluded a cell
. To speed up this operation, Newell, Newell,
and Sancha use a sequence of operations increasing in accuracy and
complexity to determine the truth of the relationship. Because the
relationship is not transitive, we cannot use this operation as the
comparator in a standard
sorting algorithm. Instead, Newell,
Newell, and Sancha order the cells based on their distance from the
viewpoint and then compare only pairs of cells whose depth ranges overlap.
In principle, this could lead to
algorithmic behavior, but in
practice, far fewer comparisons are performed. Stein, Becker, and Max
[92] extend the comparison operation to work with
polyhedra.5
Other methods of sorting polygonal cells do not extend to polyhedrons.
The
binary space partitioning
(BSP) trees algorithm [29,30] uses cutting
planes to divide space into a binary tree that the algorithm can quickly
walk to determine a visibility order. However, when applied to meshed
polyhedra, the number of cells can grow quadratically [72].
deBerg, Overmars, and Schwartzkopf [15,16] present a
quicksort-like algorithm that used the transitive closure of
as a
comparison operator. However, their method of determining if a pair of
cells exists in this transitive closure does not extend to polyhedra.
Williams [103] presents the well-known Meshed Polyhedra Visibility Ordering (MPVO) algorithm.6 Williams' MPVO algorithm requires several restrictions on the mesh. First, the mesh has to be fully connected. A connected mesh is in one piece. More formally, you cannot partition the cells of a connected mesh into two sets such that the partitions share no faces. Second, the mesh has to be convex. A convex mesh contains all the faces of the convex hull of its vertices. A convex hull of a set of points (in Euclidean three space) is the smallest polyhedron containing all the points. Third, the mesh must have no holes, meaning the mesh cannot enclose any empty regions. These restrictions ultimately mean that a ray exiting the mesh cannot reenter the mesh.
|
The MPVO algorithm first preprocesses the mesh by building a connectivity graph. The connectivity graph represents each cell with a node and each shared face with an edge. Given a viewpoint for visibility sorting, the MPVO algorithm gives directionality to each edge based on which side of the associated face is facing the viewpoint. The cell on the front face occludes the cell at the back face. Assuming no visibility cycles are present, adding edge directionality results in a directed acyclic graph (DAG). The DAG thus reduces sorting to walking the tree.
The biggest problem with MPVO is its reliance on connected, convex meshes, a requirement seldom enforced in unstructured grids. To deal with nonconvex meshes, Williams [103] proposes also an extension to MPVO called MPVONC. The MPVONC extension provides several heuristics for choosing a total ordering from the partial ordering of the DAG that is likely to be correct for occlusions outside of the DAG. However, there is no guarantee that these heuristics will be correct. Williams [103] suggests also filling concavities and holes with dummy cells used for the sorting but not for the drawing.
Silva, Mitchell, and Williams [90] extend the MPVO algorithm with the XMPVO algorithm. XMPVO works exactly like MPVO except that at every viewpoint a sweep plane algorithm determines any occlusions caused by rays exiting and then reentering the mesh. XMPVO adds these occlusions as edges to the DAG. Comba and colleagues [11] again improve the algorithm with BSP-XMPVO. BSP-XMPVO is just like its predecessor except that it uses a BSP tree to determine occlusions instead of a sweep plane. The BSP tree requires more preprocessing and more memory, but is ultimately faster to compute per viewpoint change than the sweep plane algorithm.
For the special case of Delaunay triangulations, Max, Hanrahan, and Crawfis [64] give a simple method for visibility sorting. A Delaunay triangulation (in 3D) is one that has the property that the circumsphere of the vertices of each tetrahedron contains no other vertices [17].
Let the power distance of a point with
respect to a sphere be
, where
is the distance between the
point and the sphere's center, and
is the radius of the sphere. Max,
Hanrahan, and Crawfis show that the sorting of the power distances between
the viewpoint and the circumspheres of the tetrahedra in a Delaunay
triangulation is equivalent to the visibility sorting of the tetrahedra.
However, the method is valid only for proper Delaunay triangulations and is
sensitive to degenerate cases. Cignoni and De Floriani
[9] provide an algorithm to create valid sets of spheres
for general meshes, but their algorithm is complex and not guaranteed to
work for all meshes.
Algorithms exist for detecting and projecting visibility cycles. Snyder and Lengyel [91] extend the Newell, Newell, and Sancha algorithm to detect cycles. Kraus and Ertl [52] extend MPVO to detect cycles, making MPVOC. Both algorithms use an image based approach to project cells with a visibility cycle correctly rather than split the cells geometrically.
Ideally, graphics hardware would employ an image-based ordering solution
much like the z-buffer algorithm for
opaque surfaces [8]. However, the z-buffer algorithm gives
only the closest surface where volume rendering requires the ordering of
every cell projected on a pixel. Carpenter [7]
proposes the A-buffer. The A-buffer maintains a
linked list of depth sorted fragments at every pixel. However, such data
structures are difficult and slow to implement on graphics hardware. Given
enough oversampling of the image, one could implement
screen door transparency, which
renders pixels opaque but writes only some of the pixels based on the
opacity [28,69]. Jouppi and Chang [39]
propose an improved screen door transparency called
. However, Jouppi and Chang demonstrate
accuracy to depth complexities of only 16, which is nowhere near deep
enough for volume rendering. Wittenbrink [107]
proposes the R-buffer, which serves the same
function as the A-buffer but stores fragments in a single array rather than
a collection of linked lists. Although more practical than the A-buffer,
it still has yet to be implemented in graphics hardware. Furthermore, a
1000 by 1000 pixel volume rendering with a modest average depth complexity
of 100 requires over 600 megabytes of storage.