How to make a video using the programs VMD, POV-Ray and Sony Vegas Video

I'll be very grateful for your question, comments or experiences about this tutorial. You can write me to jindra@matfyz.cz


In this tutorial I would like to explain step by step and show you how to make a video like this:

Brief procedure

In some internet databases (eg www.pdb.org) you can download .pdb file that contains the structure of the molecule you want to show. You can display this file in VMD. You set the way (color, surface, ...) how to show atoms, bonds between atoms, hydrogen bonds, ... When you are satisfied with the scene use the plug-in Movie Maker to generate the file .pov, with the POV-Ray program can work. The POV-Ray can set the camera movement and then generate a series of pictures. From these images the program Vegas Movie Studio can produce video, add titles, transitions and other effects.

Internet databases (bio)molecules

On the internet, there are several dozen databases. On Wikipedia there are lists of such database of protein structures, crystallographic databases (below), or generally biological database. I choose to www.pdb.org/ structure with PDB ID 103D. It wasn't good choise. The title "THE STRUCTURE OF THE HUMAN Centromere (GGA) 2 MOTIF" can warn me that it is not the normal DNA sequence. Fortunately, the video look good. I downloaded the structure in format .pdb

VMD and work in it

Even description of the basic control VMD would make a few articles. Moreover, I would do unnecessary work, because tutorial is the total clear and detailed. Here I would mention some more advice, what to avoid and what is appropriate to the contrary. The first two are of a general council, the other linked to the subsequent export of files into .pov file for further processing:

Exporting scenes from the VMD to the .pov file

If you have set what you want to capture, use plug-in Movie Maker (Extensions-> Visualisation-> Movie Maker). Here we have two options. Either directly to generate the images but then we would not be able to edit it. The second option is to generate the .pov file and work with it in POV-Ray. I'll describe the second option. Set Renderer-> POV-Ray (Ray Tracer). In the Movie Setting, select Trajectory. (If you have also a trajectory file downloaded in VMD it generates for each frame of trajectory single .pov file.) Set the path where to save the generated .pov file and click the Make Movie button. You will probably be asked to enter the path to the rendering kernel of POV-Ray. On my computer the POV-Ray is installed in the directory c:\Users\Jindra\AppData\Roaming\POV-Ray\v3.6\bin\ file is named pvengine64.exe (Windows 7).

(I had a problem with the movie maker. It said that it does not have permission to write to C:. I think that helped when I set in POV-Ray Option->Script I/O Restriction->No restrictions. Maybe there was still some problem but I don't remember it.

File structure of .pov file

At the beginning of the file are definitions of macros. We are not interested for in them yet. Next part begins with the camera keyword (see Section 2.3.1 from Documentation ) and defines at which positions and what direction we look at the scene. This section we will later edit. Followed light_source to define, what directions and how we will illuminate the objects in the scene and also defines the light sources. Defaults are set up two lights, whose position is taken from the VMD (VMD: Dispay-> Light 0, Light 1 ). From my experience the quality of lighting scenes is not enough and still need to add at least two lights not to be some atoms in the shade. In the last part of the file are listed position of all atoms and bonds on the scene, including color, which will be rendered.

Smooth camera motion

Now suppose that we have one .pov file, which stores information about a molecule. When you run the POV-Ray, open the .pov file and click on the button Run, program will create a picture file with the current view. Try to change the camera position and generate the another image. Try to orient in the coordinate system, which uses POV-Ray. If you want to do a series of pictures, where the camera moves, use the system variable clock and create another file (.ini), which specifies how many frames we want. File .ini will look something like this:

Initial_Frame = 1
Final_Frame = 200 //we want 200 files
Input_File_Name = C:\DNA2\DNA2.0000.pov //source file
Output_File_Name = C:\DNA2\bmp\DNA2a.bmp //What name should have the resulting file

When we run the .ini file in the POV-Ray, it takes the file .pov (in this case DNA2.0000.pov) and generates 200 images, with the continuously variable uniformly increases clock from 0 to 1. If this variable is used in .pov file, each frame will have a different value of the clock variable. This way we can move the camera like this:

camera (
  location <3.5000 * sin (2 * pi * clock), 0.0000, -3.5000 * cos (2 * pi * clock)> //position the camera moves in a circle
  look_at <0.0000, 0.0000, 0.0000> // camera will always look to the origin
  up <0.0000, 1.0000, 0.0000>
  right <1.2618, 0.0000, 0.0000>


Now you know everything you need. You can generate .pov file and create a series of pictures. Now is the time to generate video from generated images and add some decoration like titles, transitions and other effects.

Trajectory video

We have always assumed that we have only .pdb file. We can also have a trajectory file from the molecular dynamic simulation. In this case, the situation is slightly different. Movie Maker does not create just one .pov file, but more - one for each trajectory frame. Do not move with stage during the generation. Trying to do it usually doesn't end up well.

Generated files are needed to collectively adjust (use Linux commands), we need to change the camera view at each frame. Subsequently we will use the queue in program POV-Ray (Render-> File queue, unfortunately you can put there only 512 files) and generate images from all .pov files at once.

Tips and Tricks