Multi-Projector Based Display Code ---- ModelViewer

来源:互联网 发布:2017网络效应题库 编辑:程序博客网 时间:2024/06/10 04:06

原文地址:  http://www.comp.nus.edu.sg/~brown/projects/projector/modelviewer.html


Overview

Model viewer is another application we provided for large display. It is designed for viewing 3D models in .obj format. It also utilizes the output of the calibration phase, makes the necessary geometric and photometric correction and shows the resulted model on the multi-projector display.

Algorithms

The geometric and photometric correction algorithms used in ModelViewer is similar to those used in ImageViewer. The major difference here is that the texture source used for geometric and photometric correction doesn't come from any static image. Instead, we need to render the .obj model first into the back buffer of the graphic card and transfer it back to the texture buffer as texture source. Then we apply the necessary geometric and photometric correction the same as what we did in ImageViewer. So it is critical to have a graphic card with decent performance which supports double buffering and texture transfer from FrameBuffer to texture memory. Luckily, most relatively new graphics cards (on market since 2005) have no problem with this.

    The other thing need to pay attention to is that since this is a distributed system, the rendering PCs may have different graphics card (so it's better if you could use the same cards on all the PC, but it's still OK if you couldn't) and different speed in executing the texture copying, geometric and photometric correction. This will cause the display system visually unsynchronized: some projectors with better graphics cards may refresh faster. The effect is severe if user starts some animation on the rendered model. In order to deal with this, we add another synchronizer to the system. All the rendering PCs will send a signal to the synchronizer after finishing the texture copying, geometric and photometric correction and before actually showing the frame on projectors. If the synchronizer receives the signals from all the rendering PCs, it will send back a message to all the rendering PCs to indicate that they can swap the buffer and refresh the frame. Since the swap is a super-fast operation, refreshing of the display system on different render PCs will be well synchronized. You can refer to the code for more details.

Download

Please go to the download page.

How to use the code

We only support the multi-projector multi-PC configuration for this ModelViewer. Below are the step-by-step instructions of how to use the code:

Multi-Projector Multi-PC Configuration:

  1. Download the corresponding binary package named ModelClient (control client running on master PC),ModelServer (render server running on render PC) and ModelSync (Synchronizer running on another PC, which can also be the master PC) from the above "Download" Section;
  2. Connect the PCs and projectors as showed in Figure 3 except not necessary to connect the camera;
  3. Copy the calibration result (such as reslut2x2.txt), alpha masks (Px.bmp) and .obj files to the working directory of all the render servers;
  4. Run the following program on all the rendering PC from command line with:
    ModelServer.exe
  5. Modify the configuration file named Client4.cfg according to your actual configuration (IP address, port, gamma, etc);
  6. Run the synchronizer on the master PC from command line with:
    ModelSync.exe Client4.cfg
  7. Run the control client program on the master PC from command line with:
    ModelClient.exe cube.obj Client4.cfg
  8. If everything goes well, you will see the model named cube.obj showing on the large display correctly;
  9. You can use mouse and keyboard to zoom in/zoom out, change the position and so on, please see the command line help of the program.