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 Animations (1)

How to make
A Serie of Stereo Images for an Animation.

1.1: Making a POV-Ray Stereo Scene File
               like shown in Stereo Image advanced.
There we use 'frame_number' to control right/left eye view:
    odd frame numbers 1, 3, 5, ... = right eyes view,
    even frame numbers 2, 4, 6, ... = left eyes view,
frame_number 0 = non-stereo view for testing the scene.
For an animation of e.g. 30 frames,
we have to render 2*30=60 frames!
Animation with 'clock' and 'frame_number':
  1. frame_number based animation control:
Here we need to use a new frame number named Frame.
For even frame numbers:
       #declare Frame = int( frame_number/2 );
else #declare Frame = int((frame_number+1)/2);
and as new final frame number:
       #declare EndFrame = final_frame/2;
  2. clock based animation control:
Here we need to use clock_delta
to adapt the internal 'Time' to the 'clock' values!
(built-in clock_delta = difference between clock values)
With i.e. Initial_Clock=0, Final_Clock=1,
          Initial_Frame=1 and Final_Frame=60,
we use for odd frame_numbers:
       #declare Time = clock ;

     and for even frame_numbers:
       #declare Time = clock - clock_delta;


In a POV-Ray scene file Stereo_Ani_00_.pov
we declare a stereo camera as follows:
(For details see the scene file here right !!! )
// -------------------- // stereo view:
#declare Stereo_On = 1;
#if( Stereo_On = 1 )
 #declare Eye_Distance = 0.4;
 // Stereo Animations frame counting:
 // stereo starts: frame_number = 1
 // odd frame numbers 1,3,5,... = right
 // even frame number 2,4,6,... = left
 // stereo: frame 1~60 -> frame pair = 1~30!
 #if((frame_number/2)!=int(frame_number/2))
      // odd frame_number
  #declare Eye_Distance = -Eye_Distance;
  #declare Time  = clock  ;
  #declare Frame = (frame_number+1)/2 ;
 #else // even frame_number
  #declare Eye_Distance =  Eye_Distance;
  #declare Time  = clock - clock_delta ;
  #declare Frame = (frame_number  )/2 ;
 #end
 #declare EndFrame =  final_frame/2;

#else // Stereo_On = 0
 #declare Eye_Distance = 0;
 #declare Time     = clock +0.0 ;
 #declare Frame    = frame_number  ;
 #declare EndFrame = final_frame ;
#end // of "#if( Stereo_On = 1 ) "
//------------------------------------------
#declare Camera_Position= < 0.0, 2.0,-4.0>;
#declare Camera_Look_At = < 0.0, 2.0, 0.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
// .... lights and background ...
// .... and an object in scene:
object{
  Wire_Box(<-1,-1,-1>,<1,1,1>,0.1,0)
  texture{pigment{color rgb<1,1,1>*1.2}}
  #if(frame_number != 0)// stereo
       rotate<0, Time*90 ,0>
     // or optional:
    // rotate<0,(Frame-1)/EndFrame*90,0>
  #end
  translate<0,2.0,0>
} // ---------------------------------------
  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 ".

command line
The command line.
image for image_map
The situation for a free moving camera:
non-stereo camera location (violet),
right and left eye positions (yellow/red),
free moving look_at point (yellowgreen).













POV-Ray 3.6 / 3.7
Stereo scene file: Stereo_Ani_00_.pov
Stereo Animation ini file: Stereo_Ani_00_.ini




non-stereo image
The scene in non-stereo.
Rendered with the scene file.
Without runing an ini file, default frame_number is 0.
So the Half_Eye_Distance is 0 and scene rendering
shows a non-stereo view.
1.2: Making a Stereo Animation ini File
              File name: Stereo_Ani_00_.ini:
Antialias=On
Antialias_Threshold=0.3
Antialias_Depth=3
Input_File_Name=Stereo_Ani_00_.pov
Initial_Frame=1
Final_Frame=60
; 1~60 for 30 images
Initial_Clock=0
Final_Clock=1
Cyclic_Animation=on
Pause_when_Done=off
Note: frame_number 0 is reserved for non-stereo view!
Running this file
makes a serie of 30 stereo image pairs:
    30 right eye views: numbered 01,03,05,...,29
and 30 left eye views: numbered 02,04,06,...,30.

POV-Ray 3.6 / 3.7
Stereo scene file: Stereo_Ani_00_.pov
Stereo Animation ini file: Stereo_Ani_00_.ini
image of the right eye's view
Looking with the right eye.
Stereo_Ani_00_01.jpg
image of the left eye's view
Looking with the left eye.
Stereo_Ani_00_02.jpg

Continue with 2.1: Stereo Animation (2)
top

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