In Section 1.3.5, I solve the volume rendering integral for linearly varying luminance and attenuation. I parameterize the integral with the front and back values of the luminance and attenuation, as shown in the following two equations.
The solution to the volume rendering integral using the linear terms
demonstrated in Equations 1.17 and
1.18 is complicated. If we wish to
compute the volume rendering integral using only finite, real values, we
need at least three forms of the solution. The first form has real and
finite terms when
.
Computing Equations 1.19 through
1.21 is not straightforward. First is the
problem of computing the functions
and
with high numerical
accuracy. Second is the problem where the value in the brackets can become
quite small while the value it multiplies with becomes exceptionally large,
which leads to numerical instability. Williams, Max, and Stein
[105] solve these problems, and I review their solutions
here.
We first consider Equation 1.19. In
particular, consider the last term. For convenience, let us use the
groupings
and
.
The third term of Equation 1.19 becomes
To compute the
functions, Williams uses an approximation given by
Press and colleagues [75]. (Press actually gives his
approximation for the
complementary
error function, defined as
, but the conversion is
trivial.) Press demonstrates approximating
as
Substituting Equation 1.23 into Equation 1.22, we get more flexibility.
![]() |
We next consider Equation 1.20. I
rewrite the last term using the groupings
and
.
Rather than compute
directly, Williams instead computes
Dawson's integral, defined as
. Dawson's integral relates to
as
. Rybicki
[82] gives a good numerical method for computing Dawson's
integral. Press and colleagues [76] also summarize
the method.
Substituting
into
Equation 1.26, we again get more
flexibility.
![]() |
Equation 1.21 contains no form of the error
function and is numerically stable enough to compute directly with the
exception of when the quantity
approaches zero. However,
it is straightforward to show that
.
Therefore, this is just a simple special case.
So, in summary of Williams and colleagues' work [105], we can accurately compute the volume rendering integral with linearly interpolated attenuation and luminance with the following equation.
The listing for a fragment program that calculates Equation 1.28 resides in Appendix 1.3.