2002-04-24 22:14:37 +08:00
|
|
|
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
2001-12-23 05:35:28 +08:00
|
|
|
<html>
|
|
|
|
<head>
|
2002-04-24 22:14:37 +08:00
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
2002-04-25 21:26:33 +08:00
|
|
|
<meta name="GENERATOR" content="Mozilla/4.77 [en] (X11; U; Linux 2.4.3-20mdk i686) [Netscape]">
|
2002-04-25 18:07:44 +08:00
|
|
|
<title>Native stereo support</title>
|
2001-12-23 05:35:28 +08:00
|
|
|
</head>
|
2002-04-24 22:14:37 +08:00
|
|
|
<body text="#000000" bgcolor="#FFFFFF" link="#0000EE" vlink="#551A8B" alink="#FF0000">
|
|
|
|
<img SRC="images/OpenSceneGraphBanner_Distribution.jpg" height=77 width=640>
|
|
|
|
<table>
|
2002-04-25 21:26:33 +08:00
|
|
|
<tr>
|
|
|
|
<td><a href="index.html">Index</a></td>
|
|
|
|
|
|
|
|
<td><a href="introduction.html">Introduction</a></td>
|
|
|
|
|
|
|
|
<td><a href="contents.html">Contents</a></td>
|
|
|
|
|
|
|
|
<td><a href="install.html">Install</a></td>
|
|
|
|
|
|
|
|
<td><a href="dependencies.html">Dependencies</a></td>
|
|
|
|
|
|
|
|
<td><a href="demos.html">Demos</a></td>
|
|
|
|
|
|
|
|
<td><a href="data.html">Data</a></td>
|
|
|
|
|
|
|
|
<td><a href="sgv.html">Viewer</a></td>
|
|
|
|
|
|
|
|
<td><a href="stereo.html">Stereo</a></td>
|
|
|
|
|
|
|
|
<td><a href="plan.html">Plan</a></td>
|
|
|
|
|
|
|
|
<td><a href="documentation.html">Reference Guides</a></td>
|
|
|
|
</tr>
|
2002-04-24 22:14:37 +08:00
|
|
|
</table>
|
|
|
|
|
2002-04-25 21:26:33 +08:00
|
|
|
<h2>
|
|
|
|
<u>Native Support for Stereo</u></h2>
|
|
|
|
The OSG has support for anaglyphic stereo (i.e. red/green or red/cyan glasses),
|
|
|
|
quad buffered stereo (i.e. active stereo using shutter glasses, or passive
|
|
|
|
stereo using polarized projectors & glasses) and horizontal and vertical
|
|
|
|
split window stereo implementations. Almost all OSG applications have the
|
|
|
|
potential for stereo support simply by setting the relevant environmental
|
|
|
|
variables, or via command line arguments. Little or no code changes will
|
|
|
|
be required, the support is handled transparently inside osgUtil::SceneView's
|
|
|
|
handling of rendering. It is a simple as:
|
|
|
|
<br><b> sgv -stereo cow.osg</b>
|
|
|
|
<p>If the user is planning to use head tracked stereo, or a cave then it
|
|
|
|
is currently recommend to set it up via a VR toolkit such as VRjuggler,
|
|
|
|
in this case refer to the VR toolkits handling of stereo, and keep all
|
|
|
|
the OSG's stereo specific environment variables (below) set to OFF, or
|
|
|
|
set the values to off within own your own applications.
|
|
|
|
<br>
|
2002-04-19 00:40:17 +08:00
|
|
|
<hr>
|
2002-04-25 21:26:33 +08:00
|
|
|
<h3>
|
|
|
|
The environmental variables of interest:</h3>
|
2002-04-19 00:40:17 +08:00
|
|
|
|
|
|
|
<table>
|
2002-04-25 21:26:33 +08:00
|
|
|
<tr>
|
|
|
|
<td><b>OSG_STEREO</b></td>
|
|
|
|
|
|
|
|
<td><b>ON</b></td>
|
|
|
|
|
|
|
|
<td>Turn stereo on </td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td></td>
|
|
|
|
|
|
|
|
<td><b>OFF</b></td>
|
|
|
|
|
|
|
|
<td>Turn stereo off (default). </td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td><b>OSG_STEREO_MODE</b></td>
|
|
|
|
|
|
|
|
<td><b>ANAGLYPHIC</b></td>
|
|
|
|
|
|
|
|
<td>Use anaglyphic stereo when in stereo (default). </td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td></td>
|
|
|
|
|
|
|
|
<td><b>QUAD_BUFFER</b></td>
|
|
|
|
|
|
|
|
<td>Use quad buffered stereo when in stereo. </td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td></td>
|
|
|
|
|
|
|
|
<td><b>HORIZONTAL_SPLIT</b></td>
|
|
|
|
|
|
|
|
<td>Use horizontal split stereo mode when in stereo </td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td></td>
|
|
|
|
|
|
|
|
<td><b>VERTICAL_SPLIT</b></td>
|
|
|
|
|
|
|
|
<td>Use vertical split stereo mode when in stereo </td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td><b>OSG_SCREEN_DISTANCE</b></td>
|
|
|
|
|
|
|
|
<td><b>0.50</b></td>
|
|
|
|
|
|
|
|
<td>Set the distance the viewer is from screen in metres (default shown) </td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td><b>OSG_SCREEN_HEIGHT</b></td>
|
|
|
|
|
|
|
|
<td><b>0.26</b></td>
|
|
|
|
|
|
|
|
<td>Set the height if image on the screen in metres (default shown) </td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td><b>OSG_EYE_SEPERATION</b></td>
|
|
|
|
|
|
|
|
<td><b>0.06</b></td>
|
|
|
|
|
|
|
|
<td>Set the eye separation - interoccular distance (default shown.) </td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td><b>OSG_SPLIT_STEREO_HORIZONTAL_SEPERATION</b></td>
|
|
|
|
|
|
|
|
<td><b>42</b></td>
|
|
|
|
|
|
|
|
<td>Set the number of pixels between the left and right viewports (default
|
|
|
|
shown).</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td><b>OSG_SPLIT_STEREO_HORIZONTAL_EYE_MAPPING</b></td>
|
|
|
|
|
|
|
|
<td><b>LEFT_EYE_LEFT_VIEWPORT</b></td>
|
|
|
|
|
|
|
|
<td>Set the left eye to render to left viewport, right eye to right viewport
|
|
|
|
(default). </td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td></td>
|
|
|
|
|
|
|
|
<td><b>LEFT_EYE_RIGHT_VIEWPORT</b></td>
|
|
|
|
|
|
|
|
<td>Set the left eye to render to right viewport, right eye to left viewport. </td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td><b>OSG_SPLIT_STEREO_VERTICAL_SEPERATION</b></td>
|
|
|
|
|
|
|
|
<td><b>42</b></td>
|
|
|
|
|
|
|
|
<td>Set the number of pixels between the top and bottom viewports (default
|
|
|
|
shown).</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td><b>OSG_SPLIT_STEREO_VERTICAL_EYE_MAPPING</b></td>
|
|
|
|
|
|
|
|
<td><b>LEFT_EYE_TOP_VIEWPORT</b></td>
|
|
|
|
|
|
|
|
<td>Set the left eye to render to top viewport, right eye to bottom viewport
|
|
|
|
(default). </td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td></td>
|
|
|
|
|
|
|
|
<td><b>LEFT_EYE_BOTTOM_VIEWPORT</b></td>
|
|
|
|
|
|
|
|
<td>Set the left eye to render to bottom viewport, right eye to top viewport. </td>
|
|
|
|
</tr>
|
2001-12-23 06:30:57 +08:00
|
|
|
</table>
|
|
|
|
|
2002-04-19 00:40:17 +08:00
|
|
|
<hr>
|
2002-04-25 21:26:33 +08:00
|
|
|
<h3>
|
|
|
|
Command line arguments can be used to override these settings:</h3>
|
2001-12-23 06:30:57 +08:00
|
|
|
|
2002-04-25 21:26:33 +08:00
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<td><b>-stereo</b></td>
|
2002-04-19 00:40:17 +08:00
|
|
|
|
2002-04-25 21:26:33 +08:00
|
|
|
<td></td>
|
2002-04-19 00:40:17 +08:00
|
|
|
|
2002-04-25 21:26:33 +08:00
|
|
|
<td>Switch on stereo. </td>
|
|
|
|
</tr>
|
2002-04-19 00:40:17 +08:00
|
|
|
|
2002-04-25 21:26:33 +08:00
|
|
|
<tr>
|
|
|
|
<td><b>-stereo</b></td>
|
2002-04-19 00:40:17 +08:00
|
|
|
|
2002-04-25 21:26:33 +08:00
|
|
|
<td><b>ON</b></td>
|
|
|
|
|
|
|
|
<td>Switch on stereo. </td>
|
|
|
|
</tr>
|
2002-04-19 00:40:17 +08:00
|
|
|
|
2002-04-25 21:26:33 +08:00
|
|
|
<tr>
|
|
|
|
<td></td>
|
2002-04-19 00:40:17 +08:00
|
|
|
|
2002-04-25 21:26:33 +08:00
|
|
|
<td><b>OFF</b></td>
|
|
|
|
|
|
|
|
<td>Switch off stereo. </td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td></td>
|
|
|
|
|
|
|
|
<td><b>ANAGLYPHIC</b></td>
|
|
|
|
|
|
|
|
<td>Switch on ANAGLYPHIC stereo. </td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td></td>
|
|
|
|
|
|
|
|
<td><b>QUAD_BUFFER</b></td>
|
|
|
|
|
|
|
|
<td>Switch on QUAD_BUFFER stereo. </td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td></td>
|
|
|
|
|
|
|
|
<td><b>VERTICAL_SPLIT</b></td>
|
|
|
|
|
|
|
|
<td>Switch on VERTICAL_SPLIT stereo. </td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td></td>
|
|
|
|
|
|
|
|
<td><b>HORIZONTAL_SPLIT</b></td>
|
|
|
|
|
|
|
|
<td>Switch on VERTICAL_SPLIT stereo. </td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<hr>
|
|
|
|
<h3>
|
|
|
|
Examples:</h3>
|
|
|
|
To invoke stereo from the comandline:
|
|
|
|
<br><b> sgv -stereo cow.osg</b>
|
|
|
|
<p>To invoke quad buffered stereo from the commandline:
|
|
|
|
<br><b> sgv -stereo QUAD_BUFFER cow.osg</b>
|
|
|
|
<p>To force all apps to start up in quad buffered stereo (if system supports
|
|
|
|
it)
|
|
|
|
<br><b> export OSG_STEREO=ON</b>
|
|
|
|
<br><b> export OSG_STEREO_MODE=QUAD_BUFFER</b>
|
|
|
|
<br><b> sgv cow.osg</b>
|
|
|
|
<p>To set quad buffered stereo to the default, but use the commandline
|
|
|
|
to switch stereo on:
|
|
|
|
<br><b> export OSG_STEREO=OFF</b>
|
|
|
|
<br><b> export OSG_STEREO_MODE=QUAD_BUFFER</b>
|
|
|
|
<br><b> sgv -stereo cow.osg</b>
|
|
|
|
<p>
|
|
|
|
<hr>
|
|
|
|
<h3>
|
|
|
|
Size matters:</h3>
|
|
|
|
For appropriate depth perception the stereo code creates separate left
|
|
|
|
and eye views, both the frustum and modelview are shifted to account for
|
|
|
|
the separate eye views. To achieve the right amount of adjustment
|
|
|
|
the OSG requires the users eye separation, the distance from the eyes to
|
|
|
|
the screen and the height of the screen. The OSG will use the defaults
|
|
|
|
of 0.05m,0.5m and 0.26m respectively which are assumed to be reasonable
|
|
|
|
defaults for most users workstation configurations, note the OSG_SCREEN_HEIGHT
|
|
|
|
is the image height rather than total size of your monitor/display surface.
|
|
|
|
For the best stereo effects please measure these values and set them up
|
|
|
|
via the environmental variables. Once set the views you get should
|
|
|
|
give improved depth perception. A good way of measuring how well
|
|
|
|
you are configured for your display is to fly away from objects (using
|
|
|
|
the FlightManipulator for instance, but not the TrackballManipulator, see
|
|
|
|
below) so that they go of toward infinity. As they move away the offset
|
|
|
|
between the two images should tend towards your eye separation, if you
|
|
|
|
achieve this then the object will be perceived as at infinity.
|
|
|
|
<br>
|
|
|
|
<hr>
|
|
|
|
<h3>
|
|
|
|
Camera Manipulator Modes:</h3>
|
|
|
|
There are three osgUtil::CameraManipulator's which come with osgUtil, which
|
|
|
|
operate as a Trackball, Drive and Flight modes of interaction (see sgv.html
|
|
|
|
for how to invoke them in the scene graph viewer). The osgUtil::Trackball
|
|
|
|
Manipulator automatically scales the fusion distance to that which will
|
|
|
|
fusion on center point of rotation - this will appear at the middle of
|
|
|
|
the monitor at the monitors depth. Whereas, the osgUtil::DriveManipualtor,
|
|
|
|
osgUtil::FlightManipulator scale the fusion distance to the distance the
|
|
|
|
viewer is from the screen, the results in a perception that the virtual
|
|
|
|
world is scaled to physical world, this is clearly better for simulators
|
|
|
|
and alike. You can control the fusion of the image in these two modes via
|
|
|
|
the osg::Camera::setFusionDistanceMode(FusionDistanceMode mode) where mode
|
|
|
|
can be osg::Camera::PROPORTIONAL_TO_LOOK_DISTANCE (used by Trackball) or
|
|
|
|
osg::Camera::PROPORTIONAL_TO_SCREEN_DISTANCE (used by Drive and Flight),
|
|
|
|
and osg::Camera::setFusionDistanceRatio(float). See include/osg/Camera
|
|
|
|
for further details, and the camera manipulators for implementation details.
|
|
|
|
The fusion distance ratio defaults to 1.0 but can be biased to move objects
|
|
|
|
out or into screen, they will also appear to get smaller and larger respectively.
|
|
|
|
The camera manipulators allow the user to alter this value at runtime via
|
|
|
|
the '+' and '-' keys.
|
2001-12-23 05:35:28 +08:00
|
|
|
</body>
|
|
|
|
</html>
|