20 Apr. 2000
Volume Modeling & Rendering
• Some data is more naturally modeled as a volume, not a surface
• You could always convert the volume to a surface, but that’s not
• Volume rendering: render the volume directly
Ray-traced isosurface Same data, rendered
f(x,y,z)=c as a volume
Computer Graphics 15-462 2
Why Bother with Volume Rendering?
• Isn’t surface modeling & rendering easier?
• Show all your data
– more informative
– less misleading (the isosurface of noisy data is unpredictable)
• Constructive Solid Geometry (CSG) is natural
• Simpler and more efficient than converting a very complex data
volume (like the inside of someone’s head) to polygons and then
Computer Graphics 15-462 3
Surface Rendering Volume Rendering
• Surface rendering is the "usual" • Data consists of one or more
type of rendering. (supposedly continuous) fields in
• Data is converted to geometrical 3D.
primitives (e.g. triangles), which are • A Transfer Function maps the data
then drawn. into a volume of RGBA values.
• Everything you see is a 2D surface, • This volume is rendered directly,
embedded in a 3D space. like a blob of colored jello.
• The conversion to geometrical • Data is seen more directly; less
primitives may lose or disguise likely to be hidden.
some data. • Works well for complex surfaces.
• Good for opaque objects, objects
with smooth surface.
Computer Graphics 15-462 4
– Computed Tomography (CT)
– Magnetic Resonance Imaging (MRI)
• engineering & science
– Computational Fluid Dynamics (CFD) – aerodynamic simulations
– meteorology – weather prediction
– astrophysics – simulate galaxies
• Computer Graphics
– Participating media
Computer Graphics 15-462 5
Brief History of Volume Visualization
• 1970’s modeling & rendering with 3-D grids and octrees
• 1984 ray casting volume models
• 1986 3-D scan conversion of lines, polygons into 3-D grid
• 1987 marching cubes algorithm (convert volume model to
• 1988 direct volume rendering with painter’s algorithm
• 1989 splatting
• 1990’s volume rendering hardware
Computer Graphics 15-462 6
Volume Rendering Pipeline
• Data volumes come in all types: tissue density (CT), relaxation time of
certain molecules (MRI), windspeed, pressure, temperature, value of
• Data volumes are used as input to a transfer function, which produces
a sample volume of colors and opacities as output.
– Typical might be a 256x256x64 CT scan
• That volume is rendered to produce a final image.
data rendering final
Computer Graphics 15-462 7
• The transfer function takes (multiple) scalar data values as input, and
• It gets applied to every voxel in the volume “model”
• It can be very simple (a color lookup table) or very complicated
(implementing CSG, voxel texturing, etc.)
Computer Graphics 15-462 8
• Usually one just integrates color through the volume (ray casting)
• Recursive ray tracing is also possible
– But it gets confusing pretty quickly (shadows, filtered light, reflections, etc)
• For lighting we need surfaces!
– We can use the magnitude of the local gradient to check for surfaces (for example,
bone is denser than fat on CT scans)
– And we can use the (negative of the) gradient direction as a lighting normal!
– Some, all, or none of the voxels will have surface lighting.
•And we need material properties!
–Either assume all the data is one material type,
–Or use a separate set of segmentation data to
identify voxel materials.
Computer Graphics 15-462 9
• Regular x-y-z data grids are easiest and fastest to handle, but
algorithms exist for handling irregular grids like finite element
models, where the voxels (volume elements) are not all parallelepipeds.
– Resample it
– or just deal with it
– Finite element data, ultrasound data
• Geometrical primitives can be handled by "rasterizing" them into
This model was rasterized
and rendered with VolVis
Computer Graphics 15-462 10
• By convention, opacity (alpha)
ranges from 0.0 to 1.0, 1.0 being
• Multiple layers of material are
composited according to their
• An ideal, continuous material takes
the limit of this process as it goes to
an infinite number of infinitely thin
• The local gradient of opacity can be
used to detect surfaces, and as the
normal for the lighting equation.
Computer Graphics 15-462 11
Ray Casting Volumes
• Just integrate color and opacity along the ray
• Simplest scheme just takes equal steps along ray, sampling opacity
• Grids make it easiest to find the next cell
• It’s simple to include volumes as primitives in a ray tracer
– clouds, fog, smoke, fire done this way
Computer Graphics 15-462 12
• How do you compute RGBA values which are not at sample points?
• Nearest neighbor (point sampling) yields blocky images
• Trilinear interpolation is better, but slower
• Just like texture mapping
– You can even mipmap in 3D
Nearest Neighbor Trilinear Interpolation
Computer Graphics 15-462 13
• Wonderfully simple
• Working back-to-front (or front-to-back), draw a “splat” for each
chunk of data
• Easy to implement, but not as accurate as ray casting
• works reasonably for non-gridded data
closeup of a splat
Computer Graphics 15-462 14
• Shear-Warp (Lacroute and Levoy)
– requires a grid
– sort of like Bresenham for volumes
– very fast with no hardware acceleration, but implementation is tricky
• Polygons + 3D texture
– Build a 3D texture, including opacity
– Draw a stack of polygons from back to front, with that texture
– Very efficient on machines with hardware acceleration that supports opacity
Draw polygons back to front
Computer Graphics 15-462 15
CSG is Easy
• The transfer function can be used to mask a volume or merge volumes
• You are still confined to the grid, of course
Computer Graphics 15-462 16
Another CSG example
Computer Graphics 15-462 17
• Limit yourself to what you can do in cache...
• …and do multiple blocks if necessary
• Quit integration early- that last bit is slowest
• Error measures
Computer Graphics 15-462 18
Computer Graphics 15-462 19