CPSC 611 Virtual Reality
Assignment #3 - VR Tour
John P Heminghous and Jamie Kelley
Demo'd 11/11/05
For this project, we were to create a virtual building that served as a museum or gallery and implement a program to allow walk-through using the head-mounted display and VR mouse.
About the program ~
We wrote code to parse our obj model file and import the geometrical data along with the material and texture properties defined in the associated mtl file. Our program functions with the Flock of Birds (FOB) position tracking system in order to orient the display relative to the user's head position. The user's forward and backward movement is controlled by mouse clicks (left to move forward, right to move backward). A programmer defined inter-occular distance is defined (subjectively relative to the scenesize) in order to achieve binocular vision. In addition to the requirements we implemented collision detection. We use another obj file in addition to the object to be displayed that contains a bounding box.The viewer then stays a programmer-defined distance above the plane directly below them and away from any wall intersected by the direction vector. The detection algorithm is based on the ray/plane intersection test commonly used in ray tracing defined by:
t = (-d - (N . sp)) / (N . (dp - sp)) (distance to intersection)whereax + by + cz + d = 0,N = (a, b, c),sp = eye point,anddp = direction vector (normalized).
We ran into problems using the position/matrix mode of the FOB. After numerous failed attempts of trying to use the provided matrix values, we decided to switch to position/angle mode. We were easily able to get the program working correctly using the provided angles. We also ran into a problem because we forgot to call glLoadIndentity() before defining a newModelview matrix using gluLookAt(). This problem resulted in the accumulation of Modelview matrices and erratic accumulated effects with the display. The last two problems we encountered were with the collision detection. It was possible sometimes (especially while moving up a ramp in the bounding box) to "fall through" the floor. We corrected this problem by: shooting a ray along the direction vector to detect forward or backward motion, shooting a ray straight down to detect the floor, and additionally shooting a vector straight up in case we go under the floor with the forward motion. The second collision detection problem we faced was that our bounding box model is not completely wound correctly (all faces in counter-clockwise order). Because our obj parser generates its own normals, some of the bounding box walls can be passed through because the normals are in the wrong direction.
Screen captures from viewer renders ~
About the environment ~
To create an interesting setting for our art gallery, we chose an oriental temple complex set on a mountaintop. There are areas of interest both indoors and outdoors. Within the main building, there are several art objects on display. The main exhibit features paintings of the twelve animals of the Chinese zodiac painted by artist James Tan, obtained from the internet. Also on display are several fans featuring various artworks as textures, and a folding screen.
Outside, the complex features a monastery bell house, a zen rock garden, and a shrine enclosing a statue of the Maneki Neko, a Japanese cultural icon believed to bring good fortune. The program begins at the start of a staircase which ascends the mountain through a series of Torii gates to the main complex. Environmental fog creates a realistic haze over distant objects.
The buildings are based on 3D architecture obtained from the internet, then modified and adapted to our environment. Alias Maya was used to create and edit the environment. This environment utilizes roughly 32,000 faces. Texturing was also done through Maya, which created several problems. As we were unable to achieve satisfactory lighting effects in OpenGL (thanks in part to the necessity of low polygon counts in a large, complex VR environment), we chose to use texture files for every surface. We had some nasty surprises in both the OpenGL mouse viewer and the VR helmet display with colors displaying in unanticipated ways. We were also unable to tile texture files as specified in the mtl file, and chose to use a few larger, hand-tiled textures instead. These had to remain fairly low in resolution to allow for timely update of the VR display. Finally, there was a problem with texture vertex winding, and every texture displayed upside-down. To solve this, we simply flipped every image.
Sample renders from Maya ~