Copy of Stereo Rendering


Stereo Rendering
Daniel Wexler, Gelato Developer, June 2006

Gelato can render stereo images directly using simple camera settings accessible from Mango. Multiple camera rendering only shades objects for the primary camera, but then can quickly recompute the visibility for separate camera positions, in this case, the left and right eyes. Sharing the shading in stereo renderings can speed up rendering significantly compared to rendering each eye in a separate pass.

The parameters stereo:separation, stereo:convergence, and stereo:projection control the stereo camera setup. An additional parameter, stereo:shade determines which camera will be used for dicing and shading. The default, "center" camera will create an invisible third camera in the center of the two rendering cameras for shading. See section 4.1 in the Gelato Technical Reference for more details.

Gelato supports three different stereo camera projections: "parallel", "off-axis" and "toe-in". These parameters can be set in Mango using the Projection field in the Stereo Rendering section of the Gelato render globals. The parallel projection offsets cameras from the center line by the eye separation distance and then keeps their viewing axes parallel. The projection planes in a parallel projection align, but are shifted horizontally. The toe-in method, offsets the cameras from the center line and then angles them inward to point along the original central axis. The toe-in method has projection planes that do not align, which can make it difficult to converge at the edges of the screen. The off-axis method is similar, but better than the toe-in method because it shears the projection planes of both cameras so that they align.

Gelato 2.0 only supported the toe-in and parallel projections. The stereo:convergence parameter selected between the two projections with zero implying a parallel projection. Version 2.1 introduces the stereo:projection Camera parameter which allows you to choose between all three projection modes explicitly.


Looking at the above anaglyphs through red-blue stereo glasses (blue on right) shows three inset rectangular shapes at depths 20, 30 and 40 from the camera location. The eye separation is one unit and the focal distance is 30 units, which should make the middle object in focus (no separation). The off-axis image clearly shows that the middle object is in focus -- there is no difference between the red and blue images at that point. Notice that the red and blue offsets are switched for the object in front and the object behind the focal plane. Also notice that the horizontal edges in the toe-in mode are not parallel with the screen due to the rotation of the projection plane.

Many people are able to converge all the images, but the parallel and toe-in images tend to have slight ringing artifacts and are clearly much more difficult to converge. Surprisingly, all three images show the same image depths for each object.

The Gelato image viewer, iv also has improved anaglyph viewing in the 2.1 release. The old anaglyph mode used the "Photoshop" technique, which colors one eye as red and the other as cyan, resulting in gray in the overlap regions. This method of generating anaglyph images has no color reproduction at all. The improved method uses a contrast weighting of the left and right eye input colors to produce a red-cyan anaglyph with reasonable color reproduction. It is best viewed through red-cyan filters, but red-blue filters also work fine.

The colors are not good, but yellow, green and blue work moderately well. The colored squares in the following image are shown with both the old, Photoshop-style and the new NCSU algorithm.

Photoshop (old)
NCSU (new)

Please see Paul Bourke's excellent website for more theory, background and usable code for all sorts of stereo topics. The NCSU Stereo Computer Graphics page is another fine resource, especially for anaglyph rendering techniques. We used the Least Squares Approximation method for computing the anaglyph matrices as specified by David McAllister from NC State.