next up previous contents index
Next: Piecewise Integration Up: Properties of the Volume Previous: Glow Parameter   Contents   Index


Opacity and Blending

Direct volume rendering by its very nature deals with transparent objects. As such, it is important to understand how to mix a transparent volume with other objects within a scene. We refer to the process of mixing two overlaid images together as image blending or image compositing.

Porter and Duff [74] in a seminal paper introduce an algebra for image blending; this algebra is still the foundation of compositing in computer graphics today. Therefore, it is important to understand how the volume rendering integral relates to the Porter and Duff algebra to perform blending appropriately.

In brief, Porter and Duff introduce the $ \alpha $ blending term (the A part of a standard OpenGL RGBA pixel color), which gives the fraction of a pixel that is covered and will occlude whatever is ``behind'' the pixel. Another name for the fraction of a pixel covered is the opacity. The opacity fits well with the model defined in Section 1.1 with minute particles that occlude light from behind them. Although I show the derivation for the output light intensity from a volume, I do not give the opacity for the volume there. I derive the opacity for the volume here.

Consider the same thin cylinder surrounding the viewing ray shown in Figure 1.2 on page [*]. As is shown in the derivation starting on page [*], the fraction of a cross sectional disk of small length $ \Delta s$ occluded by particles is $ \tau \Delta s$. Therefore, we can express the transient change in opacity of the cylinder as

$\displaystyle \frac{d\alpha}{ds} = \tau (s) - \alpha(s) \tau (s)$ (6)

That is, the opacity increases by the fraction occluded in the new disk (the first term) that is not already occluded by the cylinder behind it (the second term).

We can solve this differential equation with the same approach used in the derivation of Section 1.1.

$\displaystyle \frac{d\alpha}{ds}$ $\displaystyle = \tau (s) - \alpha(s) \tau (s)$    
$\displaystyle \frac{d\alpha}{ds} + \alpha(s) \tau (s)$ $\displaystyle = \tau (s)$    
$\displaystyle { \frac{d\alpha}{ds} e^{\int_0^s \tau (t) dt} + \alpha(s) \tau (s) e^{\int_0^s \tau (t) dt} }$ $\displaystyle { = \tau (s) e^{\int_0^s \tau (t) dt} }$    
$\displaystyle { \frac{d}{ds}\left(\alpha(s)\right) e^{\int_0^s \tau (t) dt} + \alpha(s) \frac{d}{ds}\left(e^{\int_0^s \tau (t) dt}\right) }$ $\displaystyle { = \tau (s) e^{\int_0^s \tau (t) dt} }$    
$\displaystyle { \frac{d}{ds}\left(\alpha(s) e^{\int_0^s \tau (t) dt}\right) }$ $\displaystyle { = \tau (s) e^{\int_0^s \tau (t) dt} }$    

At this point, we can integrate both sides of the equation from $ s = 0$ to $ s = D$.

$\displaystyle { \alpha(D) e^{\int_0^D \tau (t) dt} - \alpha_0 = \int_0^D \tau (s) e^{\int_0^s \tau (t) dt} ds } \\ $    

Because we are interested solely in the opacity of the ray segment within the volume and not that behind it, we can assume that $ \alpha_0 = 0$ and drop it from the equation. Solving the rest of the equation, we find that

$\displaystyle \alpha(D) = 1 - e^{\int_0^D \tau (t) dt}$ (7)

Although this derivation relies on using $ \alpha $ as the function that is the opacity for a given length through the volume, in practice we are interested only in the opacity of the entire segment. It is therefore often convenient to drop the functional notation and simply refer to the opacity of a given segment as $ \alpha $.

Now that we have formally defined the $ \alpha $ term, we can plug it into the volume rendering integral (Equation 1.2 on page [*]).

$\displaystyle { I(D) = I_0 (1 - \alpha) + { \int_0^D L(s)\tau (s) e^{-\int_s^D \tau (t) dt} ds } }$ (8)

If we let $ \int_0^D L(s)\tau (s) e^{-\int_s^D
\tau (t) dt} ds$ be color $ A$, $ \alpha $ be opacity $ A$, and $ I_0$ be color $ B$, then we find that Equation 1.8 is really the Porter and Duff $ A \operatorname{over} B$ operation or, equivocally, the $ B \operatorname{under} A$ operation, which means we can easily use graphics hardware to do this blending.


next up previous contents index
Next: Piecewise Integration Up: Properties of the Volume Previous: Glow Parameter   Contents   Index
Kenneth D Moreland 2004-07-16