Basic Volume Rendering
From CGAFaq
Two principal methods can be used:
- Ray casting or front--to--back, where the volume is behind the projection plane. A ray is projected from each point in the projection plane through the volume. The ray accumulates the properties of each voxel it passes through.
- Object order or back--to--front, where the projection plane is behind the volume. Each slice of the volume is projected on the projection plane, from the farest plane to the nearest plane.
You can also use the Marching Cubes algorithm, if the extraction of surfaces from the data set is easy to do.
Here is one algorithm to do front--to--back volume rendering. Set up a projection plane as a plane tangent to a sphere that encloses the volume. From each pixel of the projection plane, cast a ray through the volume by using a Bresenham 3D algorithm. The ray accumulates properties from each voxel intersected, stopping when the ray exits the volume. The pixel value on the projection plane determines the final color of the ray.
For unshaded images (i.e., without gradient and light computations),
if is the ray color,
the ray transparency,
the new ray
color,
the new ray transparency,
the voxel color,
the voxel
transparency, then
and
,
with initial values:
and
.
An alternate version: instead of , use
,
with
a float variable. Sometimes this gives the best results. When the
ray has accumulated transparency, if it becomes negligible (e.g.,
), the process can stop and proceed to the next ray.
References:
- Bresenham 3D: [GemsIV], page 366, and http://www.sct.gu.edu.au/~anthony/info/graphics/bresenham.procs
- [Watt:1992], pages 297--321
- 'Volume Visualization', Arie Kaufmann (editor),[Kaufmann:1991]
- 'Efficient Ray Tracing of Volume Data', by Marc Levoy, [Levoy:1990]

