Re: [info-performer] Creating stereo

Date view Thread view Subject view Author view

From: Dan Johnston (dan.johnston++at++nrc.ca)
Date: 07/07/2003 07:31:45


Foo Meng & Kay wrote:

> Hi Performer Users,
>
> I am a newbie and my project requires me to create stereo
> visualisation....in Performer as well as in OpenInventor......Can anyone
> tell me how to create a real time stereo visualisation of terrain....in
> interlaced format? or at least point me to some simple algorithms that I can
> start off with....
>
> Steven
>

First lets talk about "stereo visuals" since you will need to use a compatible
visual for both the Inventor and Performer solutions. You must be using a
'stereo visual' to see stereo (3D) using any of the common 3D display modes
(except the red/blue format). On an SGI you switch to this mode using one
of a variety of tools. On O2s and Octane you would probably use the 'xscreen'
utility. On larger Onyx class machines you would select 'ircombine' (root
access needed to save changes). You can use a shell command like
'/usr/gfx/setmon -n 1024x768_96s' to switch most SGIs into a stereo
visual, but you must check the list of available visual formats for your
own machine - and select a format that your hardware and monitor
can handle.

On a PC (Windows) you use the display option in the control panel to
select a stereo visual - assuming you have a 3D compatible graphics
board installed and an up-to-date driver for that board.

Now to get the software to work..

Open Inventor has stereo capability built into the main viewing window.
Just select 'preferences' (right mouse button click in my version) and
you get a dialog that will allow you to show the model in 3D. You will
have several 3D display options to select from in the latest versions of
Open Inventor.

Performer gives you more exact control over the stereo viewing but will
require more work on your part. Look as the source code provided by
SGI with Performer. The file /usr/share/Performer/src/pguide/libpf/C/stereo.c
will show the basic technique. Also look as the sources for
/usr/share/Performer/src/lib/libpfx/pfViewer.C (if you base you code on
this library then you will already have the ability to view in 3D). There
are many other toolkits available from the net to provide 3D viewing,
display system independance, interactive hardware support, etc. to
Performer (including one I wrote myself! - pfAPC).

The essence (for quad buffered stereo) is that you render stereo by
drawing the view for each eye into two Performer channels. You can set
a shared viewpoint for the left and right eye channels, and still have full
control over the eye-to-eye separation, the eye view angle, and the
off-angle view frustum for each eye channel. These two different
pfChannels are written into different buffers by the draw routine,
so you MUST provide a draw callback to identify which channel is
now 'drawing' (either with a per-channel data flag as in the stereo.c
code or with a different callback for each channel). Select the
BACK_RIGHT buffer before rendering the right eye channel, and
select BACK_LEFT buffer before rendering the left eye stuff.

Now you should see the models/data displayed in 3D.

Good luck!

--
      ___|__    |
      /  |  \   ||\      Daniel (Dan) Johnston
     /___|___\  || \     Dan.Johnston++at++nrc.gc.ca
    _____|____  ||  \    National Research Council of Canada, London, ON
    |    |    | ||   \   Integrated Manufacturing Technologies Institute
\___|    |    | ||____\  Tel: (519) 430-7081   Fax: (519) 430-7090
 \_o_\___|____|_|______\_    Inst: http://www.nrc.gc.ca/imti
  \                o /    These opinions are my own! Not those of NRC.
   \________________/    Virtual Reality:
                        http://www.nrc.ca/imti/vetc/home.html
 More Tall Ships - Fewer Computers!


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Mon Jul 07 2003 - 07:34:30 PDT