Rendering with ambient occlusion


Left: Image rendered with standard Phong illumination. Right: Same object, rendered with ambient occlusion.

This is a short introduction to a nice rendering technique called ambient occlusion, and how you can use it to visualize your volume images.

What is ambient occlusion?

Ambient occlusion is a shading model that determines the color of a surface based on how much it is occluded by other surfaces. It simulates a large dome of light surrouding the entire scene. The shading produced by ambient occlusion is very soft, similar to how objects appear on an overcast day (where the cloudy sky acts as a dome of light). In the context of scientific visualization, the soft shadows produced by ambient occlusion provide an important visual cue to 3D relationships between objects in the scene that is often lacking when using i.e. standard Phong illumination.

Ambient occlusion is typically computed using raytracing. For every point that is shaded, a number of rays are shot in random directions over a hemisphere centered at the point. The ratio of rays that hit another surface in the scene determine the color of the point, as illustrated below. The more rays that hit something, the darker the surface is rendered.

Image taken from here

Unfortunately, the raytracing approach is very slow and thus impractical to use in realtime applications. However, if we have a static scene, we can precompute ambient occlusion and store the solution so that we don't have to compute it for every frame.

How can I use ambient occlusion to visualize my images?

ShadeVis is an easy-to-use open source software package that can render polygon meshes with ambient occlusion. The occlusion is precomputed and stored for every vertex of the mesh, so the objects can be rendered in realtime. A compiled version of the program is available for Windows, and if you want to run it under Linux you can download the source and compile it yourself (I haven't tried this though). The program only reads polygon models in PLY format, so you have to convert your data to this format first. I have written a little VTK-script that reads a volume image in VTK-format, extracts an isosurface from this image and exports the surface to a PLY file that can be read by ShadeVis. Try it out, and don't hesitate to contact me if you have any questions!

Last modified: Mon Jul 10 15:16:33 CEST 2006