West Virginia ImmersaDesk Documentation

Frances L. Van Scoy
West Virginia University
West Virginia EPSCoR


December 9, 1998 version

Introduction

The ImmersaDesk is a projection-based Virtual Environment system developed at the University of Illinois at Chicago's Electronic Visualization Laboratory. The system has a 4' x 5' display on which output may be displayed in mono or stereo vision.

The National Center for Supercomputer Applications at the University of Illinois at Urbana-Champaign offers classes and on-line self-study material for visualization and virtual environments.


Getting Started

There are two main steps to building an ImmersaDesk application:


(1) building a 3-d model
and
(2) adding interactivity to the model

There are (at least !) two approaches to building an ImmersaDesk application:

(1) using VRML
or
(2) writing a C or C++ program with calls to the Open GL (and related) libraries and to the CAVE library

Much of the work of developing the 3-D model can be done on a desktop system which has a VRML browser or the OpenGL libraries. Then the model can be ported to the ImmersaDesk and the interactivity added.


Building a 3-D Model using VRML

VRML stands for Virtual Reality Modeling Language. It is a "scene description language" that describes the geometry and behavior of a 3-D model. The VRML Consortium web page is located at:

http://www.vrml.org/
This site contains links to the language specification, tutorials, examples, frequently asked questions, and more.

There are three versions of VRML: VRML 1.0, VRML 2.0, and VRML 97. VRML 1.0 supports building static models which can be explored using a VRML viewer but which contain no animation or user interaction. VRML 2.0 and VRML 97 refer to essentially the same new version of VRML which includes animation and user interaction. (For technical details on the history of the various versions see http://www.vrml.org/faq/vrbfaq.html#Versions ) VRML is now an ISO standard.

There are major changes in syntax from VRML 1.0 to VRML2.0, so any models developed with the intention of viewing them on the ImmersaDesk should be developed using VRML 2.0.

You can view VRML models with a web browser with the right plug-in. VRML files on a Unix system have file names that end in .vrml or .wrl . The MIME type is x-world/x-vrml .

One VRML viewer is CosmoPlayer, which is available at URL http://www.sgi.com/software/cosmo/player.html for Unix and Windows systems and at http://www.cosmosoftware.com/aboutus/opinion/macplayer.html for Macintosh systems.

An example of the functionality of VRML 2.0 is a reconstruction of an Aztec city, available at http://cosmosoftware.com/developer/handbook/ This model was developed at Silicon Graphics. Jed Hartman and Josie Wernecke's book The VRML 2.0 Handbook: Building Moving Worlds on the Web (Addison-Wesley, 1996) is a tutorial describing how various features of VRML were used to build the model.

Example--a Birthday Cake

Here is an example of a simple birthday cake, modeled in VRML 2.0. The cake itself is modeled by a white cylinder, the single candle by a green cylinder, and the flame on the candle by a yellow sphere.

The message "Happy Birthday !" appears in red letters.

#VRML 2.0 utf8
WorldInfo {
  title "Simple Birthday Cake"
  info "by Frances Van Scoy"
}
Shape {
  appearance Appearance {
    material Material {
      diffuseColor 1.0 1.0 1.0
    }
  }
  geometry Cylinder {
    radius 3
    height 2
    side   TRUE
    top    TRUE
    bottom TRUE
  }
}
Transform {
  translation 0.0 3.0 0.0
  children [
    Shape {
      appearance Appearance {
        material Material {
          diffuseColor 0.0 0.8 0.0
        }
      }
     geometry Cylinder {
        radius 0.2
        height 4
        side   TRUE
        top    TRUE
        bottom TRUE
     }
  ]
}
Transform {
  translation 0.0 5.35 0
  children [
    Shape {
      appearance Appearance {
        material Material {
          emissiveColor 1.0 1.0 0.0
        }
      }
      geometry Sphere {
        radius 0.2
      }
    }
  ]
}
Transform {
  translation 0 -3 0
  children [
    Shape {
      appearance Appearance {
        material Material {
          emissiveColor 1 0 0
        }
      }
      geometry Text {
        fontStyle FontStyle {
          family      "SERIF"
          style       "PLAIN"
          size        1.0
          spacing     1.0
          justify     "MIDDLE"
          horizontal  TRUE
          leftToRight TRUE
          topToBottom TRUE
        }
        string "Happy Birthday !"
      }
    }
  ]
}

To indicate to the VRML browser that the file is a VRML 2.0 file, the first line of the file must be:

#VRML 2.0 utf8 
Elsewhere in the file, a '#' indicates that the rest of the line is a comment and is to be ignored by the browser.

This file describes 5 nodes, a WorldInfo node, a Shape node, and 3 Transform nodes.

The WorldInfo node is optional. The title field gives a name for the model which some VRML players display. The info field is essentially a comment.

The Shape node describes the white cylinder which models the cake. This Shape node has two fields, "appearance" and "geometry." The appearance field in this case indicates that the color of the shape to be drawn is to be "white." This is done by the line which reads

diffuseColor 1.0 1.0 1.0
VRML uses the red-green-blue (RGB) color system. VRML indicates a color by a triple of numbers between 0 and 1, where 0 indicates the absence of the color and 1 the presence of the color. White is composed of equal amounts of red, green, and blue, and so
diffuseColor 1.0 1.0 1.0
indicates that the color of the shape is to be white. Elsewhere in this file objects are defined to be green ( 0.0 0.8 0.0 ), yellow ( 1.0 1.0 0.0 ), and red ( 1.0 0.0 0.0 ).

The following table shows some common colors and their RGB definitions:

Red   Green  Blue    Color
-----------------------------
0.0    0.0    0.0    black
1.0    0.0    0.0    red
0.0    1.0    0.0    green
0.0    0.0    1.0    blue
1.0    1.0    0.0    yellow
0.0    1.0    1.0    cyan
1.0    0.0    1.0    magenta
1.0    1.0    1.0    white
0.5    0.5    0.5    grey

This particular shape is a cylinder, as indicated by the geometry field of the Shape node. The value of the geometry field is a Cylinder node, whose fields indicate values of 3 for the radius and 2 for the height and that all three components of the cylinder, the side, the top, and the bottom, are to be displayed.

VRML uses a right hand coordinate system, as shown below.

                        ^
                        |
                        | y-axis
                        |
                         - - - - >
                      /    x-axis
            z-axis   /
                    v

Unless a transformation is specified, a VRML shape is modeled with its center at the origin. The axis of a cylinder is parallel to the y axis. This particular cylinder, then, extends from x = -3 to x = 3, y = -1 to y = 1, and z = -3 to z = 3.

The first Transform node describes a taller, thinner green cylinder, representing the candle on the cake. The translation field of the Transform node indicates that the center of this cylinder is to be at (0,3,0). This green cylinder extends from x = -0.2 to x = 0.2, from y = 1 to y = 5, and from z = -0.2 to z = 0.2.

The second Transform node describes a small yellow sphere which is just above the top of the green cylinder.

The primitive shapes provded by VRML are sphere, cylinder, cone, and box. Others can be built by a developer using points, lines, and faces.

The final Transform node of this example describes how the text "Happy Birthday !" is displayed. Unlike a word processing file but like an HTML file, the specific font to be used is not indicated. Instead the developer gives certain attributes of the font. The choices for "family" include "SERIF" (similar to Times), "SANS" (similar to Helvetica), and "TYPEWRITER" (similar to Courier). The choices for "style" include "PLAIN," "BOLD," "ITALIC," and "BOLDITALIC."

The "horizontal," "leftToRight," and "topToBottom" fields indicate that text is to be displayed from left to right and top to bottom, as is typical for English text. For Japanese text written top to bottom and right to left, the settings would be horizontal = FALSE, leftToRight = FALSE, and topToBottom = TRUE.

Example using Prototypes - Toy Log House

http://157.182.194.150/~vanscoy/loghouse.wrl

Example using Animation - Hot Air Balloons

http://157.182.194.150/~vanscoy/balloons.wrl


Building a 3-D Model using OpenGL

OpenGL is an application programming interface (API) for developing interactive 2-D and 3-D graphics applications.

OpenGL manuals are available at URLs

http://userfs.cec.wustl.edu/~cs453/openGL1-man-html/
and
http://www.opengl.org/Documentation/Specs.html

A "work-alike" library called Mesa is available as freeware for Macintosh, Unix, and Windows systems. Information on Mesa can be found at:

http://www.opengl.org/Documentation/Implementations/Mesa.html

Some OpenGL examples are available at URL

ftp://ftp.aw.com/cseng/authors/angel/intcg/Prog_Files/
These examples compile, link, and execute without changes on the Onyx which drives the West Virginia ImmersaDesk.

OpenGL Example - A Birthday Cake

An example of a simple birthday cake (similar to the one built using VRML) modeled by OpenGL follows.

void draw_world(void)
{
    int i;
    GLint cylinder_slices;
    GLdouble axis_length;
    GLUquadricObj *cake;
    GLdouble cake_radius, cake_height;
    GLUquadricObj *candle;
    GLdouble candle_radius, candle_height;
    GLUquadricObj *flame;
    GLdouble flame_radius;
    char* text;
    char* text_index;

    glShadeModel(GL_SMOOTH);

    /**************************************/
    /* clear the screen -- very important */
    glClearColor(0.0, 0.0, 0.0, 0.0);
    glClearDepth(1.0);
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

    /* draw a white cylinder, the birthday cake */
    glPushMatrix();
        glColor3ub(255, 255, 255);
        glTranslatef(0.0, 0.0, 0.0);
        glRotatef(90.0, 1.0, 0.0, 0.0);
        cake = gluNewQuadric();
        cake_radius = 3.0;
        cake_height = 2.0;
        cylinder_slices = 1024;
        gluCylinder(cake,cake_radius,cake_radius,cake_height,cylinder_slices,1);
        /* draw a white circle, the bottom of the cake */
        glColor3ub(170, 170, 170);
        glBegin(GL_POLYGON);
            for (i = 0; i < cylinder_slices; i++) {
                glVertex2f(cake_radius * cos(  (float) i * 360.0 / (float) cylinder_slices ),
                     cake_radius * sin(  (float) i * 360.0 / (float) cylinder_slices ));
            }
        glEnd();
        /* draw a white circle, the top of the cake */
        /* we make the top of the cake a bit grey to show a distinction between top and sides */
        glColor3ub(0,0,0);
        glTranslatef(0.0, 0.0, cake_height);
        glBegin(GL_POLYGON);
            for (i = 0; i < cylinder_slices; i++) {
                glVertex2f(cake_radius * cos(  (float) i * 360.0 / (float) cylinder_slices ),
                     cake_radius * sin(  (float) i * 360.0 / (float) cylinder_slices ));
            }
        glEnd();
    glPopMatrix();
    /* draw a green cylinder, the candle */
    glPushMatrix();
        glColor3ub(0, 204, 0);
        glTranslatef(0.0, 2 * cake_height, 0.0);
        glRotatef(90.0, 1.0, 0.0, 0.0);
        candle = gluNewQuadric();
        candle_radius = 0.2;
        candle_height = 4.0;
        gluCylinder(candle,candle_radius,candle_radius,candle_height,cylinder_slices,1);
    glPopMatrix();
    /* draw a yellow sphere, the flame on the candle */
    glPushMatrix();
        glColor3ub(255, 255, 0);
        flame_radius = candle_radius;
        glTranslatef(0.0, candle_height + 3 * flame_radius, 0.0);
        flame = gluNewQuadric();
        flame_radius = candle_radius;
        gluSphere(flame, flame_radius, cylinder_slices, cylinder_slices);
    glPopMatrix();
    /* generate text that says "Happy Birthday!" */
    glPushMatrix();
        glColor3ub(255, 0, 0);
        glTranslatef(-8.0, 8.0, 0.0);
        glRotatef(85.0, 0.0, 0.0, 0.0);
        text = (char *) malloc(32);
        strcpy(text, "Happy Birthday!\0");
        glRasterPos2f(50.0, 0.0);
        for (text_index = text; *text_index; text_index++) {
            glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *text_index);
        }
    glPopMatrix();
}

This function is to replace "draw_world" in the file

http://www.ncsa.uiuc.edu/VR/VR/CaveTrain/OGL_examples/ex0_xwin.c
The following lines are to be added to the list of included files:
#include </usr/include/math.h>
#include </usr/include/string.h>
The call to glRotatef was changed to
glTranslatef(0.0, -2.0, -8.0);

To create the executable for this program, here is the Makefile:

OPTIMIZE_DEBUG_FLAG = -g
CAVEDIR = /usr/local/CAVE
CFLAGS = -I$(CAVEDIR)/include $(OPTIMIZE_DEBUG_FLAG)
LDFLAGS = $(OPTIMIZE_DEBUG_FLAG)
CAVE_LIBS = -L$(CAVEDIR)/lib32 -lcave_ogl  -lGL -lX11 -lXi -lm
GLX_LIBS = -lglut  -lGL -lGLU -lX11 -lm
GEOM_OBJS = shapes.o
flvs01: flvs01.c $(GEOM_OBJS)
        $(CC) $(CFLAGS) $(LDFLAGS) -o $@ flvs01.c $(GEOM_OBJS) $(GLX_LIBS)

Adding Calls to the CAVE Library to C and C++ Programs which use the OpenGL Library

Once an OpenGL model is built, then calls to the CAVE library can be added to provide interactivity.

NCSA has a set of sample C + OpenGL + CAVE library programs at http://www.ncsa.uiuc.edu/VR/VR/CaveTrain/examples_ogl.html

To run these programs on the West Virginia ImmersaDesk, edit Makefile by
(1) replacing

CAVEDIR = /afs/ncsa/packages/cave/IRIX_5.2
with
CAVEDIR = /usr/local/CAVE
(2) replacing
CAVE_LIBS = -L$(CAVEDIR)/lib -lcave_ogl  -lGL -lX11 -lXi -lm
with
CAVE_LIBS = -L$(CAVEDIR)/lib32 -lcave_ogl  -lGL -lX11 -lXi -lm

Also, your .caverc file should contain these lines (for running on the ImmersaDesk):

simulator n
displaymode stereo

These programs run correctly on the West Virginia ImmersaDesk.

Another set of C++ programs with calls to OpenGL and the CAVE library is available at http://www.ncsa.uiuc.edu/Vis/ImmersaVis/examples.html

With a change in the Makefile from

LDPATH  = -L/usr/local/CAVE/lib
to
LDPATH  = -L/usr/local/CAVE/upgrade/lib 
these programs generally compile and run here.

VRCO the commercial vendor for the CAVE libraries, has at

http://www.vrco.com/downloads/
a tarred collection, TEST.tar, of 4 test programs for the ImmersaDesk. We have been able to compile and execute the first 3 successfully, but not the 4th
caveloader.C
because it requires the OpenInventor library. Because we are currently using an updated version of the CAVE libraries, we had to change in Makefile the line
CAVEDIR = /usr/local/CAVE
to
CAVEDIR = /usr/local/CAVE/upgrade

Adding Sound to a Virtual Environment

Sound can be added to a virtual environment by use of VSS (the Vanilla Sound Server). A manual for VSS is available at http://cage.ncsa.uiuc.edu/adg/VSS/doc/vss3.0ref.html


West Virginia Faculty using the ImmersaDesk and Related Technologies

West Virginia University

Vic Baker is a researcher at the Concurrent Engineering Research Center and teaches a computer graphics class at West Virginia University. His interests in VR include entertainment in the form of animation, special effects, VR Gaming, immersive simulations (re-enactments which can range from accidents, crimes, or historical).

Patrick Conner is professor and chair of English at West Virginia University.

Barry Cooper is Benedum professor of physics at West Virginia University.

Jerald Fletcher is a professor of resource management at West Virginia University. His project is "Visualization of Monongahela Basic Mine Flooding." Water, contaminated with acid, often accumulates in mines and sometimes "punches through" to the surface or the water table, spreading the contamination. Professor Fletcher is currently studying mine pool flooding in the Monongahela Basin, with support from the EPA and the National Mine Land Reclamation Center. He is using the ImmersaDesk to show subsurface geology layers, mined out areas, and pool elevations from one mine to another to assist in predicting which areas are likely to experience blow outs and subsidence.

Peter Gannett is associate chair of basic pharmacutical sciences at West Virginia University. His research is in DNA antisense and triplex agents to inhibit the production of HIV protease. He has built models of HIV protease and DNA with minor groove binders example 1 and example 2 ). If a DNA binding agent is bound to the HIV portion of the DNA of a person with HIV, the production of HIV protease could be stopped. This would stop the spread of the infection to other cells, and when the infected cells died the patient would be cured. Finally, DNAs containing spin probes are being made and modeled to study DNA antisense and triplex agents in cells so that more effective drugs can be made.

Srinivas Kankanahalli is an associate professor of computer science at West Virginia University. Some of his VR-based research is in battlefield simulation.

Ramana Reddy is a professor of computer science and director of the Concurrent Engineering Research Center at West Virginia University.

Joe Sewash is Geographic Information Systems coordinator in geology and geography at West Virginia University and the West Virginia State GIS Technical Center. Trevor Harris, Gregory Elmes, and Joe Sewash in the WVU Department of Geology and Geography, and the West Virginia State GIS Technical Center are seeking to develop the linkages between geographic information systems (GIS) and immersive environments. Large geographic data sets offer a unique challenge for display and analysis that can be enhanced by visualization technologies. The group is also seeking to work with other groups to investigate the potential for distributed immersive environments; pushing the boundaries of distributed visualization as well as distributed processing in GIS.

George Trapp is a professor of computer science and chair of computer science and electrical engineering at West Virginia University. He leads a group which includes Hany Ammar, Bojan Cukic, Larry Hornack, Chip Klostermeyer, and Stephanie Schuckers and which does research in biometrics.

Frances Van Scoy is an associate professor of computer science at West Virginia University.

Susan Warshauer is an assistant professor of English and the coordinator of the Center for Literary Computing. There is a VRML model of the CLC at URL http://www.clc.wvu.edu/virtual/clc89.wrl Her project is "Virtual Literature Land." Professor Warshauer's VR work has two components. (1) As the first phase of the "West Virginia Literature Land" subproject her group is building a module on the life and work of David Hunter Strother (1816-1888). They are assembling and digitizing or creating textual representations of his literary works, graphical representations of his illustrations and of buildings and scenes related to his life, and ambient sounds related to the buildings and scenes. (2) Their work in typographic design extends work by others described as dynamic, kinetic, or liquid typography. Undergraduate Leonard Brown from Montgomery, West Virginia, is working with Dr. Warshauer to develop the project.

Concord College

David Fleming is an assistant professor of computer science at Concord College. His project is "Object Based Software Engineering in a Virtual Environment." In the past, programmers constructed software by writing distinct lines of code and assembling them into subprograms. In recent years, researchers and practitioners have experimented with constructing software out of larger reusable software components. Professor Fleming is developing some ideas of how to represent properties of reusable software components by properites of geometric objects such as shape, form, and motion, and then plans to build a 3-D virtual environment based on these ideas for building object-based software.

Joseph Manzo is a faculty member in geography at Concord College.

Carmel Vaccare is director of Academic Computing and Technologies at Concord College.

Salem-Teikyo University

Mark Hogan is a faculty member in physics at Salem-Teikyo University. His project is "3-D Visualization of Large-Scale Structure of Matter in the Universe" Two major 3-D surveys of galaxies, the 2dF survey and the Sloan Digital Sky Survey, are currently being conducted. Professor Hogan is using the results of these surveys and constructing a 3-D map of the universe. This map can then be used to make new discoveries about the structure of galaxy distribution.

Shepherd College

Jason Best is an assistant professor of astrophysics at Shepherd College. His project is "Visualization of the Las Campanas Redshift Survey as Analyzed by the Pointwise Dimension." The Las Campanas Redshift Survey is a public catalog of about 26,000 astronomical objects, with positional and redshift information for each object. Professor Best is using 3-D visualization to assist in his investigation of whether the observed clustering of galaxies in the universe can by modeled by fractal statistics, especially the pointwise dimension statistic.

Sara Maene is the senior research scientist in astrophysics at Shepherd College.

WVU Institute of Technology

William Gregory is dean of the Leonard C. Nelson College of Engineering of the West Virginia University Institute of Technology. His project is "Three Dimensional Visualization of Electrical Property Enhanced Tomography." Dean Gregory is applying his previous work in identification and classification of materials by electrical properties to measuring the electrical properties of living tissues. Early results suggest that his work will lead to measurements four to five orders of magnitude better than those currently possible.


Some Related Web Pages

Forum on Research Computing at WVU notes October 28, 1998

CS 288 Computer Graphics lecture notes on VRML October 29, 1998


Acknowledgements

The ImmersaDesk, the Onyx which drives it, and several O2 systems were purchased by West Virginia EPSCoR in summer 1998 to serve as a virtual environments facility for use by college and university faculty and students throughout West Virginia.

The system is currently housed with the department of Computer Science and Electrical Engineering at West Virginia Unviersity.

CAVE and ImmersaDesk are registered trademarks of the University of Illinois Board of Trustees. Onyx and O2 are registered trademarks of Silicon Graphics, Inc.


For More Information

For more information contact Frances L. Van Scoy, West Virginia EPSCoR, 886 Chestnut Ridge Road, P. O. Box 6845, Morgantown, WV 26506-6845, telephone (304)293-2466, fax (304)293-8155, e-mail fvanscoy@wvu.edu.