next up previous contents
Next: 4.2 Depth of Field Up: 4.1 Stereo Viewing Previous: 4.1.1 Fusion Distance

4.1.2 Computing the Transforms

The transformations needed for correct stereo viewing are simple translations and off-axis projections [22]. Computationally, the stereo viewing transforms happen last, after the viewing transform has been applied to put the viewer at the origin. Since the matrix order is the reverse of the order of operations, the viewing matrices should be applied to the modelview matrix first.

The order of matrix operations should be:

1.
Transform from viewer position to left eye view.
2.
Apply viewing operation to get to viewer position (gluLookAt() or equivalent).
3.
Apply modeling operations.
4.
Change buffers, repeat for right eye.

Assuming that the identity matrix is on the modelview stack and that we want to look at the origin from a distance of EYE_BACK:

glMatrixMode(GL_MODELVIEW);
glLoadIdentity(); /* the default matrix */
glPushMatrix()
glDrawBuffer(GL_BACK_LEFT)
gluLookAt(-IOD/2.0, 0.0, EYE_BACK,
	  0.0, 0.0, 0.0,
	  0.0, 1.0, 0.0);
<viewing transforms>
<modeling transforms>
draw()
glPopMatrix();
glPushMatrix()
glDrawBuffer(GL_BACK_RIGHT)
gluLookAt(IOD/2.0, 0.0, EYE_BACK,
	  0.0, 0.0, 0.0,
	  0.0, 1.0, 0.0);
<viewing transforms>
<modeling transforms>
draw()
glPopMatrix()

This method of implementing stereo transforms changes the viewing transform directly using a separate call to gluLookAt() for each eye view. Move fusion distance along the viewing direction from the viewer position, and use that point for the center of interest of both eyes. Translate the eye position to the appropriate eye, then render the stereo view for the corresponding buffer. This method is quite simple when real-world measurements are used.

An alternative, but less correct, method of implementing stereo transforms is to translate the views left and right by half of the interocular distance, then rotate by the inverse tangent of the ratio between the fusion distance and half of the interocular distance: $angle = \arctan(\frac{fusion distance}{\frac{IOD}{2}})$With this method, each viewpoint is rotated towards the centerline halfway between the two viewpoints.


next up previous contents
Next: 4.2 Depth of Field Up: 4.1 Stereo Viewing Previous: 4.1.1 Fusion Distance
David Blythe
1999-08-06