Skip to content

Advanced#

Understanding stereoscopy#

From Wikipedia:

Stereoscopy (also called stereoscopics or 3D imaging) is a technique for
creating the illusion of depth in an image by means of stereopsis for
binocular vision. [...]

Most stereoscopic methods present two offset images separately to the left 
and right eye of the viewer. These two-dimensional images are then combined
in the brain to give the perception of 3D depth.

There are three things to consider:

  • How are stereoscopic images generated?
  • How are stereoscopic images transmitted?
  • How are stereoscopic images displayed?

How are stereoscopic images generated?#

The simplest way to generate a pair of stereoscopic images is to simply create two cameras and offset them by the same distance as the distance between your two eyes.

Unfortunately things are not so simple. This would only work if you had a screen in front of each eye and only looked at infinity: this way, the axis of your eyes and the axis of the cameras would be always parallel.

3D screens#

Currently, one of the most common way of displaying a 3D image on a single 3D screen and wearing glasses to separate the images.

If you have read "Head-tracking and perspective", you already know that the 3D screen is like a window on the virtual world. This means that what your eyes see is constrained by that window. The parts of the virtual world that you can see depend on the position of your eyes with respect to this window.

There are two ways to setup stereoscopy for a 3D screen in MiddleVR:

With a stereoscopic camera, you can configure the field of view and the screen distance. This assumes that the eyes of the viewer are always exactly facing the middle of the screen and that the eyes are at the same distance as the convergence distance. The size of the screen is determined by the field of view of the camera and the "screen distance" parameter of the stereoscopic camera.

If you setup a screen for your stereoscopic camera, you can be more precise to specify the exact size and position of the screen with respect to the viewer.

You can then add a tracker on the stereoscopic camera so that when the viewer moves, the perspective is always correct.

3D projectors#

A 3D projector can be considered as a 3D screen, with the size of the screen being the size of the projected image.

How are stereoscopic images transmitted? {#stereo_trans}#

Here are the most common ways of transmitting a stereoscopic image to a stereoscopic system. These different mechanisms only relate to the way the images are transmitted from the graphics cards to the display system, and are not necessarily linked to the way they will be displayed. See "Debate" below.

From Wikipedia:

There are multiple ways to provide these separate images:

    - Use dual video inputs, thereby providing a completely separate video
    signal to each eye
    - Time-based multiplexing. Techniques such as frame sequential
    combine two separate video signals into one signal by alternating
    the left and right images in successive frames.
    - Side by side or top/bottom multiplexing. This method allocated half
    of the image to the left eye and the other half of the image to the right eye.

The advantage of dual video inputs is that it provides the maximum resolution
for each image and the maximum frame rate for each eye. The disadvantage of dual
video inputs is that it requires separate video outputs and cables from the
device generating the content.

Time-based multiplexing preserves the full resolution per each image, but
reduces the frame rate by half. For example, if the signal is presented at 60 Hz,
each eye is receiving just 30 Hz updates. This may become an issue with accurately
presenting fast-moving images.

Side-by-side and top/bottom multiplexing provide full-rate updates to each eye,
but reduce the resolution presented to each eye.

Debate#

The "natural" way#

Most of the time, an active stereo system will use a frame sequential transmission because it is simple to use the alternate frame signal directly with the active glasses.

In the same way, a dual projector passive stereo system will naturally use a dual-input transmission because you can simply plug the left input in the left projector and do the same for the right projector.

Most 3D TVs support side-by-side and/or top-bottom input directly, which makes it the easier way to setup stereoscopy on this kind of display.

The "twisted" way#

Note however that a frame sequential transmission can be split to be used as a dual-input. A dual-input transmission can also be combined in a frame sequential signal.

Basically all transmission signals can be converted to one another depending on the requirements of the VR system.

How are stereoscopic images displayed? {#stereo_display}#

Once the stereoscopic images have been generated and transmitted, the display must make sure that the left image is only seen by the left eye, and the same for the right eye.

3D Screen#

On a 3D screen, both images are displayed on the same display. This means that there must be a way for each eye to see only the corresponding image.

The two most common mechanism to achieve this involve 3D glasses. These two mechanisms are commonly called "Active stereoscopy" and "Passive stereoscopy". The name comes from the fact that in one case the 3D glasses are "active", and in the other case they are passive.

This denomination is also often used for the way the stereoscopic images are transmitted, even though nowadays an active stereo signal can be used to feed a passive stereo system and vice-versa.

Active stereoscopy#

Active stereo refers to a mechanism in which the left and right images are displayed sequentially on the 3D screen. This means that frame 0 is left eye, frame 1 is right eye etc.

This also means that when frame 0 displays the left eye, the 3D glasses must hide this image from the right eye. This is accomplished by using LCD shutter glasses that can turn from transparent to opaque very quickly. While the left LCD from the glasses is transparent, the right one is opaque, and vice versa.

Those glasses are called active because they have active elements (the LCD shutters) and require batteries.

Passive stereoscopy#

Most of the time, passive stereoscopy involves polarized glasses and displays.

From Wikipedia:

A polarized 3D system uses polarization glasses to create the illusion of
three-dimensional images by restricting the light that reaches each eye,
an example of stereoscopy.

To present stereoscopic images and films, two images are projected superimposed
onto the same screen or display through different polarizing filters. The viewer
wears low-cost eyeglasses which contain a pair of different polarizing filters.
As each filter passes only that light which is similarly polarized and blocks the
light polarized in the opposite direction, each eye sees a different image. This
is used to produce a three-dimensional effect by projecting the same scene into
both eyes, but depicted from slightly different perspectives. Several people can
view the stereoscopic images at the same time.

The glasses don’t have any active element, only polarizing filters, which is why the mechanism is called "passive stereoscopy".

3D Projectors#

The majority of 3D projectors can only do active stereoscopy. The most common way to achieve passive stereoscopy with projectors is to use two non-3D projectors, one for each eye and each correctly polarized.

How to configure MiddleVR#

The way the images are displayed is completely determined by the hardware in place and is a design choice when creating the VR system.

MiddleVR can only be configured to specify how the images are generated and transmitted.

How to configure a VRPN server#

Configuring a VRPN server#

The general case#

Locate the ‘vrpn_server.exe‘ file. It is typically found in:

C:/Program files/MiddleVR3/bin64/vrpn

In the same folder you should have the ‘vrpn.cfg‘ file. This is the configuration file that needs to be edited in order to specify which devices should be accessed and how.

Edit this file. You will notice a big file where all lines start with a ‘#’:

#vrpn_Tracker_Intersense Tracker0 AUTO IS900Time
#vrpn_Tracker_Dyna  Tracker0  1 /dev/ttyS0 19200
#vrpn_Tracker_Flock Tracker0  2 COM1 38400 1 N -x

As VRPN supports a lot of different devices, you have to identify your device in the list. When you have identified your device, uncomment the corresponding line by removing the ‘#’.

  • The first word on the line is the driver type to use,
  • the second word is the name for this device and that you will use for the client connection.

This name, typically Tracker0, can be changed to better match the semantic of your tracker. This is also required if you use different trackers with the same VRPN server. You could for example choose "HeadTracker" or "HandTracker".

Remember this name correctly (and note it is case sensitive), it will used by the client when connecting to the server to identify the tracker (see configuring a VRPN tracker).

  • the rest of the line represent options for that specific driver.

There is a lot of documentation inside the file that will help you identify the device and its options.

Specific devices#

Here are specific articles about configuring popular devices:

Running the VRPN server#

Once you have correctly configured vrpn.cfg, you just have to run the VRPN server by double-clicking on the vrpn_server.exe file.

This will start a DOS box, which might be empty or display information depending on the configured devices:

Troubleshooting VRPN#

See the following article: Troubleshooting VRPN.

Keyboard keys#

Usage example: keyboard.IsKeyPressed( MVR.VRK_SPACE );

VRK_A, VRK_B,... VRK_Z
VRK_0, VRK_1,... VRK_9
VRK_CANCEL
VRK_BACK
VRK_TAB
VRK_CLEAR
VRK_RETURN
VRK_SHIFT
VRK_CONTROL
VRK_MENU
VRK_ALT = VRK_MENU;
VRK_PAUSE
VRK_CAPITAL
VRK_KANA
VRK_HANGUL
VRK_JUNJA
VRK_FINAL
VRK_HANJA
VRK_KANJI
VRK_ESCAPE
VRK_CONVERT
VRK_NONCONVERT
VRK_ACCEPT
VRK_MODECHANGE
VRK_SPACE
VRK_PRIOR
VRK_NEXT
VRK_END
VRK_HOME
VRK_LEFT
VRK_UP
VRK_RIGHT
VRK_DOWN
VRK_SELECT
VRK_PRINT
VRK_EXECUTE
VRK_SNAPSHOT
VRK_INSERT
VRK_DELETE
VRK_HELP
VRK_LWIN
VRK_RWIN
VRK_APPS
VRK_SLEEP
VRK_NUMPAD0
VRK_NUMPAD1
VRK_NUMPAD2
VRK_NUMPAD3
VRK_NUMPAD4
VRK_NUMPAD5
VRK_NUMPAD6
VRK_NUMPAD7
VRK_NUMPAD8
VRK_NUMPAD9
VRK_MULTIPLY
VRK_ADD
VRK_SEPARATOR
VRK_SUBTRACT
VRK_DECIMAL
VRK_DIVIDE
VRK_F1
VRK_F2
VRK_F3
VRK_F4
VRK_F5
VRK_F6
VRK_F7
VRK_F8
VRK_F9
VRK_F10
VRK_F11
VRK_F12
VRK_F13
VRK_F14
VRK_F15
VRK_F16
VRK_F17
VRK_F18
VRK_F19
VRK_F20
VRK_F21
VRK_F22
VRK_F23
VRK_F24
VRK_NAVIGATION_VIEW 
VRK_NAVIGATION_MENU
VRK_NAVIGATION_UP
VRK_NAVIGATION_DOWN
VRK_NAVIGATION_LEFT
VRK_NAVIGATION_RIGHT
VRK_NAVIGATION_ACCEPT
VRK_NAVIGATION_CANCEL
VRK_NUMLOCK
VRK_SCROLL
VRK_OEM_NEC_EQUAL // '=' key on numpad
VRK_OEM_FJ_JISHO   // 'Dictionary' key
VRK_OEM_FJ_MASSHOU // 'Unregister word' key
VRK_OEM_FJ_TOUROKU // 'Register word' key
VRK_OEM_FJ_LOYA    // 'Left OYAYUBI' key
VRK_OEM_FJ_ROYA    // 'Right OYAYUBI' key
VRK_LSHIFT
VRK_RSHIFT
VRK_LCONTROL
VRK_RCONTROL
VRK_LMENU
VRK_ALTLEFT = VRK_LMENU;
VRK_RMENU
VRK_ALTRIGHT = VRK_RMENU;
VRK_BROWSER_BACK
VRK_BROWSER_FORWARD
VRK_BROWSER_REFRESH
VRK_BROWSER_STOP
VRK_BROWSER_SEARCH
VRK_BROWSER_FAVORITES
VRK_BROWSER_HOME
VRK_VOLUME_MUTE
VRK_VOLUME_DOWN
VRK_VOLUME_UP
VRK_MEDIA_NEXT_TRACK
VRK_MEDIA_PREV_TRACK
VRK_MEDIA_STOP
VRK_MEDIA_PLAY_PAUSE
VRK_LAUNCH_MAIL
VRK_LAUNCH_MEDIA_SELECT
VRK_LAUNCH_APP1
VRK_LAUNCH_APP2
VRK_OEM_1      // ';:' for US
VRK_OEM_PLUS   // '+' any country
VRK_OEM_COMMA  // ',' any country
VRK_OEM_MINUS  // '-' any country
VRK_OEM_PERIOD // '.' any country
VRK_OEM_2      // '/?' for US
VRK_OEM_3      // '`~' for US