CPE 471 Final Project

 

Object Deformations using Vertex Manipulation

 

 

Arvin Faruque     CPE 471 S1     Dr. Wood

 

Overview          Background          Motivation          Description          Implementation        Instructions       Screenshots         Sources

 

Overview

Vertex transformations facilitate the realistic deformation of objects. In this program, a user is able to manipulate 3-D model of a fish, which appears to wave, ripple, and melt in realistic manner. The fish is shown from an eye level camera that can be rotated and translated.

 

Background

In the past decade, tremendous improvements have taken place in the field of real-time computer graphics animation. Spurred by the growing popularity of computer entertainment and the availability of powerful hardware, real-time animations today near a level of an unearthly complexity. It is common to see computer generated figures that walk and talk just like humans. Particle system technology has allowed the imitation of real world phenomena such as water and fire.

There is potential for improvement in this field, however. As the demand for realism increases, new technologies must be explored in order to facilitate these improvements. The precise manipulation of geometry and material properties of a 3-D object are among these issues.

 

Motivation

Figures in modern computer programs are generally deformed using hierarchic modeling and division. That is, they are made up of smaller, static objects that are linked together in a realistic order to be rotated and translated in. This allows the simulation of the bending and deformation of a flexible object. However, when used in practice, objects usually look obviously divided and succumb to problems such as clipping.

A solution to this problem is to use vertex transformations instead of object transforms. Because a model is already divided into vertices, the individual manipulation of vertices gives the highest precision when transforming the model. It allows the object to move realistically and allows better handling of clipping. In addition, it eliminates the multiple coordinate systems and object division required for hierarchic modeling.

 

Program Description

This program gives the user a chance to play with an object (a fish) using vertex deformations. The deformations available are wave, ripple, and melt.

The wave deformation causes the object to wave with respect to time. This is implemented by displacing each vertex with respect to its height. By taking the sign of the height and adding it to the width and depth values, the geometry appears to shift in two directions. When a time variant parameter is added to the sin function, it causes the displacements to vary, thereby giving the appearance of realistic wave motion. Note that this is deformation can be relatively quickly, as only one sin() function is called in it.

Rippling and melting are handled in a similar manner. The ripple function uses a displacement dependent on a Gaussian function of the vertex height. Melting also does this, but it also varies the height of the entire object with time. Both of these functions have to be simplified, as they require multiple exponential functions. All deformations are toggled using mouse menus, with options to set the amplitude and speed of the wave and ripple functions.

To give the user a more interesting environment to operate in, the object is shown in a simple room with furniture. Using other mouse and keyboard functions, a user is able to look and walk around in this room. Spherical texture mapping is also used to give the object a shiny metallic appearance and to emulate shadows on the furniture.

 

Program Implementation

Variables:

- integers representing current mouse state, textures, objects, and deformers

-       vector<> containing all objects and textures

Structures:

- vect3D: Representation of a 3-D vector.

- vert3D: Representation of a 3-D vector, but also with a normal (for Gourad shading).

- triMesh: Representation of a 3-D triangle with a normal (for flat shading).

- object3D: Representation of an 3-D mesh, containing a list of vertices, faces, colors, and a pointer to a texture.

- materialSt: Representation of an OpenGL material with diffuse, ambient, and specular properties.

- texImage: Representation of an OpenGL texture with a data array and size.

Methods:

The methods in this program are divided in to the following categories:

- Normal OpenGL methods (reshape, display, etc).

- Mathematical commands to for vectors.

- Methods to load textures and objects.

- Methods to texture and light the scene.

- Methods to deform a mesh object.

- Methods to set the deformer and its attributes.

- Methods to translate the camera.

The following diagram shows how some of the main methods link with one another in the program:

 

           

Screenshots

These screenshots were taken on a system running Mac OS 10.2.

 

 

Program with menus displayed

 

 

Ripple function with Amplitude set to Large

 

 

Melt function

 

Program Instructions

Mouse Commands:

Click the RIGHT mouse button and hold down to get a menu with program options.

Click the LEFT mouse button and hold down to look around.

Keyboard Commands:

Toggles:

- ÔrÕ to reset camera (Note: use only when the camera is not rotating).

- ÔlÕ to toggle camera cycling.

- ÔeÕ to toggle between flat and Gourad shading.

Movement:

- ÔwÕ to move forward.

- ÔsÕ to move backward.

- ÔdÕ to move to the right.

- ÔsÕ to move to the left.

 

Sources

1.     A page that documents the Wavefront OBJ file format.

Obj format, http://www-sfb288.math.tu-berlin.de/eg-models/formats/Format_Obj.html

 

2.     Documentation on OpenGL multisampling on Mac OS X.

OpenGL for Mac OS: Multisample Pixel Formats, http://developer.apple.com/documentation/GraphicsImaging/Conceptual/OpenGL/chap3/chapter_3_section_5.html

 

3.     A simple explanation of texture mapping in OpenGL.

GameDev.net Ð OpenGL Texture Mapping: An Introduction, http://www.gamedev.net/reference/articles/article947.asp

 

4.     A resource on automatic texture coordinate generation and spherical mapping.

glTexGen Subroutine, http://molt.zdv.uni-mainz.de/doc_link/en_US/a_doc_lib/libs/openglrf/glTexGen.htm

 

 

 

 

 

 

By Arvin Faruque

Last revised December 4, 2003