8

The RTG Utilities and File Format

In This Section:


Introducing the RTG File Format


RTG File Formats

RTG and AnimRTG are portable (ASCII) file formats for 3D models and animation, suitable for game authoring. These formats enable the different game platforms and non-standardized PC development environments to share 3D data.

Although the RTG formats are not standards (governed by a committee), then are designed to be very easy to parse and translate, allowing easy creation of new translators on any platform.

Alias|Wavefront now supplies RTG 2.0, based on the Direct Translator (Dt) API (it's creation was based on the OpenModel API). RTG 2.0 gives you the following benefits:

  • You can use MakeGame to output RTG files, instead of external utilities.
  • You can save geometry and animation in the same file.
  • Dt API is much more suited to translating interactive media than OpenModel.
  • Dt API provides more functions to the programmer, such as built-in and transparent conversion of projective textures to parametric textures.

>
Note: Up to version 1.8, Alias|Wavefront RTG and AnimRTG converters were based on the OpenModel API. Alias|Wavefront still supplies this product as a converter for OpenModel.

Changes in RTG 2.0

RTG 1.8 and RTG 2.0 are very similar. The following list shows some features available only to RTG 2.0:
  • interface: RTG 2.0 is a Direct Translator
  • file format: resides in a single file containing both animation and geometry (eliminates the need for the AnimRTG format)
  • textures:
    • outputs path references to source texture files
    • outputs projective textures
  • materials: outputs materials
  • polygons: sorts polygons inside polysets by shader and texture, effectively treating the sorted groups as separate objects
  • simplifications:
    • under-utilized functionality was removed to simplify source code and streamline the conversion process
    • source code provided is simple (/usr/aw/alias/ODS/Games/source/)

Updates

Alias|Wavefront plans to update the RTG applications periodically. All future development of RTG will be based on RTG 2.0, which is supplied as a converter for OpenModel.

The source code for the Dt API and translators is included in /usr/aw/alias/ODS/Games/source/.


Converting to RTG 2.0


This section describes how to use the interface of the RTG 2.0-specific Direct Translator.

For information on how to run the translator, see Using the MakeGame Plug-in on page 7 and Using Translators from the Command Line on page 14.

RTG 2.0 Translator

Special Features

  • Geometry, texture, and hierarchy information converted.
  • Choice of polygon output: triangles only, quads only, triangles and quads, degenerate quads as triangles, and N-sided polygons.
  • The RTG file format is easily parsed and converted.

Installing

The Direct3D translator doesn't require special installation.

Options

When you run the translator from MakeGame, the RTG window appears. Use this window to set the options described below, then click OK to start converting.

File Content Section

Use these options to control which parts of the scene are converted.

Hierarchy Section

Output Pivots w/hierarchy

Outputs pivot information for each node in the hierarchy.

Output Transformation

    • ON - outputs descriptions of transformations.
    • OFF - outputs static geometry in world space.

Output Local Transformation

Outputs transformation matrices for each node in the hierarchy.

Animation Section

Output Animation

Outputs animation information. The translator converts the frames specified in the MakeGame window.
For output details on the .rtg and .bin file formats, see RTG File Format Details on page 118.
>
Note: The RTG 2.0 translator's option window does not duplicate controls from the MakeGame window like some other translators. To run the RTG 2.0 translator, make sure to set up the MakeGame window properly before clicking Go.

Exporting Geometry to RTG 1.8


Installing

To convert scenes to RTG 2.0, use the MakeGame and the RTG 2.0 Direct Translator.

See Installing the MakeGame Plug-in on page 4 and RTG 2.0 Translator on page 106.

To install the RTG 1.8 converter as an external application in Alias:

1
In Alias, choose File > External Apps. The External Applications window appears.
2
Open the External Applications section and click Go.

3
Double-click in the Application Name text box and enter:
$ALIAS_LOCATION/ODS/Games/bin/rtg %i

4
Open the Application Input section. Turn Write Input on. In the Input File text box, enter:
rtg_output_wire.temp

5
Open the Application Output section. Turn Read Output off.
6
Click Go.
The converter window will open. Click Cancel to close it if you don't want to convert geometry now.

Using the RTG Converter

To convert a scene to a RTG 1.8 format file:

1
Choose File > External Apps. The External Applications window appears.
2
Click /usr/aw/alias/ODS/Games/bin/rtg %i in the Application Name box.
3
Open the Application Input section. Choose whether to convert ALL objects or ACTIVE objects from the Input Scope pop-up menu.
"Active" objects includes picked objects and all objects below them in the hierarchy graph.
4
Click Go to launch the converter.
The Wire to RTG v1.8 window appears.

5
In the Path for Output text box, enter the path of the output directory.
6
In the Output File Prefix text box, enter the base name for the output files, to which the converter will add frame numbers and suffixes for different file types (such as .rtg and .bin).
7
Set the options described below, then click Save to run the converter.
A terminal window will display any updates or error messages.

Options

Path for Output

The directory where output files are created.

Output File Prefix

The base name for the output files, to which the converter will add frame numbers and suffixes for different file types (such as .rtg and .bin).

Object Level

Determines what level of organization in the Alias wire file corresponds to an object (which has a vertex list and polygon list) in the RTG file. The Polyset w/hierarchy option uses object space coordinates. All other options use world space coordinates. Choose from:
    • All Processed - the entire wire file is treated as one object with one vertex list and one polygon list.
    • Top Level DAG - each top-level node is treated as an object.
    • Polyset - each polyset is treated as an object.
    • Polyset w/hierarchy - each polyset is treated as an object, and hierarchy information is included. This is the only way to include hierarchy information in an RTG 1.8 file.

Hier.Xform Output

    • ON - outputs transformation matrices from the hierarchy.
    • OFF - outputs fixed geometry.

Scaling is only applied when no hierarchy is being output, since scaling would disrupt transformations applied to vertices in object space.

Scale Factor

The scaling factor for vertex coordinates (use this option to fit the model inside game box).

Geometry Mode

    • Tris Only - outputs triangles only. Quadrangles are converted to triangles; no other polygons are output.
    • Quads Only - outputs quadrangles only . Triangles are converted to degenerate quadrangles (quadrangle with two points at the same location); no other polygons are output.
    • Tris & Quads - outputs triangles and quadrangles; no other polygons are output.
    • Tri/Quad Degen - outputs triangles and quadrangles. Degenerate quadrangles (quadrangle with two points at the same location) are converted to triangles; no other polygons are output.
    • N-sided - outputs all polygons. Note that textures on polygons with fewer than 3 or more than 4 sides are not useful.

Vertex Orientation

    • Clockwise - uses clockwise (left-handed) orientation to determine which side of a polygon is the front.
    • Counter-Clockwise - uses counter-clockwise (right-handed) orientation to determine which side of a polygon is the front.

Quad to Tri Strip

Outputs quadrangle vertices in triangular strip format.
Triangular strips can fix problems arising from non-planar quadrangles. This option can be useful to bring geometry into a GL/OpenGL program that uses triangular strips.
This option is not used when the Geometry Mode is Tris Only or N-sided.

Output Vertex Norms

Outputs a list of vertex normals for each object, with indexes for each polygon in the object.

Output Texture Coord

Outputs a list of texture coordinates for each object, with indexes for each polygon in the object.

Output Polygon Norms

Outputs normals for each polygon.

Output Vertex Colors

Outputs a list of vertex colors for each object, with indexes for each polygon in the object.

Vert/VNorm Optimize

Does not output redundant vertices or normals.

Generate Textures

Outputs graphics files containing the texture images.

Texture Output

The standard format to save texture information in.

Texture Res X and Texture Res Y

The default resolution for all textures. Maximum value is 256 in both directions.

Texture Mode

    • Texture per Shader - outputs a texture for each shader. A texture is generated for each shader that is assigned to polygons and has a texture or other mapping.
    • Texture per Polygon - outputs a texture for each polygon. A texture is generated for each polygon with a shader that has a texture or other mapping. Textures are automatically distorted for irregular quadrangles and triangles.
    • Color Only - uses flat color only (do not output textures).
If Texture per Shader or Texture per Polygon are selected, but a shader does not use textures or mapping (a simple color shader), the translator will output a color value instead of a texture.

Encoded Tex Res

    • Use Shader Name - encodes a texture's resolution information as part of the shader name.
    • Use Polyset Name - encodes a texture's resolution information as part of the polyset name.

See Encoding Texture Resolutions on page 114.

    • NONE - uses the default X and Y resolutions (above) for all textures.

Simple Lighting

Modifies the colors of objects to simulate a simple light model (parallel with some ambient light).

Show Index Counters

Outputs index counters at the beginning of each list entry. Index counters start at 0 for the first entry of a list and increase with each entry in that list.

Format Precision

The number of decimal places to include for numbers. (the maximum is 10).

Newline

    • DOS - uses DOS/Windows standard character marker (carriage return + linefeed) for the end-of-line character.
    • UNIX - uses UNIX standard character marker (linefeed) the end-of-line character.

Show Session Params

Outputs the conversion settings (since RTG output is so flexible, it is extremely helpful when decoding to know the settings a file was converted with).

Feedback Level

    • per Polygon - prints a progress message for each polygon during conversion.
    • per Polyset - prints a progress message for each polyset during conversion.
    • Almost None - does not print progress messages during conversion.

Start Frame and End Frame

The start and end frames of animation (a separate file is created for each frame of animation).

Encoding Texture Resolutions

RTG uses a hack to include the resolution of textures in the file:

  • For each texture you want to include special resolution information for, you must enter the resolution information as part of the shader or polyset's name.
  • If the translator finds resolution information encoded in the name of a shader or polyset (depending on the setting of Encoded Tex Res), it will use that information.
  • If the translator cannot find encoded information, or if you choose NONE from the Encoded Tex Res pop-up menu, the translator will use the default X and Y resolutions in the translator options window.
  • If Texture Mode is set to Texture per Polygon and Encoded Tex Res is set to Use Polyset Name, a decoder will take the texture resolution from the first polyset name.

To encode a texture resolution in a shader name:

1
In Alias, open the Multi-lister (Windows > Multi-lister > Shaders).
2
Double-click the name box of the Shader icon in the Multi-lister.
3
Type the following:
x<xres>y<yres><shadername>

For output details on the .rtg and .bin file formats, see RTG File Format Details on page 118.

For example, for a shader named GoblinNose, and a texture with resolution 64 by 128, type x64y128goblinNose in the name text box.

There is no explicit control for outputting hierarchy. To output hierarchy information, you must choose Polyset w/hierarchy from the Object Level pop- up menu.

To encode a texture resolution in a polyset name:

1
In Alias, pick all the polysets you want to rename.
2
Open the Render Stats window (Windows > Render stats).
3
Double-click on the polyset name you want to edit.
4
Type the following:

The Polyset w/hierarchy option in the Object Level pop-up menu outputs object space coordinates. All other options use world space coordinates.

x<xres>y<yres><polysetname>
For example, for a polyset named GoblinNose, and a texture with resolution 64 by 128, type x64y128goblinNose in the name text box.

Exporting Animation to RTG 1.8


To convert scenes to RTG 2.0 (which integrates animation information into the main format), use MakeGame and the RTG2.0 Direct Translator.

See Installing the MakeGame Plug-in on page 4 and RTG 2.0 Translator on page 106.

Using the rtgAnim Utility

The rtgAnim utility and file format were created to supplement the RTG 1.8 format with animation information.

rtgAnim outputs an ASCII representation of the animation for each animated transformation, vertex group, and polyset. The utility outputs the following information:

  • Animation channels on DAG-level objects.
    • Vertex animation in object space.
    • Cluster animation in world space.
  • One file is created for each animated node in the scene.
  • Files are plain ASCII, with one frame per line.

rtgAnim is in $ALIAS_LOCATION/ODS/Games/bin/. It supports the following command line options:



rtgAnim -i <inputfile> -o <outputfile> [-l] [-s 
<startframe>] [-e <endframe>] [-b <byframe>] [-y] 
[-z]

-i inputfile Valid Alias wire file for input.
-o outputname Base name of the output files, to which rtgAnim appends the frame number or node name for animation files. Note: because rtgAnim can create so many files, it will help if you output the files for each project into separate directories.
-s startframe First frame of animation to convert.
-e endframe Last frame of animation to convert.
-b byframe Number of frames to step between each frame converted. (For example, a step value of 2 means convert every second frame).
-y Use a Y-up world.
-z Use a Z-up world.

Output

  • A file named <outputname>_<nodename> for each animated node.
  • A file named <polysetname>_<vertex number> for each animated vertex.

Node Files

These files contain the animation data for objects in the scene:

  • The first column of a line is the frame number.
  • The rest of the columns list the transformation types and values for the particular frame.

The contents of an rtgAnim node file look like this:



0001.0: X_Rotate 1.58   Y_Rotate 0.928  Z_Rotate 0.972
0003.0: X_Rotate 4.74 Y_Rotate 2.784 Z_Rotate 2.916
0005.0: X_Rotate 7.9 Y_Rotate 4.64 Z_Rotate 4.86
0007.0: X_Rotate 11.06 Y_Rotate 6.496 Z_Rotate 6.804
0009.0: X_Rotate 14.22 Y_Rotate 8.352 Z_Rotate 8.748

This is a sample of frames 1 through 9, by two. Only the rotations were animated in the model, so they are the only transformations output.

>
Note: For cluster animation, the fields are in world coodinates. For all other types of animation (including keyframed vertices), the coordinates are in object space.

Vertex Files

The contents of an rtgAnim vertex file might like this:

0001.0: X_Translate -0.806515 Y_Translate 0
0002.0: X_Translate -0.457943 Y_Translate 1
0003.0: X_Translate -0.10937 Y_Translate 2

This is a sample of frames 1 through 3.

>
Note: For polysets animated with clusters, the world positions per vertex per frame are output, since it is difficult to work in object space with clusters.

RTG File Format Details


The following describes the Alias|Wavefront Real Time Games Format (v1.0). Running the wire2rtg converter generates an ASCII text .rtg file, and possibly a .bin file (if textures have been assigned to polygonal geometry in PowerAnimator). The .rtg file contains polygonal data with possible hierarchy information and possible texture table data. The .bin file contains a byte oriented RGBA pixel dump of all textures generated for its corresponding .rtg file.

The .rtg file contains various tags including title tags, to denote sections of data, and descriptor tags, which are used for visual reference and can be ignored when parsing the file.

Polygonal Data File (.rtg)

Header Info

The polygonal data (hereafter referred to as P-data) file begins with a number of header lines (currently there are 3 header lines).

These header lines contain general information for the file. So far, only the title, version, and date information header lines are generated.

All header lines begin with tags starting with HEADER_. The following is an example of these lines:

This example is RTG 1.8 only



HEADER_TITLE Alias|Wavefront Real Time Games Output 
HEADER_VERSION v1.0
HEADER_DATE Tue Aug 15 21:58:15 1995

Counter Info

Counters for the P-data file appear after the header lines. Currently there is only one counter. This is for the number of objects that exist in the file. All counter info lines will begin with tags starting with NUMBER_OF_. For example:



NUMBER_OF_OBJECTS 4

Flags Info

If there are any flags for the P-data file, they appear after the counter information. These indicate which particular items will be included in the file. For example, the flag info line OUTPUT_HIERARCHY on indicates that a hierarchy tree will be included in the file.

This version provides the following flags:

  • OUTPUT_VERT_NORMS - indicates whether a NORMAL list for vertex normals is included in this file or not.
  • OUTPUT_VERT_COLORS - indicates whether a COLOR list for vertex colors is included in the file or not.
  • OUTPUT_TEX_COORDS - indicates whether a TEXCOORD list for vertex texture coordinates is included in this file or not.
  • OUTPUT_POLY_NORMS - indicates whether normals for each polygon will be output on a polygon data line or not.
  • OUTPUT_HIERARCHY - indicates whether a hierarchy tree is included in this file or not.
  • OUTPUT_MATERIALS (RTG 2.0 only) - indicates whether materials are included in this file or not.
  • OUTPUT_ANIMATION (RTG 2.0 only) - indicates whether animation data is included in this file or not.
  • SHOW_INDEX_COUNTERS - indicates whether or not index counters (sort of like line numbers for each list starting at 0) are included in this file or not.

This is an example of a Flags info section:



OUTPUT_VERT_NORMS   on
OUTPUT_VERT_COLORS on
OUTPUT_TEX_COORDS on
OUTPUT_POLY_NORMS on
OUTPUT_HIERARCHY on
SHOW_INDEX_COUNTERS on
OUTPUT_MATERIALS on
OUTPUT_ANIMATION on

Selections Info (RTG 1.8 only)

The Selections Info section follows the Flag info section. It contains the various modes that had been selected when this file was generated.

Currently there is only one selection line: TEXTURE_MODE. Modes that are currently supported are color, per_shader, or per_polygon.

If color mode is indicated, only RGB color assignments are made to polygons and no textures are generated for this file.

If per_shader is indicated, a texture for each used shader is assigned to polygons, with texture coordinates needed for proper texture mapping.

If per_polygon is indicated, a correctly pre-distorted texture swatch is generated for each polygon, (texture coordinates are mostly meaningless, as these textures effectively map directly to the corners of each polygon.)

The Material List (RTG 2.0 only)

The material list contains a list of all materials used in the model. The MATERIAL_LIST line contains a count of the number of materials. Each material is named and has an index which is used in the OBJECTS section to reference the materials.

The following is an example:



MATERIAL_LIST 2
MATERIAL 0
NAME Shader
AMBIENT 0.000000 0.585938 0.996094
DIFFUSE 0.000000 0.468750 0.796875
SPECULAR 0.000000 0.000000 0.000000
EMMISION 0.000000 0.000000 0.000000
SHININESS 0.000000
TRANSPARENCY 0.000000
TEXTURE_NAME File#10
FILENAME color file /usr/u/psantan/user_data/ demo/pix/small.rgb
MATERIAL 1
NAME DefaultShader
AMBIENT 0.000000 0.585938 0.996094
DIFFUSE 0.000000 0.468750 0.796875
SPECULAR 0.000000 0.000000 0.000000
EMMISION 0.000000 0.000000 0.000000
SHININESS 0.000000
TRANSPARENCY 0.000000
END_MATERIAL_LIST
>
Note: This is the location in RTG 2.0 that enables you to find texture maps.

The Hierarchy List

A Hierarchy list only exists in the file if the OUTPUT_HIERARCHY flag is set ON. Otherwise, parsing should continue with OBJECT Data as described in the following sections.

List Tags

The first line of a hierarchy list begins with the tag HIERARCHY_LIST. There are three tags that follow this on the first line.

The first of these is the Info Level Tag. This tag can be H (Hierarchy only), HX (Hierarchy with Xforms), or HXP (Hierarchy with Xforms and Pivots).

A count for the number of top level DAG nodes in the hierarchy list, and a descriptor tag top_level that can be read and ignored, follows the Info Level Tag.

After the first line, the hierarchy is output with node lines, and possibly transform lines and pivot lines.

Node lines are of the format:



 [level] [node_type] [node_name]

where level is an integer number indicating hierarchy level. A top DAG node is at level 0.

The node_type is either G (Group) or P (Polygonal) data.

The node_name is a string name used to individually identify a node.

Using the Hierarchy List

If Hierarchy List is selected, transforms with or without pivots can be output for each node line of the hierarchy. Transform lines are (x,y,z) triplets, one for each of translate, rotate and scale. Pivot lines are (x,y,z) triplets, one for each of scale and rotate.

The following is an example of hierarchy list output without transforms or pivots:



HIERARCHY_LIST H 2 top_level
0 G node#27
1 G node#26
2 G node#25
3 P x16y16end
3 P x24y32box
0 G node#28
1 P x8y8sphere3
1 P x22y18sphere2
END_HIERARCHY_LIST

The following is the same example of hierarchy list output, but with transforms (and still no pivots):



HIERARCHY_LIST HX 2 top_level
0 G node#27
tran: 0.0000 0.0000 0.0000
rot: 0.0000 0.0000 0.0000
scal: 1.0000 1.0000 1.0000
1 G node#26
tran: 0.0000 0.0000 0.0000
rot: 0.0000 0.0000 0.0000
scal: 1.0000 1.0000 1.0000
2 G node#25
tran: 0.0000 0.0000 0.0000
rot: 0.0000 0.0000 0.0000
scal: 1.0000 1.0000 1.0000
3 P x16y16end
tran: 0.0000 0.0000 0.0000
rot: 0.0000 0.0000 0.0000
scal: 1.0000 1.0000 1.0000
3 P x24y32box
tran: 0.0000 0.0000 0.0000
rot: 0.0000 0.0000 0.0000
scal: 1.0000 1.0000 1.0000
0 G node#4
tran: -5.9248 -0.2723 0.0000
rot: 0.0000 0.0000 0.0000
scal: 1.0000 1.0000 1.0000
1 P x8y8sphere3
tran: 9.6807 0.0000 0.0000
rot: 0.0000 0.0000 0.0000
scal: 0.6858 0.6858 0.6858
1 P x22y18sphere2
tran: 0.0000 0.0000 0.0000
rot: 0.0000 0.0000 0.0000
scal: 1.0000 1.0000 1.0000
END_HIERARCHY_LIST

The following is the same example of hierarchy list output, but with both transforms and pivots:



HIERARCHY_LIST HXP 2 top_level
0 G node#27
tran: 0.0000 0.0000 0.0000
rot: 0.0000 0.0000 0.0000
scal: 1.0000 1.0000 1.0000
sPiv: 0.0000 0.0000 0.0000
rPiv: 0.0000 0.0000 0.0000
1 G node#26
tran: 0.0000 0.0000 0.0000
rot: 0.0000 0.0000 0.0000
scal: 1.0000 1.0000 1.0000
sPiv: 0.0000 0.0000 0.0000
rPiv: 0.0000 0.0000 0.0000
2 G node#25
tran: 0.0000 0.0000 0.0000
rot: 0.0000 0.0000 0.0000
scal: 1.0000 1.0000 1.0000
sPiv: 0.0000 0.0000 0.0000
rPiv: 0.0000 0.0000 0.0000
3 P x16y16end
tran: 0.0000 0.0000 0.0000
rot: 0.0000 0.0000 0.0000
scal: 1.0000 1.0000 1.0000
sPiv: 0.0000 0.0000 0.0000
rPiv: 0.0000 0.0000 0.0000
3 P x24y32box
tran: 0.0000 0.0000 0.0000
rot: 0.0000 0.0000 0.0000
scal: 1.0000 1.0000 1.0000
sPiv: 0.0000 0.0000 0.0000
rPiv: 0.0000 0.0000 0.0000
0 G node#4
tran: -5.9248 -0.2723 0.0000
rot: 0.0000 0.0000 0.0000
scal: 1.0000 1.0000 1.0000
sPiv: -5.9248 -0.2723 0.0000
rPiv: -5.9248 -0.2723 0.0000
1 P x8y8sphere3
tran: 9.6807 0.0000 0.0000
rot: 0.0000 0.0000 0.0000
scal: 0.6858 0.6858 0.6858
sPiv: 3.7558 -0.2723 0.0000
rPiv: 3.7558 -0.2723 0.0000
1 P x22y18sphere2
tran: 0.0000 0.0000 0.0000
rot: 0.0000 0.0000 0.0000
scal: 1.0000 1.0000 1.0000
sPiv: -5.9248 -0.2723 0.0000
rPiv: -5.9248 -0.2723 0.0000
END_HIERARCHY_LIST

The hierarchy list ends with the tag END_HIERARCHY_LIST to indicate the end of hierarchy processing.

Object Data

There are a number of Object sections, one for each object in the file, as indicated by the NUMBER_OF_OBJECTS info line.

An Object section begins with an object start line. This line starts with an OBJECT_START tag and is followed by the name of the object and counter tags. Each counter tag has a letter prefix (to denote what the counter is for), with a number appended to it (to indicate how many items of that type there are) appended to it.

The letter v is for vertices, n for vertex normals, t for texture coordinates, and p for polygons. These counters are put in the following order (regardless of whether or not some the counters are omitted):

1
vertex count
2
normal count
3
texture count, and then
4
polygon count

For example:



OBJECT_START sphere v26 n45 t45 p32

indicates that the object sphere contains a VERTEX list of 26 vertex positions, a NORMAL list of 45 vertex normal values, a TEXCOORD list of 45 texture (u,v) coordinate values, and a POLYGON list of 32 polygon data entries.

>
Note: If the OUTPUT_VERT_NORMS flag is off (meaning the output of vertex normals has been omitted) then the n counter, (n45 in the above example), is omitted from the object start line.
Also, if the OUTPUT_TEX_COORDS flag is off (meaning the output of texture coordinates has been omitted) then the t counter, (t45 in the above example), is omitted from the object start line.

USES_MATERIAL tag

The USES_MATERIAL tag indicates which material (if materials are being output) is used for this object. It is followed by the index of the material and the name:



 USES_MATERIAL 0 Shader

VERTEX list

The VERTEX list follows the OBJECT_START line. It begins with a line containing the VERTEX tag along with a coordinate space tag. This second tag is either local or world to indicate whether the position of the vertex is output in local (object) space or in world space. A list of vertex positions specified in X Y Z order (one vertex position per line) follows. If the SHOW_INDEX_COUNTERS flag is on, each vertex line is prefixed with an index number starting at 0 and incrementing by one for each vertex line in the list.

COLORS list

The vertex COLOR list follows the VERTEX list. It begins with a line containing the COLOR tag. A list of the vertex color values then follows.

NORMAL list

The vertex NORMAL list follows the VERTEX list. It begins with a line containing the NORMAL tag. A list of vertex normal values specified in X Y Z order (one vertex normal per line) then follows.

If the SHOW_INDEX_COUNTERS flag is on, each vertex normal line is prefixed with an index number starting at 0 and incrementing by one for each vertex normal in the list.

>
Note: If the OUTPUT_VERT_NORMS flag is off (meaning the output of vertex normals has been omitted), a NORMAL list will not be found after the VERTEX list.

TEXCOORD list

The following list is the texture coordinate (TEXCOORD) list. It begins with a line containing the TEXCOORD tag. A list of vertex texture coordinate (u,v) values specified in U V order (one texture coordinate pair per line) then follows. If the SHOW_INDEX_COUNTERS flag is on, each line is prefixed with an index number starting at 0 and incrementing by one for each line in the list.

>
Note: If the OUTPUT_TEX_COORDS flag is off (meaning the output of vertex texture coordinates has been omitted) then a TEXCOORD list will not be found here.

POLYGON list

The next list within an object section is the polygon list for that object. It begins with a line containing only the POLYGON list tag. A list of polygon data lines (one line/entry for each polygon in the object) then follows containing data in the following order:



[index]
[num_verts]
v [vert_indices]
n [norm_indices]
(omitted if OUTPUT_VERT_NORMS is off)
t [texcrd_indices]
(omitted if OUTPUT_TEX_COORDS is off)
N [polygon_normal] (omitted if OUTPUT_POLY_NORMS is off)
T [texture_index]
C [rgb_color]

The following table describes the variables:

index the polygon ID in the list, beginning at 0 for the first polygon and incrementing for each entry in the list. This index counter is omitted if the SHOW_INDEX_COUNTERS flag is off.
num_verts the number of vertices in the polygo
vert_indices a list of vertex indices that reference into the object's VERTEX list. There should be a number of indices in this list equal to num_verts.
norm_indices a list of vertex normal indices that reference into the object's vertex NORMAL list. There should be a number of indices in this list equal to num_verts. These indices are omitted from output if the OUTPUT_VERT_NORMS flag is off.
texcrd_indices a list of vertex indices that reference into the object's TEXCOORD list. There should be a number of indices in this list equal to num_verts. These indices are omitted from output if the OUTPUT_TEX_COORDS flag is off.
poly_normal (RTG 1.8 only) the polygons normal vector in X, Y, and Z. This entry is omitted if the OUTPUT_POLY_NORMS flag is off.
texture_index (RTG 1.8 only) an index into a texture table (found at the end of the file provided textures were generated).
rgb_color (RTG 1.8 only) the polygons color in R, G, and B.

>
Note: (RTG 1.8 only) A polygon will only have either the texture_index or an rgb_color assignment. The tags v, n, t, N, T, and C exist to identify the data that follows them. These are omitted from the output if their corresponding data is also omitted.

The object data ends with a line containing the OBJECT_END and the name of the object as it appeared on the object start line.

Texture Table (RTG 1.8 only)

The texture table starts with a line containing the TEXTURE_TABLE tag, along with the name of the associated texture file (.bin), an entry count, the entries descriptor tag, the header descriptor tag, the number of bytes in the header of the .bin file, and finally the bytes descriptor tag.

Following the first line are the texture entries. Each texture entry line is of the format:



[index] [pixel_format] [X_res] [Y_res] 
[source_shader] [byte_size]

index the texture ID in the table, beginning with 0 for the first texture in the table.
pixel_format indicates how the pixel data is stored in the .bin file for this texture. Currently only `RGBA' is allowed, meaning the texture in the .bin file is stored 4 bytes per pixel - one each for r, g, b, and a.
X_res the resolution in X for the texture swatch created.
Y_res the resolution in Y for the texture swatch created.
source_shader the name of the shader (within PowerAnimator) that generated this texture.
byte_size the number of bytes that the pixel data for this texture takes up in the .bin file.

The texture table ends with a line containing the END_TEXTURE_TABLE and the name of the associated texture file (.bin) as it appeared on the texture table start line.

>
Note: The index counter on each entry is omitted if the SHOW_INDEX_COUNTERS flag is off.

The following is an example of the TEXTURE_TABLE format:



TEXTURE_TABLE wackyB1.bin 3 entries (header: 82 bytes) 0 RGBA 32 32 Shader#2 
4096 1 RGBA 32 32 Shader 4096 2 RGBA 32 32 Shader#4 4096 END_TEXTURE_TABLE 
wackyB1.bin

The following is an example of the TEXTURE_TABLE format using the encoded texture resolutions option on shader names:



TEXTURE_TABLE wackyB1.bin 3 entries (header: 82 bytes)
0 RGBA 32 32 Shader#2 4096
1 RGBA 32 32 Shader 4096
2 RGBA 32 32 Shader#4 4096
END_TEXTURE_TABLE wackyB1.bin

Texture Data File (.bin) (RTG 1.8 only)

Header

The header of the texture file contains a text title, a version tag, and time and date creation information. This header string is not null terminated.

The header should be parsed to get the version tag and the date in order to verify the texture file against the P- data file.

Use the header byte count found in the texture table start line to determine how many bytes to read to clear the header. The version tag is preceded by a ver descriptor tag and the time and date information is preceded by a date descriptor tag.

Data

After the header, any textures generated for the corresponding polygonal data file is dumped pixel by pixel into this file. Each pixel is separated into 4 bytes, one for each of R, G, B and A, and written out to this file in that order. Values for each of RGB and A range from 0 to 255. Pixel values are output starting from the bottom-left (texture coord 0,0) and are output moving left to right and bottom to top.

Animation Data (RTG 2.0 only)

RTG 2.0 differs from previous versions of RTG in that it is capable of creating a single file that contains both model and animation data. The RTG 2.0 animation data starts with the tag ANIMATION_LIST, and ends with END_ANIMATION_LIST. Between these two tags are a sequence of FRAME records and within each frame record is a list of all of the objects that are animated and what their transforms are.

The format of the transformation data is as per the hierarchy section. The following is an example of a three-frame animation of two objects.



ANIMATION_LIST
FRAME 1
OBJECT sphere#2
tran: -2.000000 6.000000 0.000000
rot: 0.000000 0.000000 0.000000
scal: 1.000000 1.000000 1.000000
sPiv: -2.000000 6.000000 0.000000
rPiv: -2.000000 6.000000 0.000000
OBJECT sphere
tran: -2.000000 -4.000000 0.000000
rot: 0.000000 0.000000 0.000000
scal: 1.125168 1.125168 1.125168
sPiv: -2.000000 -4.000000 0.000000
rPiv: -2.000000 -4.000000 0.000000
FRAME 2
OBJECT sphere#2
tran: -2.000000 6.000000 0.000000
rot: 3.827586 0.000000 0.000000
scal: 1.000000 1.000000 1.000000
sPiv: -2.000000 6.000000 0.000000
rPiv: -2.000000 6.000000 0.000000
OBJECT sphere
tran: -2.000000 -4.000000 0.000000
rot: 0.000000 0.000000 0.000000
scal: 1.250335 1.250335 1.250335
sPiv: -2.000000 -4.000000 0.000000
rPiv: -2.000000 -4.000000 0.000000
FRAME 3
OBJECT sphere#2
tran: -2.000000 6.000000 0.000000
rot: 7.655172 0.000000 0.000000
scal: 1.000000 1.000000 1.000000
sPiv: -2.000000 6.000000 0.000000
rPiv: -2.000000 6.000000 0.000000
OBJECT sphere
tran: -2.000000 -4.000000 0.000000
rot: 0.000000 0.000000 0.000000
scal: 1.375503 1.375503 1.375503
sPiv: -2.000000 -4.000000 0.000000
rPiv: -2.000000 -4.000000 0.000000
END_ANIMATION_LIST




Copyright © 1998, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. Please send questions or comments regarding the documentation to:
[email protected]