(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Rviz in Stereo

Description: Teaches how to set up Rviz to render in 3D Stereo.

Tutorial Level: INTERMEDIATE


3D stereo rendering displays a different view to each eye so that the scene appears to have depth. If you have a stereo capable monitor and stereo capable graphics card you can get Rviz to render its view in stereo. This tutorial describes how to accomplish this.

Hardware Requirements

To render in stereo you will need a graphics card capable of Quad-buffer stereo. You may also need a stereo-capable monitor and/or a monitor that can display at 120Hz.

Using NVIDIA hardware

On Linux NVIDIA Quadro cards support quad buffered stereo. There is information about which cards support this feature here on the NVIDIA website.

Also see http://www.zib.de/durmaz/3dVision.html or try a web search for other info on "quad buffer stereo linux".

There seem to be 2 options for displays:

Special 3D Monitor

Get a special monitor that comes with 3DVision glasses and has a built in 3DVision IR transmitter. I have stereo working on an ASUS VG278H monitor with an NVIDIA Quadro K4000 graphics adaptor. You will need to connect the display directly to the graphics card with a DVI Dual-link cable. (Single link DVI will not work. Display-port to DVI will not work. HDMI will not work at 120Hz.) The monitor comes with active 3DVision glasses and has a built in IR transmitter, so you do not need a separate IR transmitter and you do not need a "3 pin mini-din" connector on your graphics card.

3DVision glasses

Get 3DVision kit with active glasses and an IR transmitter (or 3DVision-Pro glasses with a radio transmitter). You will also need a monitor with a refresh rate of at least 100Hz (120Hz is better).

On Linux you need to connect the IR (or radio) transmitter directly to the graphics card. Transmitters that plug into USB do not work on Linux (they may work on Mac but I have not tried). To connect directly to the graphics card use the '3-pin mini-din to 1/8" stereo cable' that comes with the 3DVision kit.

Many NVIDIA cards that support stereo DO NOT come with a '3-pin mini-din' connector on them. If you do not see a round 3-pin 'mini-din' connector on the back of your graphics card (next to the DVI/VGA/etc connectors) then you need to buy a separate "NVIDIA Quadro Stereo Board Connector". PNY sells one: Search for part number "QSP-STRBOARD-PB" This will only work with Quadro cards that support quad buffer stereo. Check the NVIDIA website for your card to be sure your card will work before buying the board connector.

On linux you can tell what kind of graphics card you have by running

   lspci | grep VGA

If it does not say "Quadro" then it probably does not support stereo.

You will need to connect the display directly to the graphics card with a DVI Dual-link cable. (Single link DVI will not work. Display-port to DVI will not work. HDMI works at 60Hz which is too slow and you will quickly get a headache.)

Using AMD hardware

I believe some high end AMD graphics cards support quad-buffer stereo, but I do not know which ones. If you have information on this please add it here.

Setting up X (in Linux) to support stereo


Install binary drivers

Be sure you are using the NVIDIA binary drivers. Run

  sudo apt-get install nvidia-settings

If you are using the NVIDIA binary drivers this will work -- go on to the next step. If not the program will inform you that you are not using the NVIDIA binary drivers.

Search the web for Install NVIDIA drivers

Set resolution, refresh rate, and stereo mode



Click on "X Server Display Configuration". If you have multiple monitors choose the one you want to setup for stereo. Select the Resolution (do not choose "Auto"). Select the refresh rate (to the right of "Resolution"). You want a refresh rate at least 100Hz (120Hz or faster is better). Click "Apply".

Assuming everything works you need to save these settings. Click the button "Save to X Configuration File" and follow the prompts to save the file as /tmp/xorg.conf

Now you have to add the stereo setting. Open a terminal and run these commands:

  cd /tmp
  nvidia-xconfig -c xorg.conf -o xorg.conf --stereo=10

Note: "10" means "NVIDIA 3D VISION". If you have "NVIDIA 3D VISION PRO" use 11. For other settings run man nvidia-xconfig and search for stereo.

  sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.original-no-stereo
  cp xorg.conf /etc/X11/xorg.conf

Now restart X by logging out and logging back in.

To verify that stereo is enabled run


Click on "X Screen 0" and look at the "Stereo Mode" setting. It should say "NVIDIA 3D Vision Stereo"

Known-working Stereo Hardware

Please add to this section if you have stereo working on your system.

* WORKS: NVIDIA Quadro K4000, ASUS VG278H monitor (comes with 3DVision glasses), DVI dual-link cable. IR transmitter is built into the monitor.

Testing stereo hardware

To verify that your stereo hardware is working run

   sudo apt-get install mesa-utils
   glxgears -stereo

If you have multiple monitors, drag the gears window to the monitor with stereo support. You should see a double image. Put on your 3D Glasses. You should see the image in stereo. To see it better resize the window (make it bigger) and use the arrow keys to rotate the gears around. If it looks funny try running


click on "OpenGL Settings" and check the "Exchange Stereo Eyes" button.


I have found that once the computer goes to sleep or if the monitor is turned off that the monitor stops transmitting the stereo signal to the glasses after the computer wakes up and the monitor is turned on. If you cannot get stereo to work try this: Shut down the computer. Leave the monitor turned on. Power on the computer. Now it should work (at least until the computer goes to sleep again).

Building Rviz to render in stereo

Ogre (the graphics library that Rviz uses) does not currently support stereo rendering by default. To enable stereo rendering you will have to build Rviz and a custom version of Ogre from source.

Do not bother with this until you have confirmed that your graphics card and monitor work in stereo (see Testing stereo hardware). Rviz will not render in stereo if glxgears -stereo does not render in stereo.

Building Ogre for Stereo

Get the sources, build and install. Rviz only works with versions of Ogre older than 1.8, so checkout that tag.

    cd $HOME
    mkdir my-ogre
    cd my-ogre
    hg clone https://bitbucket.org/sinbad/ogre
    cd ogre
    hg pull && hg update v1-8
    cd ..
    mkdir build
    cd build
    make install

Note: This installs Ogre into /usr/local.

Building Rviz for Stereo

First create a workspace to build Rviz. (If you already have a workspace you can use the existing one instead of creating a new "my-rviz-workspace" workspace.)

    cd $HOME
    mkdir -p my-rviz-workspace/src
    cd my-rviz-workspace/src
    git clone https://github.com/ros-visualization/rviz.git
    cd ..
    PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:${PKG_CONFIG_PATH} catkin_make --cmake-args -DCMAKE_SHARED_LINKER_FLAGS:STRING=" -Wl,-rpath,/usr/local/lib" -DCMAKE_CXX_FLAGS:STRING="-DOGRE_STEREO_ENABLE=1" -DUseQt5:BOOL="0"

Run your new rviz compiled binary manually:

    roscore & ./devel/lib/rviz/rviz

If your hardware doesn't support quad buffer stereo rviz might segfault at this point.

Add a display (e.g. an Axis Display) so there is something to look at.

If your HW supports stereo you should see a double image. Put on the glasses to see it in stereo.

Adjusting stereo properties in Rviz

Properties in the "View Controller" panel can be used to set eye-separation, focal-distance, to swap the eyes, and disable stereo.

If you do not see the "Views" panel (by default in upper right) then click the "Panels" menu item and check "Views".

In the "Current View" you will see some properties that can be used to adjust the stereo rendering:

  • Enable Stereo Rendering: uncheck this to turn off stereo.

  • Swap Stereo Eyes: check this if Rviz has gotten confused and has swapped the left and right eyes.

  • Stereo Eye Separation: Use larger values for greater stereo effect. Ideally this is the distance between your eyes (in meters).

  • Stereo Focal Distance: Set this to the distance between your eyes and the monitor. Smaller values tend to produce a greater stereo effect.

Wiki: rviz/Tutorials/Rviz in Stereo (last edited 2016-10-21 15:06:52 by Zoe Snape)