[NTLUG:Discuss] Stereo Goggles (Was: Wine presentation).

Steve Baker sjbaker1 at airmail.net
Fri Nov 16 22:47:53 CST 2001


Kyle_Davenport at compusa.com wrote:
> 
> > Programmers are *generally* poor at 'artistic' stuff and there are
> > really virtually zero "OpenSource Artists".
> 
> heh!  www.linuxartist.org, www.graphics-muse.com, heroinewarrior.com,
> www.mstation.org, sound.condorow.net,...  someday I'd like to be one.

Well, linuxartist is full of artists who *use* Linux - but they aren't
giving their artwork away for free or joining games teams.  Graphics-muse
seems to be people who basically like to paint or render still images
but who have no interest in working on games.

I don't know the other three...but the the observed fact that 99% of
OpenSource games have crap artwork is a reflection of the true situation.

> > So, Tuxkart has two graphically repetitive levels and two rather cheesy
> levels that
> > I'm not proud of.  Still, it's definitely a fun game - I still enjoy
> playing it.
> > (Especially since I got it to work with a kludged-together pair of stereo
> LCD
> > shutter glasses last weekend!)
> 
> oh boy - the H3D glasses?  Darrell Strauss promised support once, but it
> never happened.  how'd you do it?

Ah!  Yes.

Well, these are indeed the H3D LCD shutter glasses - the ones with the
IR 'pod' that (normally) plugs into the monitor outlet of your graphics
card and tells the glasses which eye should be blanked out and when.

The signal that drives the pod is present on most modern 3D graphics
cards - but none of the available OpenGL drivers seems able to set it.

So, what I did was to carefully measure the various signals and trace
connections and figured out the pinout of the 3 pin connector that goes
off to the pod.  It turns out to have +5v power, Ground and a single
signal wire that you wiggle to make the goggles switch.  On a rising
edge of that signal the left eye shutter goes dark and on the falling
edge, the right shutter goes dark.  The shutter only stays dark for a
short period (maybe 1/60th second) and then goes clear again.

Next, I butchered an old parallel printer cable and connected the GROUND
pin
of the pod to the ground of the printer port and the power and switch pins
to DATA 0 and DATA 1 respectively.

Then I have my 3D game send the binary pattern 00000001 and 00000011 alternately
to the printer port so that DATA 0 powers the pod (fortunately, it takes almost
zero current) and DATA 1 toggles the glasses.

In the program, I render the 3D scene alternately with the eyepoint moved
either slightly to the left or slightly to the right of the "True" position.
I do my SwapBuffers call and then *immediately* toggle the goggles.  You have
to tell your video card to sync to the vertical retrace of the video - which
is done with a shell variable in both Mesa and nVidia OpenGL implementations.

That's not as good as the video hardware does because it's possible
for some other Linux process to steal the CPU between the video vertical
retrace permitting SwapBuffers to return and the instant when I swap the
goggles.

That *does* happen sometimes resulting in a bright flash and momentary
double-imaging about once every minute or so...acceptable for a quick
hack project!

There are other problems with this approach:

  1) Your game has to update the screen at 60Hz pretty solidly or else
     things get badly flickery.  The nVidia solution is to use 'QuadBuffers'
     which solves that - but my games all run at better than 60Hz anyway,
     so I don't care.

  2) You can't use your printer port for printing without unplugging the
     goggles' IR pod.

However, overall, I'd count it a success. With your two eyepoints set a
realistic 3cm apart, there is hardly any stereo effect - but 'cheat' and
move your virtual eyes about 10 to 20cm apart and it looks *AMAZING*. The
image doesn't hover out in front of the screen - but appears to be behind
all of the rest of the screen - like there is a hole cut into the faceplate
of your monitor.

If you move the virtual eyes too far apart, the scene first looks like a
tiny model racetrack - if you move them further apart than that, you can't
really focus your eyes together well and you get a blinding headache after
playing for too long!

Anyway - this isn't good enough for professional use - but it's a LOT of
fun.

If you want to try this, email me offline and I'll give you the code
snippets and the wiring pinout.


----------------------------- Steve Baker -------------------------------
Mail : <sjbaker1 at airmail.net>   WorkMail: <sjbaker at link.com>
URLs : http://www.sjbaker.org
       http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net
       http://prettypoly.sf.net http://freeglut.sf.net
       http://toobular.sf.net   http://lodestone.sf.net




More information about the Discuss mailing list