Skip to content

Avogadro and POV-Ray Export

I have made some more progress with Avogadro and exporting to POV-Ray. Currently the export is working quite well, but is a more manual process than it will be once I have finished all aspects of its implementation. You can export to POV-Ray, but then need to run POV-Ray yourself on the .pov file created to actually get an image. It is not too much work to add the dialog to call POV-Ray, pass it a few options and display the rendered image.

Right now I have the issue that I cannot properly translate between the OpenGL camera matrix and the POV-Ray camera system. If anyone has any experience of doing this I would love to hear about it. I have tried using the direction, up and right keywords but POV-Ray claims my coordinates are not orthogonal, and they are - Benoit double checked they were too. I am probably missing something simple. So right now I can export to POV-Ray but only get one view of the atom which does not follow the view in Avogadro - not ideal but certainly usable.

1d66 rendered in POV-Ray with shadows1d66 rendered in POV-Ray without shadows

The images above show a rendering of 1d66 from the protein data bank thing (I sometimes grab interesting and large example structures from there to test Avogadro and Carsten liked this one). The first image shows it rendered with shadows and the second shows it rendered without shadows. Carsten pointed out that effects such as shadows can serve to confuse students but this can be made a configurable option as shadows also help the mind to visualise the three dimensional structure in my opinion (if used right).

There are lots of things that can be tweaked about the way the files are exported as well as the rendered image look and feel. A lot of work has actually gone into getting this working as I have made the painter independent of the paint device being used. This means that the engines can paint to any device where a painter implements the primitives in the virtual base class and I think this will allow Avogadro to scale very well as more features are added.


No Trackbacks


Display comments as Linear | Threaded

Jos van den Oever on :

Jos van den OeverI've got OpenGL and Povray output for a polymer modeller I wrote a few years back. It models polymer chains constrained in a sphere. The tool has a button 'save image' which generates a povray image.

I can send you the code next week. Translating the view works fine.

Marcus D. Hanwell on :

Marcus D. HanwellI would love to take a look at what you did. If you wouldn't mind me using the code (or some derived from it) in the Avogadro library that would be great. I am also assessing the approach I took to see if there are in fact better ways to do the export. POV-Ray has so many settings and properties you can apply to surfaces!

steven on :

i found a bug. when exporting file as .pov/.inc, pov-ray cannot render it. after saving file, the system ia always busys.

Florian on :

FlorianHey Marcus,

why don't you give atoms which are further away from the camera a slightly darker shade or mix their color with a bit of light blue. This should simulate athmospheric effects and might strenghten the 3D-impression of the images. This is just an idea, and I have no idea if this works out at all, but I think it might be worth a try.


Marcus D. Hanwell on :

Marcus D. HanwellIt would be better to use the tools made available by the POV-Ray developers. The shadows work quite well but it might be beneficial to use multiple light sources, and I think there are effects such as fog that may help in creating the illusion of depth. This is all open source software so anyone is free to alter my settings too. I would certainly commit the changes if I saw a better way of rendering these scenes.

Kris Zarns on :

Kris ZarnsI'm actually working a project to translate fully featured openGL to povray SDL. If you're still having trouble with coordinates, let me know. The biggest issue I saw there when I was working ont hat part was that openGL assumes a right handed coordinate system and POVRAY assumes a left handed coordinate system, had invert the up-vector in povray.

Marcus D. Hanwell on :

Marcus D. HanwellThat may be it possibly - I will check it out. I had forgotten about the difference in coordinate handedness.

kris zarns on :

kris zarnsright, a few months late, but if you're still having this problem, turn the vista buffer off. It's used to speedup rendering and is the thing that requires the camera coords to be perpendicular.

Marcus D. Hanwell on :

Marcus D. HanwellBenoit fixed it a while back - it seems to be quite happy now. I do need to add some other functions to the POV-Ray output but the camera stuff is there.

Harro Dittmar on :

Harro DittmarHello Marcus,
Looks like you have a lot of experience with Avogadro. I am trying to export a trajectory to povray to create an avi file of ten configurations of my molecule, but I keep getting the error message "Could not run Povray'. I am able to use Povray in a terminal, but Avogadro does not seem to find it (I am running MacOSX 10.5.8-) Any idea what is going wrong ?

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.
To leave a comment you must approve it via e-mail, which will be sent to your address after submission.
You can use [geshi lang=lang_name [,ln={y|n}]][/geshi] tags to embed source code snippets.
Form options