Descriptions and Examples for the POV-Ray Raytracer by Friedrich A. Lohmüller
Stereo Images and Stereo Animations with POV-Ray
Deutsch Deutsch
Italiano Italiano
Français franšais

Home
- POV-Ray Tutorial

  Stereo Images and
  Stereo Animations
    Index

    Cross-Eye View
    Stereo Image simple
 > Stereo Image advanced
    Combining Image Pairs
    Stereo Animations 1
    Stereo Animations 2
    Examples Stereo Ani
 
                                                 
Stereo Image advanced

Stereo with
free camera view in every direction

Also here we define a value for Eyes_Distance.
  For a free stereo camera view, we need to asure that the "eyes" are always moved in +/- Eyes_Distance/2,
right and left from non-stereo camera location,
horizontally perpendicular to the looking direction of the camera.
Attention: Don't look vertically with the camera!
   Don't put 'location' right over or below 'look_at'!
   In such positions the calculations are failing here!.
We want to have on single file that allows to render a scene as well as in non-stereo mode as in right or left eye stereo mode.
We need an short additional ini file to start rendering of the according stereo image pair.
The frame numbering of this ini-file is
        1 for the right eye view
    and 2 for the left eye view.
 The scene file we name "Stereo_Image_.pov"
For stereo view we add the following lines:
// stereo view:
#declare Eye_Distance =
    pow( -1, frame_number ) * 0.4;
  // pow( -1, frame_number ) =
  //   "-1" for left eye's view ,
  //   "+1" for right eye's view;
// stereo starts: frame_number = 1
// odd frame numbers 1, 3, 5, ... = right
// even frame number 2, 4, 6, ... = left

// non-stereo view (frame_number = 0 )
#if( frame_number = 0 )
#declare Eye_Distance = 0;
#end //---------------------------------
//--------------------------------------
#declare Camera_Position=<2.5,3.5,-1.5>;
#declare Camera_Look_At  = <0,1.5,0>;
#declare Camera_Angle    =  65 ;
//--------------------------------------
camera{
  location Camera_Position
    + Eye_Distance/2
    * vnormalize(
        vcross(
         Camera_Look_At-Camera_Position,
         <0,1,0>
        )// vcross
      )// vnormalize
  right    x*image_width/image_height
  angle    Camera_Angle
  look_at  Camera_Look_At
} // end camera
 The according stereo ini file we name Stereo_Image_.ini:
; POV-Ray version 3.6 / 3.7
; Stereo Animation ini sample file.
Antialias=On
Antialias_Threshold=0.3
Antialias_Depth=3

Input_File_Name=Stereo_Image_.pov

Initial_Frame=1
Final_Frame=2

Initial_Clock=0
Final_Clock=1
Cyclic_Animation=on
Pause_when_Done=off
  For a quadratic rendering, we put in the command line:
" +w240 +h240 ".
With POV-Ray 3.7 we can use the jpeg output by
" +w240 +h240 +fj100 ".

free camera stereo view
The situation for a free moving camera view
Non-stereo camera location (violet) and
the right and left eye positions (orange + red),
horizontally perpendicular to the direction from
the camera location to the look_at point.



POV-Ray 3.6/3.7 scene file:
Stereo_Image_.pov
POV-Ray 3.6/3.7 stereo ini file:
Stereo_Image_.ini


command line
The command line.



If we render the scene file "Stereo_Image_.pov" in POV-Ray editor we will get this:
non-stereo image
The scene in non-stereo.







If we run the ini file "Stereo_Image_.ini" in POV-Ray editor we will get the following two images:

image of the right eye's view
Looking with the right eye.
image of the left eye's view
Looking with the left eye.




top

© Friedrich A. Lohmüller, 2013
www.f-lohmueller.de