Stereo Povray

Home

The Genesis Toolkit

Stereo 3D
 Plascolin
 Jac
 Stereo Povray
 3D Digital Photo
 1954th Stereo Photo
 Slidebar 3D Photo

Linux

Projects

Gallery

Download

Links

Imprint

Email:
Latest update
May 22 2008 10:15:46
countercountercountercountercounter

How to compute Stereo Camera Positions for PovRay


Here's some POV-Ray-code to compute camera positions for stereo images. You can put it instead of your normal camera declaration in the povray scenefile. There are some few values to be adjusted:

ST_Centre: the camera location vector for the center camera. The resulting cameras will be placed to the right and left of this cam.

ST_Lookat: the look_at vector for all three cameras. The resultung (left & right) and the center cam

ST_Base: the stereobase value (distance between both resulting cameras)

Ok here's the code; you can use it insted of the camera in your scene. Just uncommend (//) the line for the right or left camera (depending on which camera you want to render) and you're ready to go...



//***************************************************************************** // Stereo-Camera-Module for POV-Ray ( Joerg Schrammel 2001-11-18 ) // // You have to give origin camera position, look_at position and stereo base. // This module computes ST_Left and ST_Right as camera vectors for the stereo // camera. //============================================================================= #declare ST_Centre = < 740, 3, 50 > ; // -> Camera vector #declare ST_Lookat = < 450, 5, 650> ; // -> Look_at vector #declare ST_Base = 0.1 ; // -> ST_Basis //***************************************************************************** #declare ST_Left = ST_Centre + (ST_Lookat*-1) ; #declare ST_Distance = vlength(ST_Left) ; #declare Hypot = sqrt(ST_Distance*ST_Distance + (ST_Base/2)*(ST_Base/2) ); #declare Alpha = atan2( (ST_Base/2)/ST_Distance ,1 ) ; #declare Alpha = degrees(Alpha) ; #declare ST_Left = vaxis_rotate(ST_Left,<0,1,0>, Alpha ); #declare ST_Right = vaxis_rotate(ST_Left,<0,1,0>, -2*Alpha ); #declare ST_Left = ST_Left * Hypot/ST_Distance; #declare ST_Right = ST_Right * Hypot/ST_Distance; #declare ST_Left = ST_Left + ST_Lookat ; #declare ST_Right = ST_Right + ST_Lookat ; //***************************************************************************** camera{ location ST_Right // location ST_Left direction <0,0,1> up <0,1,0> right <4/3,0,0> look_at ST_Lookat } //*****************************************************************************

Here are some pictures which were created using PovRay and the above code to compute the exact camera positions. You need red-blue-glasses to see them... (click on the thumbnails to enlarge)



Joerg Schrammel - - Duisburg Germany