Hold the phone here, Tachyon looks pretty nice
In the last post, I went over some of the POV-Ray basics. The toughest part of actually using POV-Ray to render figures of proteins is importing the structure into the rendering package - the complex geometry of the macromolecule has to be translated to the system of simple objects understood by POV-Ray.
As I was looking into some software packages that can output .pov files, I came across another raytracing program called Tachyon which is included (sort of) in the latest version of VMD. The example images made using the ambient occlusion lighting capability of Tachyon made my jaw hit the floor. Instead of babbling on about ways to get POV-Ray to play nice, I’ll go over how to get and use VMD/Tachyon.
Getting VMD:
Download page (registration required). I use the Linux OpenGL version. To install this version, you should extract the archive, then check the configure file in the main folder. The important lines are at the top, and in my installation look like this:
# Name of shell script used to start program; this is the name used by users $install_name = "vmd"; # Directory where VMD startup script is installed, should be in users' paths. $install_bin_dir="/usr/local/bin"; # Directory where VMD files and executables are installed $install_library_dir="/usr/local/lib/$install_name";
Save the file, then run these commands in order:
./configure cd src make sudo make install
Note: I’m doing this bit from memory, so you’ll have to excuse me if it doesn’t work exactly right.
Getting Tachyon:
::EDIT:: I’m not very smart. The procedure outlined below will work just fine, or you can do this the easy way: just input the tachyon commands (shown farther down when rendering actual images) into the rendering command box of VMD. Much less messy and more contained. ::END EDIT::
Although an implementation of Tachyon is included with VMD, to get the fancy effects you’ll also need to install a standalone local version. You can download the archive here. Installing Tachyon is similar to installing VMD. Since I did this one today, hopefully the instructions are more accurate! I first extracted the archive to my desktop, then ran the following commands:
sudo cp -r ~/Desktop/tachyon usr/local cd /usr/local/tachyon/unix sudo gedit Make-config // Note: here I commented out the first 3 lines under PNG support and uncommented the second set of three. This should enable rendering to PNG. Save the file and close it. sudo make linux cd ../compile/linux sudo cp -r * /usr/local/bin
To test if these files are installed properly, you can just type their names into the terminal. “vmd” should start up the VMD program, and “tachyon” should give you a list of options that you didn’t define when you called the program. If either say “command not found” or something similar, the installation isn’t done properly.
Let’s make a molecule
In a terminal, run the vmd command. You’ll get three windows, a “Main” with menus etc, the display which should read “VMD”, and a console. In main go to File–>New Molecule and browse for a handy PDB file. I’m using the structure of alpha hemolysin, PDB code 7AHL. Hit “Load” and you should see it in the display window. Click and drag with the left mouse button to rotate, zoom with the mouse wheel.
Now, back in the main window, go to Graphics–>Representations. In the coloring method box select “chain”, for material pick “diffuse”, and in the drawing method box select “surf” (wait a while for this to calculate). Close the representation window. Back in the Main window go to Display–>Axes–>Off. Now go to Graphics–>Colors. Choose “Display” under categories, then “Background”. Set this to “8 white”. You can also choose “Chain” as the category and adjust the different chain colors to something nice. Now we’re ready to render this thing.
We’ll make three pictures. First, just a snapshot to see what it looks like without raytracing. In Main again, go to File–>Render. Change the file name to snapshot.tga and hit start render. You can close the new window when it opens. Now select “Tachyon” in the “Render Using” box. Change the filename to “tachyon.dat” and hit start render again. If your computer is anything like mine, it will read “Rendering in Progress” for a bit. Once the button changes back to “Start Rendering”, you can go ahead and quit VMD.
::EDIT::Here is where all that stuff I said above about needing a standalone install of tachyon is crap. Just skip this next paragraph and alter the VMD render command for tachyon with the skylight flags::END EDIT::
To get the fancy ambient occlusion stuff, we need to work on our tachyon file from the terminal. Note that the commands I’ll use here are modified from this mini tutorial. Go to your working directory (you’re probably already there since you launched VMD from the terminal). Enter a command like this:
tachyon -auto_skylight 0.8 tachyon.dat -format PNG -o tachyon_auto.png
This should (after a couple of minutes) make an image with some automatic lighting settings. I must say it looks really damned nice.
There are more flags you can use to tweak the lighting. For a super-fancy image, you can run something like:
tachyon -rescale_lights 0.4 -add_skylight 0.7 tachyon.dat -format PNG -o tachyon_fancy.png -aasamples 8
and then go work in the lab for a bit, as this will render for a while.
So, the final products!
First, the snapshot from VMD (converted from TGA to PNG with the GIMP):

Next the standard Tachyon output (converted from TGA to PNG with the GIMP):

The automatic skylight version rendered with Tachyon from the command line:

The super fancy antialiased skylight version:

You can decide for yourself if this last one is worth an additional 15 minutes of rendering time.
I have to say I’m really impressed with these figures. I’ll probably play around with more of the guts of Tachyon as well as optimizing materials and things from within VMD, but this was actually pretty simple to do compared to most of the things I’ve tried with POV-Ray.
Any tips for rendering? Leave a comment!



May 6th, 2008 at 12:33 pm
[...] of all I loaded in my molecule and set it up similar to the exercises from the other day: white background, surface representation, diffuse material. I also added the Depth Cue feature of [...]