Danforth Center Logo Donald Danforth Plant Science Center
Home About Us Research Resources Opportunities News & Media






Home
Publications
Team
Contact

       Hints and Tips using MolViewX and POV-ray



POV-ray is an extremely powerful rendering program that is free of charge.  MolViewX can write out POV-ray files that, when rendered, will match the colors and views shown in the MolViewX window.

Getting started with POV-ray:
1) Follow the link and download the file.
2) You may need to help POV-ray find the 'include' files for default colors and textures.
     a) Go to the Edit/Preferences menu item.
     b) Select the 'Scenes' item in the window.
     c) Click on the 'Add' button and find the 'include' directory within the POV-ray folder.
3) Some additional pointers:
     a) When opening a file within POV-ray, you may need to select the 'Enable' -> 'All documents' item at the top in order
         to be able to click on the MolViewX file.
     b) To change resolution (output size) and antialiasing, you need to select the Edit/filename Settings item.
     c) For animation, as reviewed below, you have to have an filename.ini file to control the number of frames.

Tips on outputting files from MolViewX:
1) When MolViewX creates ribbons, it makes a number of planes.  When you hit the 'smoothing' button, you double the number of planes.  POV-ray is great (unlike Strata), in that it can handle a huge number of planes.  I recommend hitting the 'smoothing' button at least 2-3 times (depending on how large your protein is).
2) Do not forget the 'smooth ribbon' option in the 'Ribbon Preferences'.  By default, MolViewX makes a more accurate 'wavy' ribbons for beta-strands.  If you want straighter strands, go to the Object window, click on the 'Pref' button below the 'Rib' button, and choose 'Smooth beta-strands'.  THEN go and make your ribbon again.
3) Do not forget that in this same window, you have many options as to how to color your ribbons.  For example, you can select the 'Color by 2° structure segments'.  Then go to the 'Window/Ribbon buttons' menu item and paint your ribbons according to secondary structure elements by changing the colors of the boxes below each element.


Tips on editing the POV-ray files:

At the top of the POV-ray file is a header that controls lights and such.  This is the default setting:

global_settings { max_trace_level 5}
#include "colors.inc"
plane { z, 83.335991 pigment {color White}}
light_source { <0,0,-100> rgb <0.3,0.3,0.3>}
light_source {<50,50,-50> White}
camera{ orthographic location <0, 0,  -45.951397 >look_at <0,0,0>}

a) Want to get rid of the background shadow?
- delete the line containing the word 'plane'
- Replace it with

background {Black}

or...

light_source { <0,0,-100> rgb <0.3,0.3,0.3>}

where the rgb (red, green, blue) colors range from 0-1.0
Be aware that you may need to alter the light intensity depending upon the background color.

b) Want to make the object smaller or larger in the window?
MolViewX decides the 'best' place to put the camera.  The location of the camera is in angstroms and is based on the dimensions of your figure.  For example, the line above containing the word 'camera' puts the camera at -45Å away.  To make the image larger, say, change that to -20.  If you want to make it smaller, change it to -60.

c) How to give the image perspective?
In the 'camera' line, is the word 'orthographic'.  Just delete that word and the objects closest to the camera will be larger than the items in the back.

d) How do you make animations?

Click on this sentence to download two examples. 

Some steps to make a movie:
1) Make a filename.ini file.  You can start by copying one of the examples that I made.  This
filename.ini file simply tells POV-ray how many frames will be in the movie.  The more frames, the bigger the file, but the smoother the movie.
2) If you look the top of the POV-ray files, you will see how I made these simple movies:

How to make the camera fly through the protein:

The flythrough.ini file:

Antialias=Off
Antialias_Threshold=0.2
Antialias_Depth=3
Input_File_Name=flythrough.pov
Initial_Frame=1
Final_Frame=60
Initial_Clock=0
Final_Clock=2
Cyclic_Animation=on
Pause_when_Done=off


Here, the 'clock' will go from a value of 0 to 2 over a total of 60 frames.  Note that you have to include the name of your POV-ray file.  Here it is 'flythrough.pov'.

Now, looking at the top of the 'flythrough.pov' file

global_settings { max_trace_level 5}
#include "colors.inc"
#declare A=clock-1;
background {Black}

light_source {<-A*(45), 0,  -A*(45) > rgb <1,1,1>}
camera{ location <-A*(45), 0,  -A*(45) >look_at <0.1,0.1,0.1>}


So, the variable 'clock' will run from 0 to 2.  I've declared the variable 'A' to be 'clock-1'.  In other words, 'A' will run from 1 to -1 (has to do with clock not running in the negative range).  Therefore, the camera normally starts at a large negative number along the 'Z' axis and here will move to the other side of the protein.  Notice the 'look_at' command.  This says that no matter where the camera is, point it towards the 0.1, 0.1, 0.1 coordinate (it cannot be 0,0,0 here since the camera cannot be allowed to be at the position it is pointing to).  Also note the 'light_source' command.  I am making it move as well to keep the molecule lighted throughout the movie.

Now, set up POV-ray for rendering:
1) Go to the 'Edit/filename.pov Settings' menu item.
2) Select the 'Animation' button.
3) Set up the frames as per your filename.ini file.  For this example, I would set
Final = the final frame in my
filename.ini file, 60
End At =
the final frame in my filename.ini file, 60
Start At = 1

Now, select the 'Output' item in this dialog box and select 'QT Movie (Mac OS)'

Now select 'Render' and get a cup of coffee.


How to make the camera rotate around the protein:

This is a relatively straightforward procedure.  I am going to move the camera around the protein in the y=0 plane by using SIN and COS functions to calculate the Z a X positions in that plane:

Here is the hb.ini file:

Antialias=Off
Antialias_Threshold=0.2
Antialias_Depth=3
Input_File_Name=hb.pov
Initial_Frame=1
Final_Frame=180
Initial_Clock=0
Final_Clock=1
Cyclic_Animation=on
Pause_when_Done=off

Pretty much the same as the other .ini file.  Here we are going to have 'clock' run from 0 to 1 over 180 frames.  This will correlate to rotations of 2 degrees/frame (nice and smooth).

Here is the header for hb.pov:

global_settings { max_trace_level 5}
#include "colors.inc"

#declare A = clock;
#declare B = sin(radians(A*360));
#declare C = cos(radians(A*360));

#declare D = 45*B;
#declare E = -45*C;
light_source {<D, 0, E> rgb <1,1,1>}
camera{ location <D, 0, E> look_at <0,0,0>}
background {Black}
 
So, here the variable 'B' will run from the SIN of 0 to 360° and 'C' will run from COS of 0 to 360°.  Trust me, this will get you a rotation.  The number '45' in variables 'D' and 'E' came from the default camera position calculated by MolViewX.  Again, the camera will always point to 0,0,0.  Set up the size and output (QuickTime) as above and let it run.