Publication Figure Rendering With Advanced Lighting
One of the advanced features provided by the Tachyon ray tracer (included with VMD), is the ability to render scenes with ambient occlusion lighting. This lighting technique mimicks some of the effects that occur under conditions of omnidirectional diffuse illumination, e.g. outdoors on an overcast day. This lighting used in concert with traditional point source lights and directional lights to increase the perception of shape, depth in images of molecular structures, and decreases the deleterious effects of harsh shadows which otherwise occur with lighting based on a small number of point sources. This lighting model is particularly good at emulating the appearance of chalky materials, and can make molecular graphics more understandable, not to mention aesthetically appealing.
The ambient occlusion lighting feature of Tachyon has been designed so that existing Tachyon scene files (e.g. produced by older versions of VMD) can be re-rendered using the new lighting mode without the need to re-export or edit the scene file to enable the new lighting mode. The new lighting mode can be enabled through new command line options when running Tachyon. Since the ambient occlusion lighting mode involves performing a small monte carlo sampling of illumination at every visible point in the scene, rendering with ambient occlusion lighting takes longer than without it. In some cases it may take three times as long, as a result of the significant amount of additional sampling that takes place.
Using Tachyon ambient occlusion lighting with VMD 1.8.7
VMD 1.8.7 adds built-in controls to enable ambient occlusion lighting for external renderers that support it (currently only Tachyon, and TachyonInternal, but we expect future versions to support this feature in POV-Ray or other packages using some emulation techniques). Ambient occlusion lighting is enabled in the Display -> Display Settings window by selecting "on" in the "Amb. Occl." chooser and selecting "on" in the "Shadows" chooser. Once ambient occlusion lighting is enabled, the effect is adjusted by manipulating the "AO Ambient" and "AO Direct" coefficients, which scale the lighting contribution from the ambient light, and from the standard VMD lights, respectively. In most cases, an ambient light coefficient ranging from 0.7 to 1.0 and a direct lighting coefficient of 0.1 to 0.4 are most appropriate and yield the best results. A rule of thumb that tends to work well is that the sum of the two lighting coefficients should be near to 1.0.The basic process for rendering a VMD 1.8.7 image or movie with Tachyon or TachyonInternal with ambient occlusion lighting is as follows:
- Load molecular scene into VMD with your preferred representations.
- For each representation, select a material that's fairly diffuse such as the "Diffuse" material, or the AO-optimized "AOshiny", "AOChalky", or "AOEdgy" materials provided in VMD.
- Enable ambient occlusion lighting in the Display -> Display Settings window as described above.
- Set the "AO Ambient" factor to 0.8, and the "AO Direct" factor to 0.3 as an initial starting point.
- Render the scene using File -> Render -> Tachyon or TachyonInternal, or use the "render" command to do the same.
- Due to the increased computational complexity of rendering with ambient occlusion lighting, it's highly recommended to run VMD and Tachyon on a multiprocessor or multi-core workstation for best performance.
- Example scene and Tachyon rendering scripts for VMD 1.8.6
Using Tachyon ambient occlusion lighting with VMD 1.8.6 or older
VMD 1.8.6 doesn't contain specific rendering controls to directly manipulate the ambient occlusion lighting effect from within the program, so the use of ambient occlusion lighting involves exporting the VMD scene to Tachyon, and performing the Tachyon rendering with additional flags to override the lighting information contained in the scene file.
The basic process for rendering a VMD 1.8.6 scene in Tachyon with ambient occlusion lighting is as follows:
- Load molecular scene into VMD.
- Display the structure with your favorite representation.
- For each representation, select a material that's fairly diffuse (such as the "Diffuse" material provided in recent versions of VMD)
- Render the scene using File->Render->Tachyon, or use the "render" command to export the scene to a Tachyon .dat file.
- Once exported, you can re-render the scene using special Tachyon flags which override the lighting specified in the VMD scene with your own coefficients, allowing you to add in an ambient occlusion ("skylight") lighting factor.
- Note: for VMD scenes generated by versions older than VMD 1.8.6, an extra Tachyon command line flag, -normalfixup guess, must be added to the command line since the Tachyon 0.98 uses a new shading algorithm with much stricter requirements on polygon winding order.
- Tachyon can automatically rescale the intensity of point lights spotlights and directional lights in the scene when adding a "skylight" ambient occlusion contribution. This is done with the "-auto_skylight X" command where "X" is replaced by an intensity factor ranging from 0.0 to 1.0.
- In cases where the automatic scaling produces results which are too dark in areas where the ambient lighting doesn't reach, it is often desirable to take complete control over the scaling factor applied to the existing lights, for final adjustments. This is accmplished by manually specifying both the rescaled lighting and additional skylight components yourself, using the "-rescale_lights X -add_skylight Y" flags which also take intensity scaling factors from 0.0 to 1.0.
- The following example commands are good starting points for rendering images with ambient occlusion:
- tachyon -auto_skylight 0.8 inputscene.dat -o outputimage.tga
- tachyon -rescale_lights 0.2 -add_skylight 0.8 inputscene.dat -o outputimage.tga
- tachyon -rescale_lights 0.4 -add_skylight 0.7 inputscene.dat -o outputimage.tga -aasamples 8 (This version adds 8 antialiasing samples per pixel, for much smoother edges, but takes 8 times longer to run!)
- Due to the increased computational complexity of rendering with ambient occlusion lighting, it's highly recommended to run Tachyon on a multiprocessor or multi-core workstation for best performance.
- Besides running on a fast machine, another convenient way to run test renders over and over is to use the "-res xxxx yyyy" flag to override the scene-defined resolution of the rendered image. Using this flag you can render a small 256x256 or 512x512 test image, and when you've adjusted the lighting the way you like, you can render it at poster resolution and go out for lunch, with a command like:
- tachyon -res 2048 2048 -rescale_lights 0.4 -add_skylight 0.7 inputscene.dat -o outputimage.tga -aasamples 8
- Example scene and Tachyon rendering scripts for VMD 1.8.6







