home 

homeproductscompanytechnology   
real-time 3dinternet kioskfuture projects
    
Overview    
Video     
Screen Shots     
Design     
Plan     
History     
Team       

Development Plan 
Table of Contents  
Introduction   
Editor   
Graphics   
Hardware  
Architecture   
Data  
Code  
Demo  
Motion Capture   
Networking 
Scoring   
Tools   
Team   
Behavior   
3D 

       
real-time 3dVertigo PC Plan    
Data Structures    

There are several data structures referred to in this document. Some are imposed on the project by file formats. The most important ones for this project, the ‘.x’-file format and the ‘.htr’-file formats are described here.   

The most essential Vertigo-internal is the elementInfo structure. It is outlined here and described in brief.    

The ".X"(Direct3D Mesh) File Format   

General Description:   

[contains excerpts from the DirectX help file, copyright Microsoft Corp.]   

The ".X" file is the file format used by Microsoft’s Direct3D API. The Direct3D file format stores meshes, textures, animation sets, and user-definable objects, facilitating the exchange of 3D information between applications. Support for animation sets allows predefined paths to be stored for playback in real time. Instancing and hierarchies are also supported, allowing multiple references to a single data object (such as a mesh) while storing the data for the object only once per file.    

The DirectX Software Development Kit (SDK) includes conversion tools (Conv3ds.exe and Convxof.exe) that allow you to convert files from 3DS files generated by Autodesk 3D Studio and from XOF files that were generated for earlier versions of Direct3D.    

The Direct3D file format is used natively by the Direct3D Retained-Mode API, providing support for loading predefined objects into an application and for writing mesh information constructed by the application in real time.   

The file format itself is an ASCII format, and would be relatively easy to convert to/from other file formats or internal data representations. It appears to be essentially an "object dump", with "C-style" descriptions of "structs" followed by the data comprising those structures. For example, a "Vector" is described as a structure composed of three floating point coordinates, a "Mesh" as a set of vertices (i.e. an array of Vectors) along with an array of tuples defining the triangular faces of the mesh in terms of those vertices.   

For example, here is a portion of a simple .X file representing a three-dimensional box which is centered at [0,0,0] and has a width of 3.0 units.   

template Vector {   

<3D82AB5E-62DA-11cf-AB39-0020AF71E433>   

FLOAT x;   

FLOAT y;   

FLOAT z;   

}   

template MeshFace {   

<3D82AB5F-62DA-11cf-AB39-0020AF71E433>   

DWORD nFaceVertexIndices;   

array DWORD faceVertexIndices[nFaceVertexIndices];   

}   

template Mesh {   

<3D82AB44-62DA-11cf-AB39-0020AF71E433>   

DWORD nVertices;   

array Vector vertices[nVertices];   

DWORD nFaces;   

array MeshFace faces[nFaces];   

[...]   

}   

Mesh {   

21;   

-1.5000000; -1.500000; -1.5000000;,   

-1.5000000; -1.500000; -1.5000000;,   

-1.5000000; 1.500000; 1.5000000;,   

-1.5000000; 1.500000; 1.5000000;,   

-1.5000000; 1.500000; -1.5000000;,   

-1.5000000; 1.500000; -1.5000000;,   

-1.5000000; 1.500000; -1.5000000;,   

-1.5000000; -1.500000; 1.5000000;,   

-1.5000000; -1.500000; 1.5000000;,   

-1.5000000; -1.500000; 1.5000000;,   

1.5000000; -1.500000; -1.5000000;,   

1.5000000; -1.500000; -1.5000000;,   

1.5000000; -1.500000; -1.5000000;,   

1.5000000; 1.500000; 1.5000000;,   

1.5000000; 1.500000; 1.5000000;,   

1.5000000; 1.500000; -1.5000000;,   

1.5000000; 1.500000; -1.5000000;,   

1.5000000; 1.500000; -1.5000000;,   

1.5000000; -1.500000; 1.5000000;,   

1.5000000; -1.500000; 1.5000000;,   

1.5000000; -1.500000; 1.5000000;;   

12;   

3;6,9,3;,   

3;6,1,9;,   

3;17,0,5;,   

3;17,12,0;,   

3;14,4,3;,   

3;14,16,4;,   

3;20,2,8;,   

3;20,13,2;,   

3;11,7,1;,   

3;11,19,7;,   

3;18,15,14;,   

3;18,10,15;;   

}   

.HTR File Format   

General Description:   

[The following was excerpt ed and paraphrased from HTRSPEC.DOC, copyright Motion Analysis Corp.]   

In animation related applications there are predominately two basic methods to represent the segment rotations and positions in a file: Globally and Hierarchically. In this document two file types are described: the Global Translation and Rotation (.gtr) file and the Hierarchical Translation and Rotation (.htr) file.    

[Note: The HTR file format will be used for the Vertigo project.]   

The files are divided into sections by section keywords which are contained within square brackets ([]). The section keywords in the GTR file are [Header], [SegmentNames&Hierarchy], and then the data for each segment which occurs after each keyword segment name. For example, [LowerTorso]. The section keywords are the same in the HTR file except for the addition of the [BasePosition] section keyword.   

Under the [Header] section keyword there are a number of header keywords which are not contained within square brackets. There is one header keyword and value per line. These keywords and values specify various characteristics of the data in the file, e.g. "units of measurement" and "Euler-angle rotation order". All values are separated from the header keywords by the horizontal tab character.   

The hierarchical representation uses the concept of child and parent segment where the child segment’s rotations and translations are relative to the parent segment’s orientation and position. The hierarchy begins at the "Root" segment which in many cases is near the body’s Center of Mass. For the example below, the Root segment is the Lower Torso segment. All translations and rotations of the Root segment are relative to the global coordinate system, and therefore in the example the parent of the LowerTorso is specified to be GLOBAL. The segments that are distal (i.e."away from") the Lower Torso (which would be the Upper Torso, LThigh and RThigh) are all children of the Lower Torso. All translations and rotation values for these "first child" segments are reported relative to the coordinate system of the Parent (which in this case is the Lower Torso). This process continues (i.e. recurses) for each segment.    

The "BasePosition"of the data is a position and orientation of the actor, selected either from a frame in the current "shoot" or from a base position in a previous ".htr" file. The BasePosition represents the zero position and orientation of all the HTR segments. Also contained in the base position section is the "Bone Length", which is a measurement of the long axis of each segment as calculated from the joint. This measurement is reported in the units defined in the "header" section.   

elementInfo Structure   

General Description:   

The elementInfo structure holds every visible object in the Vertigo world. Walls, pylons, barrels, the sky, lights, and the camera are all objects represented by the elementInfo structure. The structure contains the object’s rendering information, physical information, collision detection information and behavior.   

The rendering information consists of transparency flags, rendering quality, visibility, associated mesh file and associated texture file.   

The object’s physical information includes its absolute position and orientation, its mass, velocity, acceleration, angular velocity and acceleration.   

The elementInfo structure also specifies whether the object can move or collide with other objects, and how it collides with them (which collision detection routines apply.)   

The behavior of the object, if any, is specified by the name of the object’s behavior code. Under Windows, this is specified by a DLL file.   

    

typedef struct _elementInfo   

{   

char RLType;   

char meshName[30]; // Name of mesh (xof)   

char textureName[30]; // Name of texture to apply   

vector center; // In case it's not 0,0,0   

vector position; // Object's position   

vector scale;   

BOOL transparent;   

BOOL visible;   

LPDIRECT3DRMFRAME frame;   

LPDIRECT3DRMMESHBUILDER mesh;   

float shininess;   

float sharpness;   

vector orientation; // Direction vector   

vector observerUp; // Up in this element's world view   

vector velocity;   

vector axisOfRotation; // The axis the object spins about   

float angularVelocity; // How fast it spins   

float acceleration;   

float angularAcceleration;   

vector oldPosition;   

short renderQuality;   

char perspective;   

short objectType;   

float radius; // This is for spheres and cylinders   

float friction; // Single coefficent. Keep your static and kinetic!   

short mainSegment;   

short secondarySegment;   

short lastIndex;   

short numberOfPivots;   

float pivotDistance;   

pivotInfo *thePivotInfoArray;   

float mass;   

char behavior[30]; // Name of texture to apply   

PFNDLL behaviorPointer;   

} elementInfo;