Stereo Camera

camera types

This POV-Ray Patch defines five camera types able to create stereoscopic images. The last two camera types in this list beeing new additions.

Default POV-Ray camera perspective
Orthogonal projection orthogonal
Fisheye lens fisheye
Stereo Panoramic camera cylinder 5
Spherical Wide Angle camera ultra_wide_angle 2

stereo camera test scene

Describing various camera types soon can get confusing, with all the differing imaging properties and several interdependencies between parameters involved. You should have a look on the page dedicated to my camera test scene, which includes a lot of sample images. I created this camera test scene, to be able to precisely check the working of the code and to adjust some properties of the newly developed Spherical Wide Angle camera. You may download the scene file as well.

Image Size and Stereoscopic Window

Much in contrary to common (flat) images, stereoscopic images are dedicated always to a fixed image size. Arbitrary scaling will result in a loss of depth impression, thus degrading the image quality to some extent. To be more specific: An image optimally suited for presentation (maybe as anaglyphes) on a 17 inch computer monitor, will show up with unnaturally exaggerated depth on the IMAX screen, causing eye strain and headache or even falling apart. On the contrary, when our image has been targeted to a slide projection screen of 4 m width, it will give an almost flat impression (as if beeing made out of paper) when viewed on home projection screen or monitor. This effect may be ameliorated partially by readjusting the stereoscopic pair, but you won't get optimal results this way. To put it short, stereoscopic images always have to be composed with a certain window size and -location in mind.

Thus all stereoscopic camera types built into StereoPOV were designed to behave consistently with respect to image size and location of the Stereoscopic Window. They adhere to the following general window rule: The "up" and "right" vectores not only define the aspect ratio of the image, they also define the dimensions of the resulting Stereoscopic Window measured in model units (POV-Ray scene units). And the "direction" vector not only defines the effective viewing angle, it at the same time defines the optimal viewing distance for stereoscopic slide projection or monitor presentation (again measured in POV-Ray units).

The following example will illustrate this principle:
Let one POV-Ray unit be interpreted as 1 m. Assumed further, the image is designed for presentation on 1.80 m projection screen (this size is known to be well suited for small audiences like stereoscopic camera clubs or meetings of some society and the like). Then the camera can be defined as

camera{ location <0,0,0>
        direction z * 1.76
        right x * 1.8
        up x * 1.8 * 2/3    // aspect ratio 3:2
        stereo_base 0.065  //  avg human eye speparation
        translate <....>
        look_at <....>

This will yield a moderate wide angle view (55 deg), corresponding to f=35mm for photograpic cameras (KB). This definition further tells us, the stereoscopic window will be found at 1.76m distance from assumed camera location, and this means we may start placing the nearest objects at this distance. (We indeed should start at this distance and group the main objects of the scene near by, in order to achieve a good impression of depth). Of course we can leave out the "direction" vector and specify "angle 90" instead. StereoPOV will then derive the direction=1.76m. The down side of the latter approach is: as the "direction" vector is computed internally, we don't know its exact length. Specifying the "direction" vector explicitly gives exact control of where the stereoscopic window will be.

In case of the non-planar camera types (panoramic and fisheye types) the "direction" vector defines the radius of the image cylinder or sphere as well. But the size of the stereoscopic window at the same time is defined with respect to the planar image »rolled off« the cylinder or sphere.

explanations and hints on setting up the stereo camera

Based on this principles, StereoPOV implements some features to aid setting up stereoscopic cameras or to help adapting at given scenes. Additionally, before start of rendering, the camera parameters to be used are printed, so you can see what actually is going on:

  Tracing Options
    Quality:  9
    Bounding boxes.......On  Bounding threshold: 3 
    Light Buffer.........On  Vista Buffer........Off
    Antialiasing.........On  (Method 2, Threshold 0.150, Depth 4, Jitter 0.10)
    STEREO-tracing.......On  (using StereoCache tolerance 1.00 )
  |                                             |
  | Stereoscopic Camera:                        |
  |      base   = -0.065                        |
  |      window = 1.76                          |
  |      width  = 1.8                           |
  |        ..... switching to STEREO-trace-mode |

All stereoscopic camera types start out with a window of the dimensions given by up and right and located at a distance given by the direction vector. (so called «natural window» of the camera). StereoPOV always uses the bare numbers given and never attempts to apply or transform units of measurement. As a consequence, the effective units of measurement are those, you are using conceptually, so you should be consequent in this respect.

In order to achieve good image composition, I saw people taking two very different approaches. One possibility could be, to arrange and organize objects near the stereoscopic window in a tastefull manner. The window_distance parameter is intended to support this approach. A good starting point is to use the distance of the nearest object as window_distance, thus placing this object in the window plane. Another possible aproach is to stick to dimensions and proportions of the real world, using real world measurements as far as possible. In a consequence, for this approach you define the stereoscopic base to be the average human eye separation (65mm) and you define the direction, up and right vectors of the camera so to match the desired presentation situation (screen size, intended optimal distance to viewer). A rather common example for this approach has been given above.
(Hint: set up the camera at origin and then apply a series of rotations and translations to place the camera as appropriate)

Notes on non-standard Camera Types

With Orthogonal camera, the visual depth extension of a given object has a fixed value, independent of the object's distance to the camera. As this doesn't correspond to any real life visual experience, objects will seem to be distorted in depth direction when viewed stereoscopically. Another consequence of this is, that you can't fuse the half images of objects far off, because they are to far apart. Bottom line is, you can use this projection type only for objects near to the image plane, i.e. the stereoscopic window.
(Limit in depth direction is two times the length of the "direction" vector, or the window_distance, if specifyed)

POV-Ray's Fisheye camera creates an image utilizing spherical coordinates commonly used in mathematics. This implies, that corresponding image elements don't nessesarily appear at the same height (y) in both half images. (i.e. "height errors"). The resulting image will cause eye strain; only a small region near the center of the image is usable, if at all. To cope with this problem, I let the stereo-effect drop off to zero with increasing angle, so that beyond ±90° the output will be mono (flat). An additional adjustment factor was added to make the flat image region and the circular image border apear in the stereoscopic window plane. So the image »opens to depth« in the middle, as if it was a cave.
You should consider this implementation as an experimental feature,
I hope, it's of some use. (Note that StereoCache is disabled for Fisheye.)

Stereo Panoramic camera is inspired by some real world panoramic camera constructions where the whole optical system turnes round at exposure time. Here this means, that the stereoscopic baseline (the line connecting the two centres of projection) is turned as well, thus being oriented optimally for every direction. This yields a constant depth impression over the whole image angle up to 360° and more. On the contrary, in vertical direction this cylindric projection can be compared with the normal perspective camera, including the well known degeneration problem produced by perspective camera, when the (here: vertical) image angle gets too large. Like all the other stereoscopic cameras in this patch, the stereo panoramic camera adheres to the rule, that the "right" vector corresponds to the width of the final image created (measured in POV-Ray units). Now, as the image is gained by rolling it off the image cylinder, and the radius of this image cylinder is defined by the "direction" vector of the camera definition, the (direction,right)-Pair alredy completely defines the image angle. (If, on the other hand, an angle value is given, the length of the "direction" vector can be derived). At the same time, via the right/up ratio, the vertical image angle is completely defined, as the stereo panoramic camera always uses the same scale factor in vertical and horzontal direction (i.e. respects the given aspect ratio). This behaviour of the "direction", "right" and "up" vectors differs from the one of the "cylinder" camera types alredy build into POV-Ray. (And for this reason I introduced a new cylinder camera type 5 instead of making cylinder 1 stereoscopic). As a practical consequence, if you chose an aspect ratio differing from quadratic image, the vertical image angle is adjusted to accomodate as well. You should play around a bit with this behaviour to get a feeling how it works. It may seem strange at a first glance, but it produces more consistent results with respect to the placement of the stereoscopic window for all camera types.

My newly developed Spherical Wide Angle Camera (ultra_wide_angle 2) adheres to the same rule. "direction" gives the radius of the image sphere, "right" the width of the final planar image »rolled off« the sphere, image angle and placement of stereoscopic window will be derived to fit. Or, if you give an angle value, the "direction" will be adjusted to accomodate.

The chosen type of projection differes significantly form Dan Farmer's ultra wide angle camera (ultra_wide_angle 1). The latter beeing a fisheye projection sort of "streched out diagonally" in order to fill an rectangular image area. This would result in the same problems with stereoscopy encountered by the fisheye camerea itself. My spherical wide angle camera (ultra_wide_angle 2) on the contrary always retains the same height for corresponding image elements in both half images. This is achieved by rather »rolling off« the image. To be more precise, to a given viewing ray, the image sphere is first rolled up or down (vertically), starting from the center of the image region, and then rolled horizontally to achieve the position of the resulting pixel. Now, as the circumference of a sphere gets smaller and smaller as we aproach the poles, this causes vertical lines to "fall" towards the (vertical) middle axis of the image. On a pure empirical base (having a lot of experience in drawing and painting views with spherical or fisheye type perspectives), I introduced a variable horizontal stretch/correction factor and accomodated the stereoscopic imaging accordingly. This gives the vertical lines a more soft slope near the aequator. The price to pay for this is a rather sudden turn of the vertical lines towards converging to the poles at greater vertical angles.

Similar to the stereo panoramic camera, the stereoscopic baseline is turned round, (oriented towards the ray currently to be traced), thus yielding a constant depth impression over the whole image area.

this in 3D

At the usual image angles, the whole rectangular image area is covered. But enlarging this image area while keeping the radius of the sphere ("direction" vector) constant, at some point the curved border lines of the projection will show up. This "onion shaped" border lines go curved in depth direction as well, running from pole to pole, i.e. form infinity up above to infinity down below.

StereoPOV by Ichthyostega Hermann Vosseler home images usage download