POV - stereo pictures

OK let's go. Some explanations about my way for making stereographics pictures. (Sorry, my english is very bad.) Our mission is to make a stereo picture. For clarity, here is a stripped down version of the real thing.

Source files

things.inc

In this file, we describe all the moving objects for our scene. For dynamic animations and nice moving objects, we use the predefined clock variable from POV SDL. The value of this variable is set from the povray command line with the flag +Kvalue.

#declare boxen = object
{
difference {
        box { <-20, -20, -20>, <20, 20, 20> }
        merge   {
                box { <-17, -18, -21>, <17, 18, 21> }
                box { <-21, -18.001, -17>, <21, 18.001, 17> }
                }
        }
rotate y*clock
pigment { color White }
}

world.inc

This file contains statics element for our pictures: background, lights, and also a parametric camera: the X position is driven by a variable.

object { boxen }

camera  {
        location        <X_CAM, 25, -72>
        look_at         <0, 1.5, 0>
        angle           69
        }

light_source { <-40, 15, 30> color White }
light_source { <-40, 35, -80> color White }

vleft.pov & vright.pov

And now, the two main views source code: one for left, one for right.

#include  "colors.inc"
#include  "things.inc"
#declare  X_CAM = -3;
#include  "world.inc"

The only difference is the value of X_CAM, who is -3 for one picture, and +3 for the other.

Build the final picture

After rendering, we have two RGB pictures: one is a view from the left eye, second is a view from the right one. They look like that:

view for left eyes view for right eyes

For combining our two pictures, I use a homebrew C function, (tarball, file is stereo.c). There was also a command-line utility (tga_combine, tarball) who use this function. Look at the makefile for the syntax.


Source code is available here.