Hi,

...a more simplicistic approch to generate side-by-side stereo PNG files 
from an animation in PyMOL would be to activate wall-eye stereo in PyMOL 
(stereo walleye) and double the x dimension of your graphics windows 
(viewport command). Then use the 'Save Movie as... PNG' command (mpng...).

Of course image size (x,y pixels) will be limited to screen 
resolution/viewport size. If you need higher resolution than your screen 
(e.g. full HD in side-by-side 3D) then I recommend putting the commands 
into a pml-script in which you also set your desired image size (e.g. 
viewport 3840,1080), and which you can run in the GUI-less PyMOL mode 
(pymol -qc your_script.pml).

As mentioned here already, after merging the PNGs into a side-by-side 
stereo movie (using e.g. Virtualdub, ffmpeg) you need a movie player 
which supports side-by-side stereo movies and is able to output to 
quad-buffered 3D displays (free: Bino, commercial: Stereoscopic Player, 
there may be more...).

Christoph

(just saw this thread now, sorry if it's not adding anything useful...)



On 08/26/2014 10:02 PM, Marcelo Marcet wrote:
> Hi Christian,
>
> Thanks so much for your email. I am looking forward to testing your approach 
> and scripts soon. Again, thanks for the detailed explanations and the scripts.
>
> Best regards,
> Marcelo
>
> On Aug 25, 2014, at 6:02 PM, Christian Becke <christian.be...@fu-berlin.de> 
> wrote:
>
>> Hi,
>>
>> Am 25.08.2014 21:44, schrieb Marcelo Marcet:
>>> Thank you for taking the time to reply to this question and for
>>> offering your help. I am also interested in quad-buffered stereo play
>>> back.
>> Sorry, maybe I wasn't clear in my first mail: I don't have experience
>> with quad-buffered stereo playback. All I have done is preparing 3D
>> stereo movie files using PyMOL and ffmpeg[1] which I can play on a 3D TV 
>> (using a side-by-side stereo movie file and polarization glasses) or on a 
>> regular beamer (anaglyph red/cyan movie with red/cyan glasses).
>> I expect that one could play these (or similarly prepared) movie files with 
>> a movie player that makes use of OpenGL quad-buffered 3D capabilities of a 
>> graphics card - but I never tried this myself.
>> AFAIU, there is no such thing as a quad-buffered movie file - it's just the 
>> movie player that plays back a 3D stereo movie file using OpenGL 
>> quad-buffered stereo on hardware that supports it. A player that might work 
>> is bino[2], but, as I said, I never got around to try it out.
>>
>>> Would you be able to provide us with a bit more methodology information?
>>> It sounds like you have a script that helps you save the side-by-side
>>> images and later you use a software called ffmpeg to render the movie.
>>> Is this correct?
>> Yes, this is correct. Here is how I did it:
>> 1) Prepare a movie in PyMOL
>> 2) run the attached python script ("run /path/to/mpng_3d.sh"). This will add 
>> a new command to pymol: mpng_3d
>> It works similar to the mpng command, but saves 2 images for each movie 
>> frame, one for the left and one for the right eye. If ray traced frames are 
>> desired, do "set ray_trace_frames, 1". You can also play around with the 
>> stereo_angle setting (e.g. "set stereo_angle, 3"). This defines the 
>> difference in viewing angle of the images for the left and right eye.
>> The mpng_3d command takes the following options:
>> mpng_3d <prefix>, <width>, <height>, [start=1], [end=-1]
>> render stereoscopic frames sized <width> x <height> pixels.
>> Files will be named <prefix>_%04d.png.
>> Render frames <start> to <end> (default: all frames)
>>
>> Example: "mpng_3d my_movie, 1920, 1080" will write png files called 
>> my_movie_0001.png, my_movie_0002.png, ...
>> If ray_trace_frames is set (recommended), the images will be ray traced and 
>> have a size of 1920x1080 pixels (i.e. full HD).
>> 3) Use ffmpeg to encode a movie from the individual frames saved with 
>> mpng_3d:
>> For h.264 encoding:
>> ffmpeg -i "my_movie_%04d.png" \
>>      -an \
>>      -r 30 -aspect 1.78 -pix_fmt yuv420p \
>>      -c:v libx264 -tune animation \
>>      -vf stereo3d=al:sbsl \
>>      -profile:v baseline -level 3.0 -refs 4 -qmin 4 \
>>      "my_movie.mp4"
>>
>> For WMV encoding:
>> ffmpeg -i "my_movie_%04d.png" \
>>      -an \
>>      -r 30 -aspect ${aspect} \
>>         -vf stereo3d=al:sbsl \
>>      -q:v 2 -c:v msmpeg4v3 \
>>      "my_movie.wmv"
>>
>> These are the commands I used on linux. Similar ffmpeg commands should also 
>> work on Windows or OS X. Video quality and file size were reasonable with 
>> the above settings, and the files played all right on almost all video 
>> players I tested (the wmv files work with all versions of PowerPoint I 
>> tested, the h.264 movies do not work with WinXP).
>> If you change the size of the images, also change the -aspect parameter in 
>> the ffmpeg commands accordingly (for 1920x1080 pixel images: 
>> aspect=1920/1080=1.78).
>> The above commands produce side-by-side stereo movies, i.e. the images for 
>> the left and right eye are shown next to each other in each frame
>> of the movie. Check the ffmpeg docs[3] for other output options.
>> For some movie players (e.g. the one on my LG 3D TV) it might be necessary 
>> to scale the pymol-rendered frames to half-width before encoding them to a 
>> side-by-side stereo movie with ffmpeg. This can be done e.g. with the 
>> "convert" command from the imagmagick[4] suite.
>>
>> I hope this helps!
>>
>> Christian
>>
>> [1] http://ffmpeg.org
>> [2] http://bino3d.org
>> [3] http://ffmpeg.org/ffmpeg-filters.html#stereo3d
>> [4] http://www.imagemagick.org
>>
>> -- 
>> Christian Becke
>>
>> Freie Universität Berlin
>> Fachbereich Biologie, Chemie, Pharmazie
>> Institut für Chemie und Biochemie
>> AG Strukturbiochemie
>>
>> Takustr. 6
>> 14195 Berlin
>> Germany
>>
>> Phone: +49 (0)30 838-57344
>> Fax: +49 (0)30 838-56981
>> E-mail: christian.be...@fu-berlin.de
>> <mpng_3d.py>------------------------------------------------------------------------------
>> Slashdot TV.
>> Video for Nerds.  Stuff that matters.
>> http://tv.slashdot.org/_______________________________________________
>> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
>> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds.  Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Reply via email to