Active Stereo
Keywords:
tutorial,
X3D,
world,
engine,
stereo,
active
Author(s): Patrick Riess
Date: 2007-12-20
Summary: This tutorial describes the configuration of the engine to achieve an active stereoscopic view of scenes by using synchronized shutter glasses.
Preconditions for this tutorial
Please read the tutorials "Multiple Windows and Views" as well as "Stereo Basics" in this category to get a good overview about stereo approaches and basic configuration issues regarding multiple views in Instant Reality.
Hardware
A "normal" graphics card uses a double buffer approach, a back buffer to write into and a front buffer to display in the meantime to avoid flickering. To use active stereo you should take a graphics card with quad buffer, i.e. four buffers. That means it uses a front and a back buffer for each eye.
As display you can either use a monitor or a video beamer which is able to display active stereo images interleaved in time.
Now you just need some shutter glasses which let you see the correct image for the appropriate eye. It is synchronized with the graphics card, mostly using infrared as you can see in the image below.
Stereo modifier
If we want to do stereo, then we need two view areas. One for the left eye and one for the right eye. For stereo it is neccessary to modify viewing parameters. For this kind of modification there exists a number of modifiers in Instant Reality. For a simple stereo projection we have to use the ShearedStereoViewModifier:
Code: ShearedStereoViewModifier node
... Viewarea { modifier [ ShearedStereoViewModifier { leftEye TRUE rightEye FALSE eyeSeparation 0.08 zeroParallaxDistance 1 } ] } ...
Depending on the eye which should be represented by this modifier, leftEye and rightEye has to be set to TRUE or FALSE. zeroParallaxDistance and eyeSeparation values are in metres, so they have good default values, if your scene is also modeled in metres. Otherwise you could either adapt the values or as a better approach, you should use a NavigationInfo node in the Scene namespace and set the sceneScale field to 0.01 if the scene is modeled in centimetres or 0.001 if the scene is modeled in millimetres and so on. The advantage is you can keep the stereo configuration fix for your setup and each scene and just need to change one value.
Code: NavigationInfo node
... Scene { children [ NavigationInfo { sceneScale 0.01 } ... ] }
Quad Buffer Stereo
Active stereo configuration is simple. First you have to tell the LocalWindow to use four instead of two buffers, the default setting.
Code: Quad buffer configuration
... LocalWindow { buffer 4 ... } ...
In the window we need two view areas, one for the left and one for the right eye. These areas are overlapping as we don't set specific regions for them. For each Viewarea we define a ShearedStereoViewModifier which is responsible for the camera modification of the left or right eye respectively. It has also to be defined which buffers on the graphics card should be used by which view area. Therefore we set
Code: Left buffer definition in view area
... Viewarea { leftBuffer TRUE rightBuffer FALSE ... } ...
for the left eye view area and
Code: Right buffer definition in view area
... Viewarea { leftBuffer FALSE rightBuffer TRUE ... } ...
for the right eye view area.
After all the configuration looks like the one below:
Code: Stereo configuration with Quad-Buffer
RenderJob { windowGroups [ WindowGroup { windows [ LocalWindow { buffer 4 size 1024 768 views [ Viewarea { leftBuffer TRUE rightBuffer FALSE modifier [ ShearedStereoViewModifier { leftEye TRUE rightEye FALSE } ] } Viewarea { leftBuffer FALSE rightBuffer TRUE modifier [ ShearedStereoViewModifier { leftEye FALSE rightEye TRUE } ] } ] } ] } ] }
Comments
This tutorial has no comments.
Add a new comment
Due to excessive spamming we have disabled the comment functionality for tutorials. Please use our forum to post any questions.