POV-Ray : Newsgroups : povray.general : Stereoscopy : Re: Stereoscopy Server Time
6 Aug 2024 12:26:51 EDT (-0400)
  Re: Stereoscopy  
From: Hermann Vosseler
Date: 30 Apr 2002 22:02:50
Message: <3CCF4A9F.70909@web.de>
Vic wrote:
 > I've made a new Stereo.inc include file to support stereoscopic
 > windows.
 >
 > This perspective camera seems to work correctly with POV-Ray for
 > Windows RC2.
 >
 > Harolddd: Please try this one. Hermann: How did you calculate the
 > camera matrix in StereoPov?
 >
 > Every comments are welcome.
 >
 > - Vic -
 >

Vic,

below is the relevant section of the StereoPOV source code.
I edited it and removed all internal implementation details.
So, what you see is rather C-like pseudo code :-;

This section of code is called for every pixel. At this point,
the camera vectors are allredy set up; all transformations
are aplied while parsing the scene code.
(Btw: if Stereo_base is defined negative, you will get a cross-eyed
stereo pair, that can be converted to *.JPS or *.PNS directly).


Bottom line is: StereoPOV does the same your include file does.

hope this helps.





------------------------------------------------------------------
   /* Just some shortcuts. */

#define FCD Frame.Camera->Direction
#define FCR Frame.Camera->Right
#define FCU Frame.Camera->Up
#define FCL Frame.Camera->Location



   /* Precompute some constants for stereoscopy */

       Stereo_shift = VNormalize(FCR);
       Stereo_shift = Stereo_shift *  0.5 * Frame.Camera->Stereo_base;





   /* Convert the x coordinate to be a DBL from -0.5 to 0.5. */

   x0 = x / Frame.Screen_Width - 0.5;

   /* Convert the y coordinate to be a DBL from -0.5 to 0.5. */

   y0 = ((Frame.Screen_Height - 1) - y) / Frame.Screen_Height - 0.5;



       /* Create primary ray. */

          cam_Ll =  1.0 * FCL  - Stereo_shift;
          cam_Lr =  1.0 * FCL  + Stereo_shift;
          cam_Dl =  1.0 * FCD  + Stereo_shift;
          cam_Dr =  1.0 * FCD  - Stereo_shift;


         if (right_image)
         { /* right view */
           Ray->Initial   =  cam_Lr;
           Ray->Direction =  cam_Dr  +  x0 * FCR  +  y0 * FCU;
         }
         else
         { /* left view */
           Ray->Initial   =  cam_Ll;
           Ray->Direction =  cam_Dl  +  x0 * FCR  +  y0 * FCU;
         }


Post a reply to this message

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