File formats/Ray Tracing

From Jmol
Revision as of 00:21, 27 October 2013 by GregE (talk | contribs)
Jump to navigation Jump to search
File Formats

File Formats for Ray Tracing Images Exported from Jmol

Recent versions of Jmol application and signed applet can export models to several high-quality image formats that can be displayed and edited in ray tracing programs like POV-Ray and Tachyon.

POV-Ray

Jmol can export, with limited features, the current view of a model into POV-Ray format. This can be done from script or from the pop-up menu, but is better controled using the top menu in the Jmol application, which opens a dialog with options.

Please, note that two files will be written: the main file and an additional one with a .ini extension appended (a typical example would be File icon.gifxxx.pov and File icon.gifxxx.pov.ini).

  • Home page for POV-Ray, the Persistence of Vision Raytracer.
  • Information on POV-Ray on Wikipedia.
  • Home page for MegaPOV, an extension of POV-Ray.

POV-Ray for Mac

The following updates POV-Ray for Mac, as of Oct 2013. The latest official release for Mac from POV-Ray is 3.6, dating from somewhere around 2007. It runs only on Power PC Macs, not on Intel Macs, ie. it is not a Mac OS X Universal Binary (containing IBM Power-PC and Intel binaries).

For Windows, POV-Ray Release 3.7 is available, the main addition being SMP abilities, ie. it can run on all cores of a chip - useful for a ray-tracer which is an "embarrassingly parallel" type of code. This appears to date from about 2009.

Prior to OS X 10.6 (Snow Leopard) Macs used the Rosetta emulator to run Power-PC apps on the later Intel chips. However this is defaulted off in 10.6. It can be installed, see http://support.apple.com/kb/ph6531 . However I believe that it is somewhat problematic at 10.6 or later.

However MegaPOV which is a much more active POV-Ray extension has released a "3.7 Unofficial" release for Mac in 2013. Available at http://megapov.inetart.net/povrayunofficial_mac/index.html This runs ok on Mac OS X 10.6.8 (Snow Leopard) and allegedly later, ie. 10.7 Lion and 10.8 Mountain Lion. If you search for "povray 3.7 unofficial mac" you will find the announcements and some discussion.


The 3.7 Unofficial release appears to utilise 2 cores fully. It runs the model.pov and model.pov.ini files generated by Jmol 13.0.18 and produces fine images.

The technique which has worked for me on 10.6.8 is:

  • Adjust Jmol window size to 800x600
  • Get your Jmol scene how you want it.
  • Use the Jmol Console to save a scene with "write POVRAY scene.pov" .. this produces scene.pov and scene.pov.ini
  • In POV-Ray Unofficial3.7, in Control Panel / Files & Paths, specify scene as your scene.pov, image as scene.png (*)
  • Also in that panel, Tick 'Use Ini File', and specify scene.pov.ini
  • Also in that panel, if any standard POV-ray include files are needed, specify <path>/POV-Ray 3.7Unofficial/include as a search path for includes.
  • In the panel Image & Quality, select 800x600. (This laborious matching of 800x600 is not fully necessary but it will get you going. Later you can play with sizes and aspect ratios).
  • In Misc, you can also set a path for all output images, which overrides setting (*) above.

Some examples are at http://ptmgallery.s3.amazonaws.com/list.html

I will try to find and document a command-line technique to do all the above, and to allow the direct Render button from the Jmol standalone app to work.

Update 17oct13: My research is showing that there is no command-line version of (Mega)POV-Ray Unofficial 3.7. Ie. running the app always launches into the full Gui version. You may be able to write basic settings to a scene.pov.ini file and launch the app to obey that, I have not attempted that yet.

The Unix/Linux version can obviously run on Mac as well, and has command-line abilities. Useful discussion is at: http://news.povray.org/povray.unix/ and http://news.povray.org/povray.macintosh/ I have not put time into this yet.

POV-Ray for Windows

An update for POV-Ray on Windows, Oct 2013. The following was tested on Windows 7, under Parallels 7 on Mac OS X 10.6.8.

The standard latest POV-Ray Windows release is 3.6. Can be downloaded from http://www.povray.org/download/#binaries . I used the 32 bit version. Release 3.7 is a beta of the SMP version. There is possibly little galn from SMP on Jmol images, they are not render-intensive in a ray-tracing sense. The SMP code only drops the render time from say 5 seconds to 4 seconds for a simple small molecule, in MegaPOV-Unoffical-3.7 (described above).

Install POV-Ray 3.6 wherever you prefer, then run Jmol as a standalone app (by clicking in Windows Explorer, or java -jar Jmol.jar mymodel.pdb). The POV-Ray icon on the menubar will bring up the dialog shown below. Fill in the location of the POV-Ray executable (pvengine.exe).

Hit Go. A dialog may pop up asking for special permission to read the Jmol.pov file, answer yes. (This is a POV-Ray security check, read the Help in the dialog for details). The molecule will then render.

POV-Ray 3.7 and MegaPOV were not tested here.


POV-Ray export dialog

Saving from Jmol application

The application's top menu bar has
File > Export > Render in POV-Ray
which produces images that can be displayed and edited in this ray tracing program (using a dialog with options).

There is also a button in the toolbar that invokes the same dialog. POV-Ray export from toolbar

Saving from Jmol application and signed applet

The pop-up menu also allows in these cases (not in the normal, unsigned applet) to save a snapshot of the model in POV-Ray format. Open the pop-up menu (right-click, or Ctrl+click, or click on Jmol frank) and choose File > Save (or directly Save in older versions). After choosing a format, a dialog will open to choose the location and filename. In this method, no other options for the export will be offered.

You can also export using a script (e.g. from the console) with the write command (see the scripting documentation).


Tachyon

Jmol can export, with limited features, the current view of a model into Tachyon format. Currently this can only be done from script.

Contributors

GregE, AngelHerraez