Weiler, Kraus, and Ertl [98] developed another method for performing cell projection completely within a graphics card that deviates significantly from the projected tetrahedra method. They call their algorithm view independent cell projection because, unlike projected tetrahedra, the process does not change with the viewing position.
When rasterizing a projected cell, any cell projection algorithm must calculate two intersections per pixel: the entry and exit points of the viewing ray. Finding one of these two intersections on graphics hardware is trivial: simply rasterize the polygon face. Doing this gives either the entry point (if it is a front-facing polygon) or the exit point (if it is a back-facing polygon).
Weiler, Kraus, and Ertl's algorithm proceeds by using the graphics hardware rasterizer to find all the viewing ray entry points. They find all the entry points by drawing the front faces of the tetrahedra. They then use the fragment processor to determine the exit point for each viewing ray. They do not need to rasterize the back faces, so the algorithm culls these faces.3
|
To find the exit point, Weiler, Kraus, and Ertl intersect the viewing ray with each plane containing a face. Unless a face is parallel to the viewing ray, every plane will intersect this viewing ray. However, as demonstrated in Figure 1.6, the intersection of the ray and any plane containing a face not intersected by the ray will occur either before the entry point or after the exit point [34]. Therefore, the true exit point is the one closest to the entry point that is not before the entry.
Finding the intersection of a plane and a ray is easy. Consider the implicit equation for a plane:
We can find the intersection by plugging
Equation 1.1 into
Equation 1.2 and solving for the only unknown,
.
Once they determine the back intersection point, Weiler, Kraus, and Ertl
still need to know the scalar value at the back intersection point.
Assuming that the gradient,
, of the scalar is
constant (and known), the scalar value at the back is
Given scalar values at the vertices of the tetrahedron, there exists a unique, consistent, and constant gradient. We can find this gradient by establishing a system of equations applying Equation 1.4 to all the edges connected to one vertex.
At the time Weiler, Kraus, and Ertl were developing their algorithm, the fragment processor of commodity graphics cards was not powerful enough to perform the ray-plane intersections, scalar determination, and ray integration.4 However, they observe that the distance from a face to a plane and the scalar value on the opposite plane varied linearly across a face of a tetrahedron. As such, they can compute the ray-plane intersections and scalar values at the vertices in a vertex program. They then store the depths and scalars in triples as texture coordinates that the rasterizer linearly interpolates.
|
Weiler, Kraus, and Ertl note another advantage of performing ray-plane intersections at cell vertices. At each vertex, the algorithm performs three intersection calculations. However, as demonstrated in Figure 1.7, each vertex belongs to two of the three faces with which they perform intersection calculations. Because the vertex is part of these planes, the intersection at these planes is at the vertex. Thus, the algorithm does not need to solve the intersection with these planes explicitly.