| [637] | 1 | <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> |
|---|
| [237] | 2 | <html> |
|---|
| 3 | <head> |
|---|
| [637] | 4 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
|---|
| [659] | 5 | <meta name="GENERATOR" content="Mozilla/4.77 [en] (X11; U; Linux 2.4.3-20mdk i686) [Netscape]"> |
|---|
| [651] | 6 | <title>Native stereo support</title> |
|---|
| [237] | 7 | </head> |
|---|
| [637] | 8 | <body text="#000000" bgcolor="#FFFFFF" link="#0000EE" vlink="#551A8B" alink="#FF0000"> |
|---|
| 9 | <img SRC="images/OpenSceneGraphBanner_Distribution.jpg" height=77 width=640> |
|---|
| 10 | <table> |
|---|
| [659] | 11 | <tr> |
|---|
| 12 | <td><a href="index.html">Index</a></td> |
|---|
| [237] | 13 | |
|---|
| [659] | 14 | <td><a href="introduction.html">Introduction</a></td> |
|---|
| [637] | 15 | |
|---|
| [659] | 16 | <td><a href="contents.html">Contents</a></td> |
|---|
| [237] | 17 | |
|---|
| [659] | 18 | <td><a href="install.html">Install</a></td> |
|---|
| 19 | |
|---|
| 20 | <td><a href="dependencies.html">Dependencies</a></td> |
|---|
| 21 | |
|---|
| [1862] | 22 | <td><a href="examples.html">examples</a></td> |
|---|
| [659] | 23 | |
|---|
| 24 | <td><a href="data.html">Data</a></td> |
|---|
| 25 | |
|---|
| [1862] | 26 | <td><a href="osgviewer.html">Viewer</a></td> |
|---|
| [659] | 27 | |
|---|
| 28 | <td><a href="stereo.html">Stereo</a></td> |
|---|
| 29 | |
|---|
| 30 | <td><a href="plan.html">Plan</a></td> |
|---|
| 31 | |
|---|
| 32 | <td><a href="documentation.html">Reference Guides</a></td> |
|---|
| 33 | </tr> |
|---|
| 34 | </table> |
|---|
| 35 | |
|---|
| 36 | <h2> |
|---|
| 37 | <u>Native Support for Stereo</u></h2> |
|---|
| 38 | The OSG has support for anaglyphic stereo (i.e. red/green or red/cyan glasses), |
|---|
| 39 | quad buffered stereo (i.e. active stereo using shutter glasses, or passive |
|---|
| 40 | stereo using polarized projectors & glasses) and horizontal and vertical |
|---|
| 41 | split window stereo implementations. Almost all OSG applications have the |
|---|
| 42 | potential for stereo support simply by setting the relevant environmental |
|---|
| 43 | variables, or via command line arguments. Little or no code changes will |
|---|
| 44 | be required, the support is handled transparently inside osgUtil::SceneView's |
|---|
| 45 | handling of rendering. It is a simple as: |
|---|
| [1862] | 46 | <br><b> osgviewer --stereo cow.osg</b> |
|---|
| [659] | 47 | <p>If the user is planning to use head tracked stereo, or a cave then it |
|---|
| 48 | is currently recommend to set it up via a VR toolkit such as VRjuggler, |
|---|
| 49 | in this case refer to the VR toolkits handling of stereo, and keep all |
|---|
| 50 | the OSG's stereo specific environment variables (below) set to OFF, or |
|---|
| 51 | set the values to off within own your own applications. |
|---|
| 52 | <br> |
|---|
| [593] | 53 | <hr> |
|---|
| [659] | 54 | <h3> |
|---|
| 55 | The environmental variables of interest:</h3> |
|---|
| [237] | 56 | |
|---|
| [593] | 57 | <table> |
|---|
| [659] | 58 | <tr> |
|---|
| 59 | <td><b>OSG_STEREO</b></td> |
|---|
| [237] | 60 | |
|---|
| [659] | 61 | <td><b>ON</b></td> |
|---|
| [237] | 62 | |
|---|
| [659] | 63 | <td>Turn stereo on </td> |
|---|
| 64 | </tr> |
|---|
| [237] | 65 | |
|---|
| [659] | 66 | <tr> |
|---|
| 67 | <td></td> |
|---|
| 68 | |
|---|
| 69 | <td><b>OFF</b></td> |
|---|
| 70 | |
|---|
| 71 | <td>Turn stereo off (default). </td> |
|---|
| 72 | </tr> |
|---|
| 73 | |
|---|
| 74 | <tr> |
|---|
| 75 | <td><b>OSG_STEREO_MODE</b></td> |
|---|
| 76 | |
|---|
| 77 | <td><b>ANAGLYPHIC</b></td> |
|---|
| 78 | |
|---|
| 79 | <td>Use anaglyphic stereo when in stereo (default). </td> |
|---|
| 80 | </tr> |
|---|
| 81 | |
|---|
| 82 | <tr> |
|---|
| 83 | <td></td> |
|---|
| 84 | |
|---|
| 85 | <td><b>QUAD_BUFFER</b></td> |
|---|
| 86 | |
|---|
| 87 | <td>Use quad buffered stereo when in stereo. </td> |
|---|
| 88 | </tr> |
|---|
| 89 | |
|---|
| 90 | <tr> |
|---|
| 91 | <td></td> |
|---|
| 92 | |
|---|
| 93 | <td><b>HORIZONTAL_SPLIT</b></td> |
|---|
| 94 | |
|---|
| 95 | <td>Use horizontal split stereo mode when in stereo </td> |
|---|
| 96 | </tr> |
|---|
| 97 | |
|---|
| 98 | <tr> |
|---|
| 99 | <td></td> |
|---|
| 100 | |
|---|
| 101 | <td><b>VERTICAL_SPLIT</b></td> |
|---|
| 102 | |
|---|
| 103 | <td>Use vertical split stereo mode when in stereo </td> |
|---|
| 104 | </tr> |
|---|
| 105 | |
|---|
| 106 | <tr> |
|---|
| 107 | <td><b>OSG_SCREEN_DISTANCE</b></td> |
|---|
| 108 | |
|---|
| 109 | <td><b>0.50</b></td> |
|---|
| 110 | |
|---|
| 111 | <td>Set the distance the viewer is from screen in metres (default shown) </td> |
|---|
| 112 | </tr> |
|---|
| 113 | |
|---|
| 114 | <tr> |
|---|
| 115 | <td><b>OSG_SCREEN_HEIGHT</b></td> |
|---|
| 116 | |
|---|
| 117 | <td><b>0.26</b></td> |
|---|
| 118 | |
|---|
| 119 | <td>Set the height if image on the screen in metres (default shown) </td> |
|---|
| 120 | </tr> |
|---|
| 121 | |
|---|
| 122 | <tr> |
|---|
| [1159] | 123 | <td><b>OSG_EYE_SEPARATION</b></td> |
|---|
| [659] | 124 | |
|---|
| 125 | <td><b>0.06</b></td> |
|---|
| 126 | |
|---|
| 127 | <td>Set the eye separation - interoccular distance (default shown.) </td> |
|---|
| 128 | </tr> |
|---|
| 129 | |
|---|
| 130 | <tr> |
|---|
| [1159] | 131 | <td><b>OSG_SPLIT_STEREO_HORIZONTAL_SEPARATION</b></td> |
|---|
| [659] | 132 | |
|---|
| 133 | <td><b>42</b></td> |
|---|
| 134 | |
|---|
| 135 | <td>Set the number of pixels between the left and right viewports (default |
|---|
| 136 | shown).</td> |
|---|
| 137 | </tr> |
|---|
| 138 | |
|---|
| 139 | <tr> |
|---|
| 140 | <td><b>OSG_SPLIT_STEREO_HORIZONTAL_EYE_MAPPING</b></td> |
|---|
| 141 | |
|---|
| 142 | <td><b>LEFT_EYE_LEFT_VIEWPORT</b></td> |
|---|
| 143 | |
|---|
| 144 | <td>Set the left eye to render to left viewport, right eye to right viewport |
|---|
| 145 | (default). </td> |
|---|
| 146 | </tr> |
|---|
| 147 | |
|---|
| 148 | <tr> |
|---|
| 149 | <td></td> |
|---|
| 150 | |
|---|
| 151 | <td><b>LEFT_EYE_RIGHT_VIEWPORT</b></td> |
|---|
| 152 | |
|---|
| 153 | <td>Set the left eye to render to right viewport, right eye to left viewport. </td> |
|---|
| 154 | </tr> |
|---|
| 155 | |
|---|
| 156 | <tr> |
|---|
| [1159] | 157 | <td><b>OSG_SPLIT_STEREO_VERTICAL_SEPARATION</b></td> |
|---|
| [659] | 158 | |
|---|
| 159 | <td><b>42</b></td> |
|---|
| 160 | |
|---|
| 161 | <td>Set the number of pixels between the top and bottom viewports (default |
|---|
| 162 | shown).</td> |
|---|
| 163 | </tr> |
|---|
| 164 | |
|---|
| 165 | <tr> |
|---|
| 166 | <td><b>OSG_SPLIT_STEREO_VERTICAL_EYE_MAPPING</b></td> |
|---|
| 167 | |
|---|
| 168 | <td><b>LEFT_EYE_TOP_VIEWPORT</b></td> |
|---|
| 169 | |
|---|
| 170 | <td>Set the left eye to render to top viewport, right eye to bottom viewport |
|---|
| 171 | (default). </td> |
|---|
| 172 | </tr> |
|---|
| 173 | |
|---|
| 174 | <tr> |
|---|
| 175 | <td></td> |
|---|
| 176 | |
|---|
| 177 | <td><b>LEFT_EYE_BOTTOM_VIEWPORT</b></td> |
|---|
| 178 | |
|---|
| 179 | <td>Set the left eye to render to bottom viewport, right eye to top viewport. </td> |
|---|
| 180 | </tr> |
|---|
| [238] | 181 | </table> |
|---|
| 182 | |
|---|
| [593] | 183 | <hr> |
|---|
| [659] | 184 | <h3> |
|---|
| 185 | Command line arguments can be used to override these settings:</h3> |
|---|
| [238] | 186 | |
|---|
| [659] | 187 | <table> |
|---|
| 188 | <tr> |
|---|
| 189 | <td><b>-stereo</b></td> |
|---|
| [238] | 190 | |
|---|
| [659] | 191 | <td></td> |
|---|
| [238] | 192 | |
|---|
| [659] | 193 | <td>Switch on stereo. </td> |
|---|
| 194 | </tr> |
|---|
| [238] | 195 | |
|---|
| [659] | 196 | <tr> |
|---|
| 197 | <td><b>-stereo</b></td> |
|---|
| [238] | 198 | |
|---|
| [659] | 199 | <td><b>ON</b></td> |
|---|
| [238] | 200 | |
|---|
| [659] | 201 | <td>Switch on stereo. </td> |
|---|
| 202 | </tr> |
|---|
| [238] | 203 | |
|---|
| [659] | 204 | <tr> |
|---|
| 205 | <td></td> |
|---|
| 206 | |
|---|
| 207 | <td><b>OFF</b></td> |
|---|
| 208 | |
|---|
| 209 | <td>Switch off stereo. </td> |
|---|
| 210 | </tr> |
|---|
| 211 | |
|---|
| 212 | <tr> |
|---|
| 213 | <td></td> |
|---|
| 214 | |
|---|
| 215 | <td><b>ANAGLYPHIC</b></td> |
|---|
| 216 | |
|---|
| 217 | <td>Switch on ANAGLYPHIC stereo. </td> |
|---|
| 218 | </tr> |
|---|
| 219 | |
|---|
| 220 | <tr> |
|---|
| 221 | <td></td> |
|---|
| 222 | |
|---|
| 223 | <td><b>QUAD_BUFFER</b></td> |
|---|
| 224 | |
|---|
| 225 | <td>Switch on QUAD_BUFFER stereo. </td> |
|---|
| 226 | </tr> |
|---|
| 227 | |
|---|
| 228 | <tr> |
|---|
| 229 | <td></td> |
|---|
| 230 | |
|---|
| 231 | <td><b>VERTICAL_SPLIT</b></td> |
|---|
| 232 | |
|---|
| 233 | <td>Switch on VERTICAL_SPLIT stereo. </td> |
|---|
| 234 | </tr> |
|---|
| 235 | |
|---|
| 236 | <tr> |
|---|
| 237 | <td></td> |
|---|
| 238 | |
|---|
| 239 | <td><b>HORIZONTAL_SPLIT</b></td> |
|---|
| 240 | |
|---|
| 241 | <td>Switch on VERTICAL_SPLIT stereo. </td> |
|---|
| 242 | </tr> |
|---|
| 243 | </table> |
|---|
| 244 | |
|---|
| 245 | <hr> |
|---|
| 246 | <h3> |
|---|
| 247 | Examples:</h3> |
|---|
| 248 | To invoke stereo from the comandline: |
|---|
| [1862] | 249 | <br><b> osgviewer -stereo cow.osg</b> |
|---|
| [659] | 250 | <p>To invoke quad buffered stereo from the commandline: |
|---|
| [1862] | 251 | <br><b> osgviewer -stereo QUAD_BUFFER cow.osg</b> |
|---|
| [659] | 252 | <p>To force all apps to start up in quad buffered stereo (if system supports |
|---|
| 253 | it) |
|---|
| 254 | <br><b> export OSG_STEREO=ON</b> |
|---|
| 255 | <br><b> export OSG_STEREO_MODE=QUAD_BUFFER</b> |
|---|
| [1862] | 256 | <br><b> osgviewer cow.osg</b> |
|---|
| [659] | 257 | <p>To set quad buffered stereo to the default, but use the commandline |
|---|
| 258 | to switch stereo on: |
|---|
| 259 | <br><b> export OSG_STEREO=OFF</b> |
|---|
| 260 | <br><b> export OSG_STEREO_MODE=QUAD_BUFFER</b> |
|---|
| [1862] | 261 | <br><b> osgviewer -stereo cow.osg</b> |
|---|
| [659] | 262 | <p> |
|---|
| 263 | <hr> |
|---|
| 264 | <h3> |
|---|
| 265 | Size matters:</h3> |
|---|
| 266 | For appropriate depth perception the stereo code creates separate left |
|---|
| 267 | and eye views, both the frustum and modelview are shifted to account for |
|---|
| 268 | the separate eye views. To achieve the right amount of adjustment |
|---|
| 269 | the OSG requires the users eye separation, the distance from the eyes to |
|---|
| 270 | the screen and the height of the screen. The OSG will use the defaults |
|---|
| 271 | of 0.05m,0.5m and 0.26m respectively which are assumed to be reasonable |
|---|
| 272 | defaults for most users workstation configurations, note the OSG_SCREEN_HEIGHT |
|---|
| 273 | is the image height rather than total size of your monitor/display surface. |
|---|
| 274 | For the best stereo effects please measure these values and set them up |
|---|
| 275 | via the environmental variables. Once set the views you get should |
|---|
| 276 | give improved depth perception. A good way of measuring how well |
|---|
| 277 | you are configured for your display is to fly away from objects (using |
|---|
| 278 | the FlightManipulator for instance, but not the TrackballManipulator, see |
|---|
| 279 | below) so that they go of toward infinity. As they move away the offset |
|---|
| 280 | between the two images should tend towards your eye separation, if you |
|---|
| 281 | achieve this then the object will be perceived as at infinity. |
|---|
| 282 | <br> |
|---|
| 283 | <hr> |
|---|
| 284 | <h3> |
|---|
| 285 | Camera Manipulator Modes:</h3> |
|---|
| 286 | There are three osgUtil::CameraManipulator's which come with osgUtil, which |
|---|
| [1862] | 287 | operate as a Trackball, Drive and Flight modes of interaction (see osgviewer.html |
|---|
| [659] | 288 | for how to invoke them in the scene graph viewer). The osgUtil::Trackball |
|---|
| 289 | Manipulator automatically scales the fusion distance to that which will |
|---|
| 290 | fusion on center point of rotation - this will appear at the middle of |
|---|
| 291 | the monitor at the monitors depth. Whereas, the osgUtil::DriveManipualtor, |
|---|
| 292 | osgUtil::FlightManipulator scale the fusion distance to the distance the |
|---|
| 293 | viewer is from the screen, the results in a perception that the virtual |
|---|
| 294 | world is scaled to physical world, this is clearly better for simulators |
|---|
| 295 | and alike. You can control the fusion of the image in these two modes via |
|---|
| 296 | the osg::Camera::setFusionDistanceMode(FusionDistanceMode mode) where mode |
|---|
| 297 | can be osg::Camera::PROPORTIONAL_TO_LOOK_DISTANCE (used by Trackball) or |
|---|
| 298 | osg::Camera::PROPORTIONAL_TO_SCREEN_DISTANCE (used by Drive and Flight), |
|---|
| 299 | and osg::Camera::setFusionDistanceRatio(float). See include/osg/Camera |
|---|
| 300 | for further details, and the camera manipulators for implementation details. |
|---|
| 301 | The fusion distance ratio defaults to 1.0 but can be biased to move objects |
|---|
| 302 | out or into screen, they will also appear to get smaller and larger respectively. |
|---|
| 303 | The camera manipulators allow the user to alter this value at runtime via |
|---|
| 304 | the '+' and '-' keys. |
|---|
| [237] | 305 | </body> |
|---|
| 306 | </html> |
|---|