[comp.sys.sgi] stereo on iris

LACOMB@SIERRA.STANFORD.EDU (Lloyd La Comb) (02/12/88)

I'm having some trouble creating stereo pairs on the Iris.  It seems that all
I should have to do is to change the eye position with polarview() or lookat()
and I should have stereo pairs but that doesn't seem to be happening.  The
following is a short algol-like desription of what I'm doing can anyone out
there see anything that's wrong I imagine it's something obvious.

ginit()
viewport()
perspective()
pushmatrix()
polarview(dist,0,0-offset,twist) nose sitting on z axis, left eye to the left
drawobj()
popmatrix()
polarview(dist,0,0+offset,twist) right eye to the right
drawobj()

I ran the program with several different offsets from 1 to 12 degrees and took
slides for each eye and looked at them in a stereo viewer and threr's is no
3d effect to speak of.  Any suggestions?  Thanks.

						Lloyd La Comb

						lacomb@sierra.stanford.edu
-------

blbates@AERO4.LARC.NASA.GOV (Bates TAD/HRNAB ms294 x2601) (02/12/88)

   Interesting that you should pose that question now, I was just experimenting
with that last week.  Personally, I think lookat() is the best way to do it.
I've got a program that I use to look at 3D grids, it rotates, magnifies,
translates, and changes the perspective.  I modified it slightly so that, in
one buffer the object was drawn in RED with lookat() offset to the right about
1.0 and in the other buffer I draw in BLUE with lookat() offset to the left 
about 1.0.  Then I swap buffers back & forth, and look at the screen with
MAGENTA & CYAN filters.  One thing I notice was that depending on how deep the
object was I needed to adjust the field of view.  With very deep objects, I
needed a narrow view, with shallow objects, I could use a larger view. Usually,
my field of view was less than 20 degrees.  In FORTRAN:

      call getsiz(xlength,ylength)
      .
      .
      .
      totext=max(abs(xmax-xmin),abs(ymax-ymin),abs(zmax-zmin))*1.25
      .
      .
      far=totext*1.5-viewpnt
      if(far.le.0) then
         far=totext*1.0e-4
      endif
      near=-viewpnt
      if(near.ge.far.or.near.le.far*1.0e-3.or.near.le.0) then
         near=far*1.0e-2
      endif
      call perspe(fovy,real(xlength)/real(ylength),near,far)
      if(red) then
         call lookat(viewpnt-totext,xpos-1.0,ypos,viewpnt,xpos,ypos,-900)
      else
         call lookat(viewpnt-totext,xpos+1.0,ypos,viewpnt,xpos,ypos,-900)
      endif

   I adjust xpos & ypos for translations and viewpnt for magnifications.
If you are doing zbuffering near can't be 0.0 or < far*1.0e-3.  The near to far
ratio is not carved in stone, but the 0.0 is.
   I hope this is of some help, if you have any questions just ask.  The RED
and BLUE works ok, but I the stereo viewer would be better.  You might try
my way to test how things look and then get hard copy in the correct colors
for the stereo viewer.
   Good luck.
			     Brent L. Bates