CalVR

From Immersive Visualization Lab Wiki
Jump to: navigation, search

Contents

Overview

This wiki page was created to give programmers an overview of how to use IVL's virtual reality visualization framework CalVR. Special emphasis is given to those programmers who already know how to write code for COVISE.

If you just want to use CalVR, you can build it from source at this GitHub link.

What is CalVR?

CalVR is a virtual reality framework which has been entirely developed in the Immersive Visualization Laboratory at Calit2. It is designed to be open source and royalty free, for non-profit use. CalVR implements the typically used VR functionality of middleware such as CAVElib, COVISE, VRUI or FreeVR and adds to it by supporting nonstandard VR systems like autostereoscopic displays, as well as multi-user support for viewing and interaction. CalVR is entirely object oriented and written in C++. Functionality can be added through a simple plug-in system which allows compiling new modules separately from the main code. CalVR has built-in navigation algorithms, a 3D menu system, support for a variety of 3D display and tracking systems, as well as support for collaborative work at different sites. The campus wide visibility of Calit2’s Immersive Visualization Laboratory (IVL) has allowed the group to engage in a large variety of software application research and development with groups from many of UCSD’s departments. The experience from more than six years of campus-wide collaborations and many publications reporting on those projects both in the virtual reality community and also the domain sciences is flowing into the design and development of the CalVR software framework.

CalVR Specification and Features

  • Operating system:
    • Developed for CentOS Linux
    • Also builds for other Linux flavors, for instance SuSe
    • Mac OS X: experimental, not always tested
    • Windows: limited to single node
  • Programming language: C++
  • Graphics API: OpenSceneGraph (OSG)
    • Preferred 3D model file format: VRML, parsed by OSG's Coin3D library
  • Build system: CMake
  • XML configuration file for display layout, software parameters, plugin parameters
    • Supports Twinview, Xinerama, separate X displays
  • Tracking APIs supported: VRPN, TrackD, Omicron (UIC/EVL)
    • Multiple tracked heads and hands supported
    • Support for tracked head-mounted displays
    • Per-screen fixed cameras are possible
  • PC cluster support
    • Synchronization over Ethernet, 1+ Gbps preferred
    • Each cluster node runs a copy of CalVR
    • CalVR on cluster nodes run by remote ssh call from head node
    • Buffer swap synchronized over Ethernet
  • Support for multi-screen virtual reality systems
    • Stereo modes supported: all OSG supported modes (passive, quad-buffer, interlaced), 8-view autostereoscopic displays, mirrored displays
  • Support for sound effects through audio server
  • Support for collaborative sessions to link multiple VR systems over IP networks
  • Separation of core framework code and application development through plug-in system
    • Plug-ins are compiled independently of core code into shared object files
  • Coordinate system: z coordinate is up
  • Two GUI widget libraries supported, clean API for additional libraries
    • Functionality abstracted from GUI widget implementation

Building CalVR

The project is built with cmake. At the moment, it is set to require at least version 2.8.

Dependencies

The major external libraries needed are:
OpenSceneGraph 3.2
MiniXML 2.6

Optional Libraries that add additional features:
VRPN - Needed for vrpn tracking support - version 7.29 was that last I tested, though higher probably works.
Interleaver - A research library used to render lenticular screens - I will post a copy or add to source when I get permission.

Building OSG

Download OSG from the above link.
Go to main OSG directory and type ccmake .
In CMAKE_BUILD_TYPE, press Enter to edit the field, type in one of the options with debug information: RelWithDebInfo
On Mac OS X, set OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX to "imageio" and OSG_WINDOWING_SYSTEM to "Cocoa".
Press 'c' to configure, press 'g' to generate. and 'q' to quit. Now type make to build. Go get coffee.

OSG Extra Libraries

There are a number of extra libraries that are optional, but can be built into osg to add additional functionality. This is done by building/installing the libraries then setting the include/library path values in the osg ccmake window. When all paths are added, configure, generate the makefiles, and compile.

simage

If you get the error message "../../simage-1.7.0/src/simage_png.c:326:7: error: dereferencing pointer to incomplete type" then patch simage_png.c by replacing "if (setjmp(png_ptr->jmpbuf)) {" with "if (setjmp(png_jmpbuf(png_ptr))) {".

Coin3d

http://www.coin3d.org/
This is a highly recommended library to add. It adds VRML support to OSG.
If you want the VRML models to have texture support, you need to build coin with the simage library: http://www.coin3d.org/lib/simage
After you have configured/built/installed simage, configure Coin with a line something like this:

configure --prefix=YOURINSTALLPATH --with-simage=YOURSIMAGEINSTALLHOME --disable-dl-simage

If all went well, the final configure settings output should contain:

simage linkage:  link-time binding

If you get the error message "error: ‘cc_debugerror_post’ was not declared in this scope" then include the header

#include <Inventor/C/errors/debugerror.h>

at the beginning (after the #define) of the file Coin-3.1.3/include/Inventor/SbBasic.h

If you get errors about abs functions, add the following define to the src/base/dict.h file before the first header include

#define __STRICT_ANSI__
#define __CORRECT_ISO_CPP_STDLIB_H_PROTO

If you get the error message "/usr/lib/libGL.so: could not read symbols: File in wrong format": fix it in libtool, or temporarily rename to wrong libGL.so so the linker can't find it.

To build osg with Coin3D, define the INVENTOR_INCLUDE_DIR to point to the coin include directory and the INVENTOR_LIBRARY_RELEASE to point to the coin library.

LibTIFF-4

ftp://ftp.remotesensing.org/pub/libtiff/ Most versions of linux have libtiff installed. The problem is that this is normally only version 3.X. There are some features of tiff version 4 that are useful and required for some things. It is recommended to build and compile against the latest tiff 4 version.
Note: in the cmake configuration tool, the tiff include/library variables are flagged as advance. You will need to hit 't' to turn on advanced mode and change the entries.

COLLADA

Download Collada 2.2 from the Collada server. Note that OSG 3.0.1 won't work with newer versions of Collada!

  • Fix a bug, when in main Collada directory: mv dom/include/1.4/dom/domasset.h dom/include/1.4/dom/domAsset.h
  • cp Makefile.linux Makefile
  • Only build minizip and dom: in Makefile comment out lines for fx, rt and viewer.
  • make
  • Copy include files to your include directory:
    • mkdir /share/calvr/extlibs/include/collada-dom2.2
    • cp -r /share/calvr/extlibs/src/collada-dom-2.2/dom/include/* /share/calvr/extlibs/include/collada-dom2.2
  • Copy library files to your lib directory:
    • cp /share/calvr/extlibs/src/collada-dom-2.2/dom/build/linux-1.4/libcollada* /share/calvr/extlibs/lib
  • Add to .bashrc: export COLLADA_DIR=<prefix-dir>. <prefix-dir> is what you would normally put as --prefix= when configuring. Example: /share/calvr/extlibs
  • Run OSG's ccmake .
  • Make sure at least all COLLADA lines without DEBUG in them are filled out correctly.

Getting the Code

The CalVR repository is split into two sections, one of the framework and another for the plugins.

GitHub

There are two ways to check out the CalVR source code from the GitHub repository: read-only and developer mode. Programmers who want to write CalVR plugins, but don't intend to modify the core should read-only checkout the core, and use the developer checkout method for the plugins.

Read-Only Checkout

You can do a read only checkout by doing the following:

git clone git://github.com/CalVR/calvr.git CalVR
git clone git://github.com/CalVR/calvr_plugins.git CVRPlugins

Developer Checkout

Developers at IVL who do not need to modify the core of CalVR should use the shared CalVR sources under /home/calvr/CalVR, and should check out the plugin sources from the GitHub repository into their home directories. Plugin developers outside of IVL should check out the read-only version of the core, and the developer version of the plugin code.

To check out code as a developer you first need to get permission from one of the CalVR administrators (Andrew Prudhomme, Philip Weber, Jurgen Schulze). Then you need to create a GitHub account. Send your account name to an administrator to be added to the developer list.

Then, to pull down the CalVR plugin code from GitHub you need to do the following in your home directory (replace "username" with your GitHub name):

git clone https://username@github.com/CalVR/calvr_plugins.git CVRPlugins

If you're also working on the CalVR core code, pull it down like this:

git clone https://username@github.com/CalVR/calvr.git CalVR

Building Core for Linux

To help aid the cmake configure, you can optionally set environment variables for the location of these libraries:
OSG_HOME - location of OpenSceneGraph install, very good to set if cglx has a copy of osg in /usr/local
MXML_HOME - location of MiniXML install

Go to the project root and run

ccmake .

then type 'c' to configure.

If the configure doesn't find the core libraries, manually fill in the information. For OpenSceneGraph, fill in the OSG_HOME value and reconfigure. This should fill in the OSG_INCLUDE_DIR correctly. Note that this process also sets the library locations in hidden variables, so you can't just fill in the include directory manually.

There are also optional libraries that add additional fuctionality.
Interleaver - if present, builds the ability to create a screen for lenticular 3D rendering - TODO: upload src here

From the ccmake menu you can also select which plugins you want to build. Turn those plugins on and reconfigure. The configure will tell you if there are undetected additional libraries needed to build those plugins and the cmake variables for those libraries will now be in the main menu.

When you are done, select the option to generate and exit ccmake.

From here, run make.

Building Plugins

The plugins are built in a similar way. Go the the plugin root directory and run

ccmake .

The plugins also need OpenSceneGraph and this can be set the same way as above. The plugins need to know where the CalVR home directory is. This can either be manually set or it will look for the CALVR_HOME environment variable.

You can then toggle the plugins that you want to build on and reconfigure. If there plugins have any dependencies, they will appear in the cmake config.
Now generate and run make.
Note: Different plugins have there own library and data dependencies. See Plugin Configuration.

Building Core for Windows

The instructions for the Windows build are on a separate page.

CalVR Configuration

Environment

Before runing CalVR you need to add the library directories into your LD_LIBRARY_PATH in .cshrc/.bashrc. On Mac OS X, set DYLD_LIBRARY_PATH.
These directories should include the ${CALVR_HOME}/lib directory and any lib directories for the CalVR dependencies (i.e. osg/mxml/etc)

Add an environment variable to .cshrc/.bashrc, for example:
.cshrc

setenv CALVR_HOME /home/calvr/CalVR/
setenv CALVR_CONFIG_FILE config.xml

.bashrc

export CALVR_HOME=/home/calvr/CalVR/
export CALVR_CONFIG_FILE=config.xml

Config File

Calvr uses an xml based configuration file.
For more infomation on the config file, see: CalVR Config File

Running CalVR

The main CalVR executable is ${CALVR_HOME}/bin/CalVR.

CalVR Application Development

Applications using the CalVR environment are developed in the form of CalVR Plugins.