Producing sexy ray-traced images

From CUC3
Revision as of 14:34, 16 June 2008 by import>Csw34
Jump to navigation Jump to search

Pardon the title but you'll understand when you see the results!

So, you've got a PDB, loaded it into Pymol and arranged it so that it looks how you'd like - some bits as a cartoon, some as sticks etc. How do you go about making an image that you can then use for a poster, or a paper, or a CPGS/thesis? The answer lies in ray tracing. To get Pymol to actually produce a ray traced image is remarkably easy, just type

ray

in either the viewing window, or the GUI and press enter. After a few seconds (progress is indicated by a bar at the top of the viewing window), you will see the image suddenly change! You could now save this image using

png raytraced.png

BUT you'd quickly find that

  • the image quality isn't up to much and so you can't use it in a publication
  • it's too small to be used on a poster
  • a black background is NEVER a good idea for images you might print for obvious reasons

To resolve these issues, I will now go through the key settings you should ALWAYS have set,

set ray_trace_fog,0
set ray_shadows,0
unset depth_cue
bg_color white
set antialias,2

You may actually want to have shadows in your image, but for anything larger than a small peptide, it can become very distracting. If you type ray again now, you can already see the improvement. But...there is more to come! Pymol supports a selection of ray tracing modes, four in fact. Which one you choose to use depends largely on which effect you require. Modes are selected with the command:

set ray_trace_mode,  X

where X is 0,1,2 or 3. 0 is the default, 1 puts a black outline around the molecule, 2 gives you a black and white 'sketch' and 3 gives you a funky cartoon like image, with quantised colouring! All four are demonstrated in the images here. My personal favourite is mode 3 although you should bear in mind that it might not look as good when printed.

Once you've chosen your ray tracing options, you're ready to produce the final image. As you'll likely want it to be publication quality, I reccomend using the following

ray 2000,1500
png raytraced.png, dpi=300

These settings can of course be changes. You might find that you need to change the resolution if you have a wide-screen monitor (2000x1500 is for 4:3 aspect ratio monitors) as you might end up inadvertently chopping bits off the image. If in doubt, you can always just use the resolution your desktop is set to.

Voila! you are now the proud owner of a rather good looking image! For more info, you should check out the Pymol Wiki.