Hi folks,

I found a bug in the povray output from PyMOL, when using the
orthographic perspective (the perspective projection is ok):

I had been playing around with using povray to make fancy images from
PyMOL output, but I noticed (actually somebody else did, I was too busy
admiring the special effects that I could create!) that the povray
output file that I created from pymol gives a mirror image. I simply
create my povray input file with:

        (header,data) = cmd.get_povray()
        povfile=open(file,'w')
        povfile.write(header)
        povfile.write(data)
        povfile.close()

The header looks something like:

camera {orthographic location <0.0 , 0.0 , 146.8305816650>
look_at  <0.0 , 0.0 , -1.0> right 64.2756500244*x up 65.9462890625*y}
#default { finish{phong    0.800 ambient    0.120 diffuse    1.080
phong_size 25.000000}}
light_source{<4000.0001,4000.0001,9853.1694>  rgb<1.0,1.0,1.0>}
plane{z , -236.2687 
 pigment{color rgb<1.0000,1.0000,1.0000>}
 finish{phong 0 specular 0 diffuse 0 ambient 1.0}}

The second line contains the information that describes the view.
To correct the image, I had to change the sign of
the X-axis (the "right" parameter). Thus changing:

   look_at  <0.0 , 0.0 , -1.0> right 64.2756500244*x up 65.9462890625*y}

 to:

   look_at  <0.0 , 0.0 , -1.0> right -64.2756500244*x up 65.9462890625*y}

Since it would be a pain to have to edit the povray file all the time,
I went looking for the word "look_at" in the sournce and I found the
offending lines in layer1/Ray.c (line 508). The diff to my correction
looks like:

*** ./Ray.c.orig        Fri Aug 16 14:35:05 2002
--- Ray.c       Fri Aug 16 13:46:33 2002
***************
*** 507,509 ****
      sprintf(buffer,"camera {orthographic location <0.0 , 0.0 , 
%12.10f>\nlook_at  <0.0 , 0.0 , -1.0> right %12.10f*x up %12.10f*y}\n",
!             front,I->Range[0],I->Range[1]);
    }
--- 507,509 ----
      sprintf(buffer,"camera {orthographic location <0.0 , 0.0 , 
%12.10f>\nlook_at  <0.0 , 0.0 , -1.0> right %12.10f*x up %12.10f*y}\n",
!             front,-1*I->Range[0],I->Range[1]);
    }

That is, I simply multiplied I->Range[0] by -1 to swap the hand of the
resulting image.

Hope this helps any confused povray-ers out there,
Robert
-- 
Robert L. Campbell, Ph.D.               http://biophysics.med.jhmi.edu/rlc
r...@k2.med.jhmi.edu                                    phone: 410-614-6313
Research Specialist/X-ray Facility Manager
HHMI/Dept. of Biophysics & Biophysical Chem., The Johns Hopkins University
    PGP Fingerprint: 9B49 3D3F A489 05DC B35C  8E33 F238 A8F5 F635 C0E2

Reply via email to