next up previous contents
Next: Optimized Preprocessing for Contour Up: Interactive Rendering Previous: Discussion   Contents


Extended shading models

As already mentioned before, various shading models can be applied at interactive frame rates to render the RenderList-based volume representation, if a quantized representation of the gradient is stored as an attribute with every voxel. Gradients which are usually given using 3 float (=96 bit), or at least byte coordinates (=24 bit), are first quantized to 12-16 bit to obtain a compact representation. As the number of distinct gradient directions is rather low after quantization, a good distribution of the quantized directions over the unit sphere is necessary.

If parallel projection is performed, and only directional light sources (located at infinity) are used, the evaluation of common lighting models like Phong shading does not depend on the position of the voxel, but only on the gradient vector, viewing direction, and light direction. For shading models where this assumptions hold, the quantized gradients can be used as indices to access an array of precomputed shading values during rendering (figure 4.20). The table has only to be recomputed, if one of the influencing factors (light or viewing direction) changes. A gradient dictionary table is used to store non-quantized representations of each possible quantized gradient (required for the computation of table content). To update the table, the specific lighting equation is evaluated for each gradient vector in the gradient dictionary and the result is stored into the corresponding entry of the look-up table. The value stored in the look-up table is the shaded voxel color. A more flexible approach, based on storing an intensity value instead, which can be used to modulate the color of voxels is described in chapter 6.

Figure 4.20: Shading look-up table creation (a) and application (b)
\includegraphics[width=.8\linewidth]{Figures/gradients.eps}

The limited number of evaluations required to update the look-up table, allows to apply even complex shading models without impact on the interactivity. The simplest model used is the Phong shading model, with the intensity $I_p$ depending on gradient direction, viewing direction and light source position

\begin{displaymath}
I_p(P,V,L)=I_a+I_d G(P)\cdot L +I_s (R\cdot V)^n
\end{displaymath}

with $G(P)=\nabla d\vert _P$ being the gradient at voxel $P$, L being the directional vector of the light and $V$ the viewing direction. $R$ is the main reflection direction

\begin{displaymath}
R=2(G(P)\cdot L)G(P)-L
\end{displaymath}

$I_a$, $I_d$, and $I_s$ are the coefficients for ambient light, diffuse, and specular reflection, respectively, $n$ controls the sharpness of the specular highlight. Due to the quantization of the gradient vector directions, $n$ should be rather low to prevent visible artefacts of a very narrow highlight - values of 4-8 provide good results (figure 4.21a, b).

The look-up table based shading also allows to implement various non-photorealistic shading methods, for example, contour enhancement [11,10]. The model assigns high intensity (and opacity) values to voxels with gradients most perpendicular to the viewing direction. Lower values are assigned to voxels with gradient vectors facing towards or away from the viewer:

\begin{displaymath}
I_c(P,V) = g(\vert G(P)\vert) \cdot (1 - \vert G(P) \cdot V\vert)^n
\end{displaymath}

$g()$ modulates the intensity depending on gradient magnitude to provide higher values for voxels in regions of high gradient magnitude, which are usually parts of a surface. The exponent $n$ controls the sharpness of the contour, and should (due to the quantization of the gradients) not exceed 8. The result of this shading technique can be seen in figures 4.21e and f.

As the application of the pure contour enhancement method provides only a sketch-like representation of the objects, without much information on shape details, both approaches, Phong and contour enhancement, can be combined to obtain a color $C$ which depends on both models:

\begin{displaymath}
C = C_cI_c+C_pI_p(1-I_c)
\end{displaymath}

$C_c$ is the color to be used for the display of contours, $C_p$ is the color to be used for Phong shading. $I_c$ and $I_p$ are intensities obtained from the above lighting equations. The overall color is a weighted sum of the contour and the Phong color. Voxels located at object contours are rendered using the contour color only, voxels facing to the viewer are rendered with Phong shading only. If the contour color is set to black, this results in a darkening of object contours, which allows to distinguish internal edges of an object more easily (figure 4.21c, in comparison to pure Phong shading in figure 4.21a). Choosing white as contour color, brightens the contours, which is especially useful if the object is rendered semi-transparently (figure 4.21d, in comparison to pure Phong shading in figure 4.21b).

Figure 4.21: Different lighting models applied to a scan of human vertebrae
\includegraphics[width=.48\linewidth]{Figures/phong.ps} \includegraphics[width=.48\linewidth]{Figures/phong-transparent.ps}
a) Phong shading b) Phong, semi-transparent
\includegraphics[width=.48\linewidth]{Figures/phongnpvr.ps} \includegraphics[width=.48\linewidth]{Figures/phongnpvr-transparent.ps}
c) Phong, darkened contours d) Phong, lightened contours
\includegraphics[width=.48\linewidth]{Figures/npvr.ps} \includegraphics[width=.48\linewidth]{Figures/npvr-transparent.ps}
e) contour enhancement f) contours only



Subsections
next up previous contents
Next: Optimized Preprocessing for Contour Up: Interactive Rendering Previous: Discussion   Contents
Lukas Mroz, May 2001,
mailto:mroz@cg.tuwien.ac.at.