next up previous contents index
Next: Visibility Sorting Up: Cell Projection Previous: GPU Accelerated Projected Tetrahedra   Contents   Index


View Independent Cell Projection

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

Figure 1.6: 2D example of the intersection of viewing rays with the planes of cell faces. If a ray does not intersect a cell face, then it intersects the plane containing that face either before the entrance (shown on the left) or after the exit (shown on the right).
\includegraphics[bb=187 561 421 633,clip=true,width=\linewidth]{previous_work/face_plane_intersection}

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:

$\displaystyle \vec{n}\cdot\vec{x} + a = 0$ (19)

where $ \vec{n}$ is the normal to the plane. Finding the plane equation for a face is as simple as finding the face's normal and then plugging in a known point in the face (i.e. one of its vertices) into $ \vec{x}$ to find $ a$. For the ray, we use the parametric equation

$\displaystyle \vec{r} = \vec{v} + t\vec{d}$ (20)

where $ \vec{v}$ is a point on the ray and $ \vec{d}$ is a vector pointing in the direction of the ray. If $ \vec{v}$ is the entry point of the ray into the tetrahedron (which front-face rasterization gives) and $ \vec{d}$ is the normalized viewing ray, then $ t$ is the distance between the entry point and the intersection of the plane. Negative values for $ t$ mean the intersection occurs in front of the entry point.

We can find the intersection by plugging Equation 1.1 into Equation 1.2 and solving for the only unknown, $ t$.

$\displaystyle \vec{n}\cdot\left(\vec{v} + t\vec{d}\right) + a$ $\displaystyle = 0$    
$\displaystyle \vec{n}\cdot\vec{v} + t\vec{n}\cdot\vec{d} + a$ $\displaystyle = 0$    
$\displaystyle t\vec{n}\cdot\vec{d}$ $\displaystyle = - \left(\vec{n}\cdot\vec{v} + a\right)$    
$\displaystyle t$ $\displaystyle = - \frac{\vec{n}\cdot\vec{v} + a}{\vec{n}\cdot\vec{d}}$ (21)

The actual exit intersection is that with the smallest value of $ t$ that is greater than zero.

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, $ \vec{g}$, of the scalar is constant (and known), the scalar value at the back is

$\displaystyle s_b = s_f + \left(\vec{d}\cdot\vec{g}\right)D$ (22)

where $ s_b$ and $ s_f$ are the values of the scalar at the front and back, respectively, of the ray, $ \vec{d}$ is again the normalized viewing ray, and $ D$ is the distance between the front and back intersections (equal to $ t$ in Equation 1.3).

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.

$\displaystyle s_1$ $\displaystyle = s_0 + \left(\vec{v_1}-\vec{v_0}\right)\cdot\vec{g}$    
$\displaystyle s_2$ $\displaystyle = s_0 + \left(\vec{v_2}-\vec{v_0}\right)\cdot\vec{g}$    
$\displaystyle s_3$ $\displaystyle = s_0 + \left(\vec{v_3}-\vec{v_0}\right)\cdot\vec{g}$    

We can change these equations into a more familiar matrix form.

$\displaystyle \begin{bmatrix}s_1 - s_0 \\ s_2 - s_0 \\ s_3 - s_0 \end{bmatrix} ...
...thrm{T} \\ \left(\vec{v_3}-\vec{v_0}\right)^\mathrm{T} \\ \end{bmatrix} \vec{g}$ (23)

We can solve Equation 1.5 with elementary linear algebra [2]. Note that the gradients do not change with the viewpoint, and they can therefore be determined offline.

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.

Figure 1.7: Ray-plane intersections at vertices. When rasterizing face $ f_0$, the distance to the planes of faces $ f_1$, $ f_2$, and $ f_3$ must be computed. However, note that, for example, vertex $ v_1$ touches $ f_2$ and $ f_3$. Thus, the distance to those faces is zero and the scalar for that intersection is that at $ v_1$.
\includegraphics[bb=159 558 316 682,clip=true,width=3in]{previous_work/vertex_ray_intersection}

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.


next up previous contents index
Next: Visibility Sorting Up: Cell Projection Previous: GPU Accelerated Projected Tetrahedra   Contents   Index
Kenneth D Moreland 2004-07-16