i
i
i
i
i
i
i
i
714 28. Spatial-Field Visualization
Figure 28.8. Various coordinate systems used for interpolation and intersection.
Note that
1 u =
x
1
x
x
1
x
0
, (28.4)
1 v =
y
1
y
y
1
y
0
,
1 w =
z
1
z
z
1
z
0
.
If we redene u
0
=1 u and u
1
= u, and use similar denitions for
v
0
,v
1
,w
0
,w
1
, then we get (Figure 28.8)
ρ =
i,j,k=0,1
u
i
v
j
w
k
ρ
ijk
.
It is interesting that the true trilinear isosurface can be fairly complex. The case
where two opposite corners of the cube are on opposite sides of the isovalue from
the other six vertices is shown in Figure 28.9. This is quite different from the two
triangles given by polygonal isosurfacing for that case. One advantage of direct
intersection with the trilinear surface is that ambiguous cases do not arise.
For a given point (x, y, z) in the cell, the surface normal is given by the gra-
dient with respect to (x, y, z):
N =
ρ =
∂ρ
∂x
,
∂ρ
∂y
,
∂ρ
∂z
.
Thus, the normal vector of (N
x
,N
Y
,N
z
)=
ρ is
Figure 28.9. A true tri-
linear isosurface generated
using direct ray tracing.
N
x
=
i,j,k=0,1
(1)
i+1
v
j
w
k
x
1
x
0
ρ
ijk
,
N
y
=
i,j,k=0,1
(1)
j+1
u
i
w
k
y
1
y
0
ρ
ijk
,
i
i
i
i
i
i
i
i
28.2. 3D Scalar Fields 715
N
z
=
i,j,k=0,1
(1)
k+1
u
i
v
j
z
1
z
0
ρ
ijk
.
Given a ray p = a + tb, the intersection with the isosurface occurs when
ρ(p)=ρ
iso
. We can convert this ray into coordinates dened by (u
0
,v
0
,w
0
):
p
0
= a
0
+ tb
0
and a second ray dened by p
1
= a
1
+ tb
1
. Here the rays are in
the two coordinate systems (Figure 28.8):
a
0
=(u
a
0
,v
a
0
,w
a
0
)=
x
1
x
a
x
1
x
0
,
y
1
y
a
y
1
y
0
,
z
1
z
a
z
1
z
0
,
and
b
0
=(u
b
0
,v
b
0
,w
b
0
)=
x
b
x
1
x
0
,
y
b
y
1
y
0
,
z
b
z
1
z
0
.
These equations are different because a
0
is a location and b
0
is a direction. The
equations are similar for a
1
and b
1
:
a
1
=(u
a
1
,v
a
1
,w
a
1
)=
x
a
x
0
x
1
x
0
,
y
a
y
0
y
1
y
0
,
z
a
z
0
z
1
z
0
,
and
b
1
=(u
b
1
,v
b
1
,w
b
1
)=
x
b
x
1
x
0
,
y
b
y
1
y
0
,
z
b
z
1
z
0
.
Note that t is the same for all three rays; it can be found by traversing the cells and
doing a brute-force algebraic solution for t. The intersection with the isosurface
ρ(p)=ρ
iso
occurs when
ρ
iso
=
i,j,k=0,1
u
a
i
+ tu
b
i

v
a
j
+ tv
b
j

w
a
k
+ tw
b
k
ρ
ijk
.
This can be simplied to a cubic polynomial in t:
At
3
+ Bt
2
+ Ct + D =0,
where
A =
i,j,k=0,1
u
b
i
v
b
j
w
b
k
ρ
ijk
,
B =
i,j,k=0,1
u
a
i
v
b
j
w
b
k
+ u
b
i
v
a
j
w
b
k
+ u
b
i
v
b
j
w
a
k
ρ
ijk
,
C =
i,j,k=0,1
u
b
i
v
a
j
w
a
k
+ u
a
i
v
b
j
w
a
k
+ u
a
i
v
a
j
w
b
k
ρ
ijk
,
D = ρ
iso
+
i,j,k=0,1
u
a
i
v
a
j
w
a
k
ρ
ijk
.
i
i
i
i
i
i
i
i
716 28. Spatial-Field Visualization
The solution to a cubic polynomial is discussed in Cubic and Quartic Roots
(Schwarze, 1990). His code is available on the web in several Graphics Gems
archive sites. Two modications are needed to use it: linear solutions (his code
assumes A is non-zero), and the EQN
EPS parameter is set to 1.0e-30, which
provided for maximum stability for large coefcients.
28.2.2 Direct Volume Rendering
Another way to create a picture of a 3D scalar eld is to do a 3D random density
plot using small opaque spheres. To avoid complications, the spheres can be made
a constant color and, in effect, they are light emitters with no reectance. Such
a random density plot can be implemented directly using ray tracing and small
spheres, or with 3D points using a traditional graphics API. As in 2D, we can
take the limit as the sphere size goes to zero. This yields a 3D analog of the
pseudocolor display and is usually called direct volume rendering (Levoy, 1988;
Drebin et al., 1988; Sabella, 1988; Upson & Keeler, 1988).
There are two parameters that affect the appearance of a volume rendering:
sphere color, and sphere density. These are controlled by a user-specied transfer
function:
color = c(ρ),
number density = d(ρ).
Here the number density is the number of spheres per unit volume. If we assume
that the spheres have a small cross-sectional area a, and we consider a region
along the line of sight that is of a small thickness Δs such that no spheres appear
to overlap (Figure 28.10), then the color is
Figure 28.10. Athinslab
filled with opaque spheres.
L(s s)=(1 F )L(s)+Fc,
where F is the fraction of the disk that is covered by spheres as seen from the
viewing direction. Because the disk is very thin, we can ignore spheres visually
overlapping, so this fraction is just the total cross-sectional area of the spheres
divided by the area A of the disk:
F =
daA Δs
A
= daΔs,
which yields
L(s s)=(1da Δs)L(s)+daΔsc.
i
i
i
i
i
i
i
i
28.2. 3D Scalar Fields 717
Figure 28.11. For direct volume rendering, we can take constant size steps along the ray
and numerically integrate.
We can rearrange terms to give something like a denition of the derivative:
L(s s) L(s)
Δs
= daL(s)+dac.
If we take the limit Δs 0, we get a differential equation:
dL
ds
= daL(s)+dac.
For constant d and c this equation has the solution
L(s)=L(0)e
das
+ c
1 e
das
.
This would allow us to analytically compute color for constant density/color re-
gions. However, in practice both d and c vary along the ray, and there is no
analytic solution to the differential equation. So, in practice, we use a numer-
ical technique. A simple way to proceed is to start at the back of the ray and
incrementally step along the ray as shown in Figure 28.11.
We can apply the original equation for each Δs slice:
L(s s)=(1d(x, y, z)a Δs)L(s)+d(x, y, z)a Δsc(x, y, z).
In pseudocode, we initialize the color to the background color c
b
and then traverse
the volume from back to front:
i
i
i
i
i
i
i
i
718 28. Spatial-Field Visualization
Figure 28.12. A maximum-intensity projection of the NIH/NIM Visible Female dataset. Each
pixel contains a grayscale value that corresponds to the maximum density encountered along
that ray.
Image courtesy Steve Parker.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.179.121