Massachusetts Institute of Technology

Media Lab

Matthew Hirsch

BYO3D


Parallax Barrier Tutorial by Keyon Vafa

This tutorial describes running a dual-stacked LCD Parallax Barrier under Linux. For information on constructing a dual-stacked LCD display, refer to the course slide show here.

Setting up the Screen






Dual Stacked LCD Parallax Barrier


Connect the Parallax Barrier to a PC running Linux with a dual-head display adapter. We recommend using an nvidia card. A barrier display has two layers, which consist of too identical monitors stacked on top of each other. Configure the monitors using TwinView, so that they are comprise a single X display, spanned horizontally. You can verify this by dragging a window off the right-hand side of the rear display and onto the left-hand side of the front display. The dual-stacked display will be dimmer than a single-layer LCD, as a single backlight is illuminating two panels. However, by correctly arranging the polarizing layers, as described in the course notes, the brightness of the display can be maximized.

Generating the Sample Images with MATLAB

You can find the files that contain the sample image on the main course website. Once you download them, follow these steps:

  1. Open the "Parallax Barrier" directory
  2. Open MATLAB
  3. Open generate_masks.m
  4. Ensure that the follow parameters are configured appropriately in the script for the sample light field you wish to reconstruct. For the spheres light field:
    1. image.frameDir = './images/spheres/';
  5. And that Line 45 says
    1. image.frameBase = 'spheres-';
  6. Run the MATLAB script

Viewing the Sample Images

These steps will create two directories under Parallax Barrier/images/spheres/masks/pinhole labeled "H" and "W". These two directories contain the front and rear masks that will generate the 3D effect. In order to display them sequentially on the dual-layer display, perform the following steps:

  1. In a shell, navigate to the "Parallax Barrier" directory provided in the course materials.
  2. Change to the "driver" directory
  3. Compile the flip program. This step is only required the first time the program is run.
    1. Ensure that you have met the dependencies for the flip program. These include g++ (the GNU C++ compiler), OpenCV (and development files), freeglut (and development files), and your system's OpenGL development files (for example, nvidia's Xorg headers).
    2. If you are missing any dependencies, obtain them through your distributions package manager or the various projects source repositories.
    3. Run: g++ -lGLU -lglut -lhighgui -I/usr/include/nvidia -I/usr/include -I/usr/include/opencv flip.cpp -o flip
  4. Run the file command ./flip -dir followed by the path to the directory containing the H and W directories produced by the MATLAB script. So if you wanted to run the spheres images, you would enter:
    1. ./flip -dir ../images/spheres/masks/pinhole

This will produce the images on the dual-stacked LCD. If the 3D effect is hard to see or non-existent, you may need to turn off some lights in the room, or by press the "f" key to reverse the order of the masks on the front and back displays. You can see that the image is 3D both horizontally and vertically, as there are different images when you move your head up-and-down as well as left-and-right.

Tutorial written by Keyon Vafa