PDA

View Full Version : Starting stereo III



bsperlin
03-07-2001, 10:39 AM
Continuing my adventures, I now have stereo working! 3DLabs initial advice was that Win98 would work with their VX-1 stereo bundle, but, after a note that it didn't, they wrote that it actually only works with W2K and NT. After a W2K installation, the stereo works and I was able to write a VC++6.0 console app.
Next question: When I write to the back-left buffer the picture appears to the right of center. Are the names back-left and back-right named from the object's perspective, facing you?
Barry

JoeMac
03-07-2001, 11:43 AM
Hi Barry,
Welcome back. http://www.opengl.org/discussion_boards/ubb/smile.gif I'm glad someone else is also trying to push the stereo buffer. (pun intended).
With stereo enabled in perspective mode, the actaul left right location should depend on the depth (Z) that you specify for that object. The object shown to the left eye (Lbuffer) will also be in a different location than the object shown to the right eye (Rbuffer). the difference between the two will cause the eyes to merge or diverge to see the two objects as one. This is what gives the illusion of depth. I'm embarassed that I can't remember my terminology at the moment, but I believe ther appearance of 'popping out' of the screen (eyes crossed) is called positive parallax, and 'going into the screen is negative parallax. Your driver should have setting for the default point of convergence, the depth (Z) at which both objects render to the same location and appear 'on' the screen (monitor).
This description may have been way beneath what you were asking, if so I apologize. I don't want to insult the only other person interested in keeping this triliogy alive. http://www.opengl.org/discussion_boards/ubb/smile.gif
Joe

Rob
03-07-2001, 01:52 PM
My understanding is that the names of the buffers are only important for synching up with the shutter glasses. You should manually set the perspective matrix for each one.
You might want to take a look at this webpage: http://astronomy.swin.edu.au/pbourke/stereographics/
and particularly this article: http://astronomy.swin.edu.au/pbourke/stereographics/stereorender/
That article discusses a common quick-and-dirty stereo hack (what he calls the "toe-in method") and contrasts it with the correct way to set up the perspective for each eye.

The trick to doing this right is to set up an off-axis view frustum for each eye. My code for the left eye looks something like this:

glDrawBuffer(GL_BACK_LEFT);

glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glFrustum((-left_eye[0] - monitor_width/2.0)/2.0,
(-left_eye[0] + monitor_width/2.0)/2.0, // left, right
(-left_eye[1] - monitor_height/2.0)/2.0,
(-left_eye[1] + monitor_height/2.0)/2.0, // bottom, top
left_eye[2]/2.0, left_eye[2] + box_depth*4); // front, back (*4 just for good measure)
glTranslatef(-left_eye[0], -left_eye[1], -left_eye[2]);

I'm not guaranteeing that this is the most elegant way to do it, but it does give the correct results.

I should note that I use this code with a head tracker that I callibrate for use with my monitor, hence the variables for monitor characteristics.

A different, but similar approach using glFrustum and gluLookat can be found here: http://astronomy.swin.edu.au/pbourke/opengl/stereogl/

Phew. That's probably more information than anyone wanted or needed. I hope some of it helps.


[This message has been edited by Rob (edited 03-07-2001).]

[This message has been edited by Rob (edited 03-07-2001).]

bsperlin
03-12-2001, 05:42 AM
Thanks for the replies! I found the answer to my question in Bob Akka's essay on "Writing Stereoscopic Software ..." at www.stereographics.com/html/pcsdk.htm (http://www.stereographics.com/html/pcsdk.htm)
In his section 5 he explains with text and graphics that a negative parallax situation will have the left and right images reversed ( left on the right ) and a positive parallax situation has them in the same order ( left on the left ). Figure 2 is a good picture of this. ( images with negative parallax appear in front of the display plane, positive behind ).
I'm sure I'll have another question soon. Thanks, again, for the comments!
Barry