RTG Output Utility

To launch the RTG 2.0 translator, select RTG from within the MakeGame window and click Go.

Overview

To support the multitude of game systems available in the marketplace, and the relatively non-standardized PC game development systems, Alias|Wavefront provides the RTG and AnimRTG ASCII file format converters.

RTG is a generic ASCII (user-friendly) file format suitable for use in 3D game authoring environments.

AnimRTG is a generic ASCII file format containing animation samples for all geometric or dag node level objects in the scene.

Previously, Alias|Wavefront provided an RTG and AnimRTG translators that were based solely on the OpenModel API (application programmers interface). The last such provided version was version 1.8. Alias|Wavefront is continuing to supply RTG 1.8 as an OpenModel converter, but now also supplies the RTG 2.0 converter as well.

RTG 2.0 is built on top of the same API that the rest of Alias|Wavefront's direct platform translators are built on. This API, called Dt, supplies an interface layer between the OpenModel/OpenAlias API and the converter itself, and is far more oriented toward data transfer for interactive media than OpenModel/OpenAlias. As a side benefit, the Dt API provides significant functionality to the programmer, such as built-in conversion of projective textures to parametric textures (via texture coordinates). All translators based on the Dt API receive this functionality transparently.

In creating RTG 2.0, some aspects of the original RTG and AnimRTG file formats were modified.

Changes in RTG 2.0:

All future development of RTG for PowerAnimator and other Alias|Wavefront products will be based on RTG 2.0. RTG 1.8 continues to be shipped with PowerAnimator, but is shipped solely to allow current workflows to continue. It is recommended that all users of RTG regard RTG 2.0 as the future of the file format.

Though RTG 2.0, RTG and AnimRTG are not standard formats (such as they exist) recognized by any of the console makers, it has been written in such a way that any programmer, whether using SGI machines, PCs, or Macs, can parse and use its output. A simple parser for RTG should take a programmer only a matter of hours to create.

Since RTG and RTG 2.0 are very similar, the new features of RTG 2.0 are documented in the following section as they are encountered.

What is RTG?

The RTG converter converts wire files of polygonal data to an ASCII file. Instructions are included on how you can set the RTG converter up as an external application. The RTG 2.0 converter is launched from the MakeGame plug-in. Launching RTG opens the following window.

The RTG format supports the following features:

How to write a reader

In order to use the RTG format, you must write a (very) simple program to read the RTG file. A sample reader program is provided.

Tip: RTG is a good solution when you do not want to make the leap to use OpenAlias or OpenModel. The program to read an RTG file is very simple, and can be created on any platform (such as a PC).

What is AnimRTG?

rtgAnim is designed to be used in conjunction with the rtg format translator. It provides the following functionality:

What next?

The RTG 2.0, RTG and AnimRTG formats are written as OpenModel applications and will be updated periodically. Updates to RTG 2.0 will be distributed on an ongoing basis. RTG 2.0 is based on the Dt API. The source code to the Dt API is shipped in the $ALIAS_LOCATION/ODS/Games/source area.

In addition, the source code for all three translators is included so that you can extend the formats as you need.

RTG Details

This covers how to install and set up the RTG 1.8 converter to launch as an external application from PowerAnimator. Also included are notes on using the converter and important things to keep in mind regarding this release of this software.

To run the RTG 2.0 converter, you need simply install the MakeGame plug-in, see Installing Game Direct Translators on page 1. RTG 2 is one of the output file formats available from the MakeGame plug-in.

For details about the Real Time Games Format see the FORMAT text file.

Installation

This document assumes that the Alias software has been installed appropriately. The RTG and AnimRTG software is installed by default into the $ALIAS_LOCATION/ODS/Games/bin directory.

Setting up RTG to run as an external application

  1. In Alias, select File External Apps. The External Applications window is displayed:

  2. In the External Applications section, click the Add button. An Application Name box is displayed. Double-click on the word undefined to edit the label.
  3. Type $ALIAS_LOCATION/ODS/Games/bin/rtg %i

    in the Application Name box, then press Enter.

  4. In the Application Input section, set Write Input to ON, then type rtg_output_wire.temp in the Input File box.

  5. In Application Ouput section, set Read Output to OFF. You are now ready to run the translator straight from the interactive package. Just click the Go button in the External Applications window while the $ALIAS_LOCATION/ODS/Games/bin/rtg %i Application Name is highlighted to launch the Wire to Real Time Games Output converter.

    Running the converter

    Create some polygonal geometry with texture maps in Alias, then:

  6. Select File External Apps. The External Applications window is displayed.
  7. Click once on the $ALIAS_LOCATION/ODS/Games/bin/rtg %i in the Application Name box.
  8. In the Application Input section, you can choose to convert ALL objects or just ACTIVE objects from the Input Scope pop-up menu (which is the input for the converter). The converter processes all polygonal data within the scope you select.
  9. Click the Go button to launch the converter.
  10. The cursor changes to a red rectangular outline. Click once to display the xterm window (this window displays feedback from the converter). At this point, the Wire to Real Time Games Format v1.8 window is displayed (it may take a few moments). Set the options as you desire.

    Tip: Make sure that the Path for Output is set to the directory where you want to put the output files, and that the Output Prefix is set to what you want to prefix the output filenames with.

    A forward slash is automatically added to the end of the path before being concatenated with the output prefix. You do not have to include it to the end of the path specification.

    For example, type:

    test

    in the Output File Prefix option section. This will generate the following files in the Path for Output directory:

    test1.rtg test1.bin

    The 1 in the test1 prefix created is the frame number, and in this case only frame 1 is generated. A sequence of frames can be specified in the options, which will generate a set of rtg/bin files per frame. The frame number is appended to the specified Output File Prefix when naming files.

    The .rtg file created contains geometry data, hierarchy information (if specified), and a texture table (if any textures were generated). This file is an ASCII text file.

    The .bin file created is a binary file containing an ASCII text header (which is NOT NULL terminated) along with an RGBA byte-oriented dump of pixel data for all textures generated for its corresponding .rtg file.

  11. Click the Save button to run the converter. You can see what the converter is doing and if there are any problems in the xterm window. The converter is finished processing once the date and time is displayed and the word DONE is displayed on the line below.

    Close the xterm window by double-clicking on the close icon in the top left corner of the window.

    Once processing is complete, the output rtg/bin files can be found in the directory that was specified in the Path for Output option. The path, along with the file prefix, is also displayed in the xterm window (it appears on the line starting with Finished generating).

Overview of Converter Options

Path for Output

This is the directory path, where the output files are created. The path you specify does not have to end with the forward slash character, /, but it can be added without any adverse effects.

For RTG 2.0, this option is located in the PATHS section of the MakeGame option box.

Output File Prefix (RTG 1.8 only)

This is the label that the generated rtg/bin files will be prefixed with, along with an appended frame number.

Geometry Mode (RTG 1.8 only)

Specifies what kind of polygonal geometry is desired:

Tris Only

Only triangles are output to the .rtg file. Quads are processed and output as two triangles. Polygons with less than 3 or greater than 4 vertices are NOT processed.

Quads Only

Only quadrangles (4 vertices) are output to the .rtg file. Triangles are processed and output as degenerate quads. Polygons with less than 3 or greater than 4 vertices are NOT processed.

Tris & Quads

Triangles and quads are output to the .rtg file. Polygons with less than 3, or greater than 4 vertices are NOT processed.

Tri/Quad Degen

Triangles and quads are output to the .rtg file and any degenerate quads (quad with 2 vertices in the same position such that it looks like a triangle) will be output as a triangle.

N-Sided

All polygons, with any number of sides, are output to the .rtg file.

If Texture per Polygon is selected as the Texture Mode (see the following), and a polygon is processed with less than 3 or more than 4 vertices, a texture may be generated but it will most likely be quite useless.

Output Vertex Norms

If set OFF, vertex normals are not generated on output. If set ON, a vertex NORMAL list is generated for each object, and each polygon entry for the object contains a vertex normal index list.

Output Vertex Colors

If set to OFF, vertex colors are not generated on output. If set to ON, a vertex COLOR list is generated for each object. This color list should be indexed in the same way as the vertex list.

Output Texture Coord

If set OFF, vertex texture coordinates are not generated on output. If set ON, a vertex TEXCOORD list is generated for each object, and each polygon entry for the object contains a vertex texture coordinate index list.

Output Polygon Norms

If set OFF, polygon Normals are omitted from polygon data lines. If set ON, a polygon Normal entry is included on each polygon data line. The Normal entry starts with an N tag and is specified in nX nY nZ order.

Vertex Orientation (RTG 1.8 only)

Specifies whether to use a Clockwise (Left Hand Rule) or a Counter-Clockwise (Right Hand Rule) vertex orientation system. This orientation determines which side of a polygon is considered as a front face.

Quad to Tri Strip (RTG 1.8 only)

This option only takes effect when the geometry mode is Quads Only, Tris & Quads, or Tri/Quad Degen. If it is ON in one of these modes, then any quads output as quads have their vertices specified in a triangle strip form.

Tip: This can be used, for example, to bring geometry into a GL or OpenGL program that makes use of triangle strips. Using triangle strip can eliminate problems that arise from non-coplanar quads.

Scale Factor

This lets you apply a scale on vertex coordinates in case your wire file model is too small (or too large) for your games world space coordinate system. This option only takes effect when NO hierarchy is being output.

RTG 1.8 only: Hierarchy output uses object space coordinates (not world space) and applying a scale adversely affects transforms applied to object space vertices.

For RTG 2.0, this option is located in the MakeGame option box.

Texture X res/Texture Y res/Texture Mode/Encoded Tex Res (RTG 1.8 only)

These are texture X and Y resolutions for all textures created in one converter session launch. The maximum value for each is 256.

Texture Mode (RTG 1.8 only)

These options are used to specify at what level to generate textures:

Color Only

No textures are generated and the color is assigned to the polygon.

Texture per Polygon

A texture is generated for each polygon.

Texture per Shader

A texture is generated for each shader that is assigned to output polygonal data.

Encoded Tex Res

Specifies whether or not to look for texture resolutions encoded in shader or polyset names. If the name is not encoded, the default texture X and Y resolutions above are used. If Texture Mode is set to Shader per Polygon and this option is set to Use Polyset Name, the resolution will be decoded from the first polyset name encountered.

Important Note on Texture Resolutions

The converter ignores these texture resolution values if the texture resolution is encoded in the Shaders/Polysets name (within Alias) AND if the Encoded Tex Res option is set to anything other than NONE.

To edit a shader's name in Alias:

  • Open the Multi-lister (Windows Multi-lister Shaders).
  • Double-click the name box of the Shader icon in the Multi-lister, type a new name and press Enter.
  • To edit a polyset's name in Alias:

    1. First pick all the polysets for which you want to change their names.
    2. Open the Render Stats window (Windows Render stats).
    3. In the Render Stats window, double-click on the polyset name you want to edit then type a new name.
    4. To encode texture resolution in the shader/polyset name, use the following convention:

      x64y128ShaderName x64y128PolysetName

    where x64 would mean an X resolution of 64 pixels, and y128 would mean a Y resolution of 128 pixels for the texture.

    Important Note on Textures Created

    Texture per Shader

    A texture is created from a shader only if:

    Texture per Polygon

    A texture is created for a polygon if its shader is NOT just a color (it has texture or other mappings applied to it). The texture is pre-distorted for irregular shape quads as well as triangles. For triangles, the last vertex is repeated in order to generate a quad texture swatch. If only a color is assigned to the polygons shader, a single RGB color is generated in that polygon's entry in the POLYGON_LIST.

    Prelight Tex Pixels (RTG 1.8 only)

    If set to ON and Texture Mode is not Color Only, all generated textures have prelighted pixel values based on a fixed light source.

    Currently this does not use lighting from within Alias but simply uses a predetermined lighting model.

    Note that this feature exists in RTG 1.8 only. For RTG 2.0, it is recommended that you use the PowerAnimator prelighting feature in version 8, and apply those effects to your texture maps in the manner required for your destination platform.

    Object Level (RTG 1.8 only)

    This option specifies what component level constitutes a single object (one VERTEX_LIST and one POLYGON_LIST generated for each object). Each Polyset found can be an object, each Top Level Dagnode found, with polysets, can be an object, or the entire file processed can be one object of polygonal data.

    Hierarchy information can only be generated at the Polyset as Object level using the Polyset w/ Hierarchy selection of this option. All other options will not generate hierarchy.

    When hierarchy is output using the Polyset w/ Hierarchy selection, object space coordinates are used for vertex position. All other selections of this option use world space coordinates for vertex position.

    Hierarchy Data

    This option specifies the level of hierarchy data that is output. You can specify to output the Tree Only, the Tree w/ Xforms, or the Tree w/ Xforms & Pivots.

    This control is set via the MakeGame option box for RTG 2.0. The RTG option box allows you to specify whether hierarchy is output at all, and if so, whether pivot information is output at each node.

    If pivot information it not output at each node, then the pivot transformation is combined with the rest of the transform

    Precision Options (RTG 1.8 only)

    Show Index Counters

    If set ON, index counters are included in all lists. Index counters start at 0 for the first entry of a list and increment by 1 for each entry in the list. Each of these counters is the first entry of each list entry, if specified to be included on output. If set OFF, these index counters are omitted from output.

    Newline

    This option specifies what newline character to use in the .rtg file generated. The UNIX `\n character or the DOS carriage-return/linefeed pair can be specified.

    Important Notes

    World (global) Transformations

    The following describes one method you can use to put together a transform matrix for a leaf node. This has not been tested and verified as yet, but hopefully it will provide a starting point to putting together world (or global) transformations.

    The Approach

    One way to get started is to build a tree (dynamically allocated, two-way linked list) as you read in the hierarchy list. At each node you can build a local transform matrix with the transformation data in the hierarchy list. After you have built your tree you can traverse it, and at each leaf node you encounter, you can traverse up the tree and apply the transform matrices cumulatively as you go up. This gives you the total transform on a leaf node.

    Building a local Transform

    At each node, you need to build a transform matrix from the transform data at that level in the hierarchy list. The following is the order of operations to apply the data to build the matrix:

  • Apply a translation from the scale pivot to the origin (0,0,0).
  • Apply the scale factors in x, y, and z.
  • Apply a translation from the origin back to the scale pivot.
  • Apply a translation from the rotate pivot to the origin.
  • Apply the x-axis rotation by x component of rotation.
  • Apply the y-axis rotation by y component of rotation.
  • Apply the z-axis rotation by z component of rotation.
  • Apply a translation from the origin back to the rotate pivot.
  • Apply the translation by x, y, z of the translation vector. To get a total local transform matrix, generate a matrix at each of the above 9 steps, then apply cumulatively as follows:

    local matrix = [9] * [8] * [7] * [6] * [5] * [4] * [3] * [2] * [1]

    Getting the World level transform

    For a leaf node, the World transform is obtained by applying the local transforms cumulatively as you go up the tree to the top level.

    For example, if node A is a parent of node B, which is a parent of node C, the global (or world) transformation of C is the matrix product [C] * [B] * [A], where [C], [B] and [A] are local transformations at each node.

    That should provide you with global (or world) transform matrices for each leaf node.

    Tip: If you have OpenModel API, you can obtain the global matrices yourself quite easily.

    The RTG format

    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:

    HEADER_TITLE Alias|Wavefront Real Time Games Output HEADER_VERSION v1.0

    HEADER_DATE Tue Aug 15 21:58:15 1995 (RTG 1.8 only)

    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 whether or not a particular item(s) will be found in the file.

    For example, the flag info line OUTPUT_HIERARCHY on indicates that a hierarchy tree will be found in the file. This version contains flags for:

    OUTPUT_VERT_NORMS

    Indicates if a NORMAL list for vertex normals is included in this file or not.

    OUTPUT_VERT_COLORS

    Indicates if a COLOR list for vertex colors is included in the file or not.

    OUTPUT_TEX_COORDS

    Indicates if a TEXCOORD list for vertex texture coordinates is included in this file or not.

    OUTPUT_POLY_NORMS

    Indicates if Normals for each polygon will be output on a polygon data line or not.

    OUTPUT_HIERARCHY

    Indicates if a hierarchy tree is included in this file or not.

    OUTPUT_MATERIALS (RTG 2.0 only)

    Indicates if materials are included in this file.

    OUTPUT_ANIMATION (RTG 2.0 only)

    Indicates if animation data is included in this file.

    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.

    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 various modes that had been selected when this file was generated.

    Currently there is only one selection line:TEXTURE_MODE. Valid modes (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, with texture coordinates being pretty much 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

    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 the OBJECT Data as described in the following.

    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.

    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 same example of hierarchy list output but with transforms and 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 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 (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 in the order of :

  • vertex count
  • normal count
  • texture count, and then
  • polygon count, regardless of whether or not some the counters are omitted.

    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.

    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.

    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.

    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. This 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 the following data:

    · [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]

    where:

    index is the polygon i.d. 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 is the number of vertices in the polygon.
    vert_indices is 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 is 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 is 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) is 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) is an index into a texture table (that can be found at the end of the file provided textures were generated).
    rgb_color (RTG 1.8 only) is the polygons color in R, G and B.

    (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] where:

    index is 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 s the resolution in x for the texture swatch created.
    Y_res is the resolution in y for the texture swatch created.
    source_shader is the name of the shader (within PowerAnimator) that generated this texture.
    byte_size is the number of total 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.

    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.

    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 info is preceded by a date descriptor tag .

    Tip: 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.

    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 those two 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 
    FRAME 2 
    FRAME 3 
    END_ANIMATION_LIST 

    RTG Animation Output Utility

    Purpose

    Retrieves a wire file and outputs an animation stream for each animated parameter in the dag group structures or on polyset vertices.

    Overview

    The rtgAnim utility reads an animated Alias wire file and creates a stream of data for any animated piece of the model (transformations, animated vertices, or world space paths for clustered vertices).

    It does this by creating a file for each animated node in the dag. The contents of the 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 

    The above output is for a node called node#24, and the file will be called xxx_node#24 (you can specify what xxx is). It is a sampling from frame 1 through 9, by twos. Since only the rotations are animated in the model, only they are output.

    For animated polyset vertices, a file is created for each animated vertex. For example, the file called polyset#1_5 is for the fifth vertex in polyset 1.

    For polysets animated with clusters, the world positions per vertex per frame are output, since it is difficult to do anything in object space with clusters.

    How to Use

    This command line utility can be found in $ALIAS_LOCATION/ODS/Games/bin directory.

    To make this utility easier to run:

  • First include $ALIAS_LOCATION/ODS/Games/bin in the set path = command in your .cshrc file
  • At the command line, type:
    source ~/.cshrc. 
  • This allows you to run the rtgAnim utility in the directory you are working in (maybe where the wire file exists) without having to specify the entire path of where to find rtgAnim.

    The following are the command line input parameters for the rtgAnim utility:

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

    -i <inputfile> specifies a valid Alias wire file for input.
    -o <outputfile> specifies the name of the anim file(s) output.
    -s <startframe> specifies first frame in animation (if any).
    -e <endframe> specifies last frame in animation.
    -b <byframe> specifies by value of animation.
    -y specifies a Y-up world.
    -z specifies a Z-up world.

    AnimRTG Details

    The AnimRTG file format is created by using the rtgAnim command from the Unix command line, or installing it as an "External App" into your Alias application (see your Alias documentation for further details).

    The application includes the following options:

    Usage

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

    Where:

    -i <inputfile> specifies a valid Alias wire file for input.
    -o <outputfile> specifies the name of the anim file(s) output.
    -s <startframe> specifies first frame in animation (if any).
    -e <endframe> specifies last frame in animation.
    -b <byframe> specifies by value of animation.
    -n <name> only output anim for this node.
    -y specifies a Y-up world.
    -z specifies a Z-up world.

    This program retrieves a wire file and outputs an animation stream for each animated parameter in the dag group structures or on polyset vertices.

    rtgAnim has been designed to ease the task of obtaining point-sampled animation information from Alias wire files for use in real time game applications.

    rtgAnim is designed to be used in conjunction with the rtg format translator. It provides the following functionality:

    Example

    If a wire file contains an object called sphere#1 which is animated from frame 1 to 30, the command

    rtgAnim -i wirefile -o output -s 1 -e 30

    creates a file called output_sphere#1 that contains the animation data. The file might look something 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 
    ... 

    The first column is the frame for the line. The rest of the columns describe the fields being animated, and the values at the frame.

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





    1 Note that the RTG 2.0 converter will output triangles, quads, or N-sided polygons as they occur in the model. No attempt is made to convert them, as this has an effect on the look of the model.

    [email protected]

    Copyright © 1997, Alias|Wavefront, a Silicon Graphics Company. All rights reserved.

  • Hosted by www.Geocities.ws

    1