POV-Ray : Newsgroups : povray.general : Stereoscopic camera : Re: Stereoscopic camera Server Time
31 Jul 2024 10:18:17 EDT (-0400)
  Re: Stereoscopic camera  
From: Dave Bodenstab
Date: 15 Nov 2007 18:36:40
Message: <473cd808@news.povray.org>
Paul Bourke wrote:
> A stereoscopic camera for PovRay.
>    http://local.wasp.uwa.edu.au/~pbourke/modelling_rendering/stereopov/

Having experimented with generating stereo views with povray, I really
liked Mr. Bourke's stereoscopic camera patch.  However, it still relies
on one essentially having to run povray twice (once for the left view
and once for the right view).  It is true that while the example given on

   http://local.wasp.uwa.edu.au/~pbourke/modelling_rendering/stereopov/

produces both views, it relies on the animation loop to compute the
eye separation:

   eyeoffset -0.5*EYESEP + clock*EYESEP

This makes it difficult to generate a stereo animation; one has to
either run povray many, many times (once for each frame), or run povray
twice using a different .pov/.inc file.

Since povray handles animations by re-rendering each frame and writing
the resulting images as image000, image001, etc., I thought why not have
the stereoscopic camera make povray act in a similar fashion?

I have modified Mr. Bourke's stereoscopic camera slightly:

   #local VP = <0,0,1>;
   #local ZEROP = 2;              // Distance to zero parallax
   camera {
      stereoscopic                // New camera type
      location VP
      up y
      right image_width*x/image_height
      angle 60
      sky <0,0,1>
      look_at VP + <1,0,0>
      zeroparallax ZEROP          // Distance to zero parallax
      eyeseparation ZEROP / 30    // Separation between left/right images
   }

Instead of providing the eye offset for the left/right images,
the eye separation is provided.  Povray now does the math and renders
both images.  In the same way that the animation loop appends 0,
1, ... to the output image names for each frame, povray will append
'L' and 'R' to the left/right image names.  If used within an animation,
the image names become 'L0', 'R0', 'L1', etc.

---

I know that there have been macros and other stereo patches in the past.
For what it's worth, this is another one.  Some pluses might be:

   + all of the reasons mentioned by Mr. Bourke
   + integrated so it can be used with animations
   + using the Post_Frame_Command.sh automatically creates a red-cyan
     anaglyph from the left/right images
   + using the Post_Scene_Command.sh automatically creates a movie from
     the anaglyph images

See povray.unofficial.patches for the patch.  It also includes a modification
to scenes/advanced/ionic5/ionic5.pov to use the new stereoscopic camera to
render the stereo pair.

Thank you Mr. Bourke for the real work, and giving me the motivation for
this.

Dave Bodenstab


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.