noeol.de

Sebastian Schneider
Berlin, Germany
 

[noeol]
stands for no end of line
Update: 13. Jun. 2013

Stereoscopic Rendering in Blender 2.6

How to implement an off-axis camera to produce correct stereo pairs via Python Add-on in Blender

Since there is no stereoscopic camera in Blender, I decided to write a python script to implement an 'Off-Axis' stereo camera. This script sets the 'Stereo Window' or zero parallax in Blender and not via postproduction. It creates a parallel off-axis camera rig, the best way to produce stereo pairs without vertical parallax. You can use Blenders Node Editor to control the left and right camera render results and combine them to a Side-by-Side, Interlaced or Anaglyph image.

Download:

Download Version 1.6.8 (13. Jun. 2013)
Python script 57KB for Blender 2.6.7
Special thanks goes to Björn
Version 1.6.8 updates:
1) Bugfix Node-Editor

Download Version 1.6.7 (02. Apr. 2012)
Python script 57KB for Blender <= 2.6.6
Version 1.6.7 updates:
1) Interlaced (Left Field First) output as new node preset for the compositor
2) Selecting the right camera view for each Render-Layer in the compositor is not necessary anymore
3) Adding objects in the main scene needs no manual linking to the left- and right-scene anymore

Video tutorial (youtube.com)

Extra video:
How to render a stereo Side-by-Side animation (youtube.com)

Camera Types:

The Add-on provides all three stereoscopic camera types. The 'Off-Axis' rig is set as default, because of its best results. The 'Converge' (or Toe-In) Camera rig is only useful if you have to match 'real-stereo-camera' material due to its tendency to produce vertical parallax. The 'Parallel' Camera produces always negative parallax, which means that all objects appearing later in front of the screen and you have to set the zero parallax manually. Recommendation: If you want to do some good and easy to fuse stereo pairs, use the default Off-Axis Camera rig only.

Note: to re-calculate the shift of the Off-Axis Camera, click the 'Set Stereo Camera' button
1) if you change the render resolution
2) if you change the camera angle
3) if you change any stereo parameter

(if the output is a Side-by-Side: delete the nodes and click 'Add-Nodes' again to get the new size too)

Mathematics:

For those who are interested in off-axis calculation and how to build the 'stereo comfort zone', here are some formulas.

1. Calculating off-axis shift (delta) in pixel:

b = stereo base (horiz. separation of left and right camera)
w = render width in pixel
f0 = focal distance to zero parallax (stereo window)
FoV = horiz. Field of View (camera angle)

2) Calculating max. disparity (disp) in pixel at near- and far-plane (simple sine rule):

theta = max. parallax angle, given by the user (default 1.0°)
vdist = distance between viewer and projection screen
ppi = Pixel Per Inch of the projection screen

3) Calculating distance (pdist) to near- and far-plane to get the 'stereo comfort zone':

b = stereo base (horiz. separation of left and right camera)
delta = off-axis shift of the first formular in pixel
disp = max. disparity at near- and far-plane (2nd formular) in pixel (disp is for Nearplane '+' and for Farplane '-')
FoV = horiz. Field of View (camera angle)

4) Calculating the 'Toe-In' angle in degree for the converge camera rig:

b = stereo base (horiz. separation of left and right camera)
f0 = focal distance to zero parallax (stereo window)

 
Update: 24. Sep. 2010

Stereoscopic Rendering in Blender 2.49

How to implement an off-axis camera to produce correct stereo pairs in good old Blender 2.49

There are actually three old scripts for Blender 2.49b. The first verison (see screenshot below) is not that easy to use but gives the best results. The alternative script 0.4 changes the 'shiftX' camera parameter to set the 'Stereo Window' in Blender. This script is much more comfortable to use. Unfortunately the 'shiftX' parameter in Blender 2.49 only accept values between -2.00 and 2.00 (with only two decimals), but the script calculates the shift in pixel and a relative value with six decimals, which is more accurate. Due to this mismatch the result will never be perfect. The third script adds a simple 'Toe-In' Camera Rig (Note: 'Toe-In' produces vertical parallax).

Download:

1) Python Script for Blender 2.49 (best results)
Download: BStereoOffAxisCamera_1_5.py
Watch: Video Tutorial (Vers. 1.3)

2) ShiftX Version (more comfortable to use)
Download: BStereoOffAxisCamera_0_4.py
Watch: Video Tutorial (Vers. 0.3)

3) Simple 'Toe-In' Version
toein_stereo_camera_249.py

Example:

Different Camera Separation (Stereo Base) with same Focal Distance: