
         Alias|Wavefront Wire to Real Time Games Output, v1.75
         -----------------------------------------------------
                            README file
                            -----------


Last revision of document: July 12, 1996.

This README covers how to install and setup the rtg_output 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.

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


INSTALLATION
------------

The instructions for installation of this utility will be described under
documentation provided separately. This document assumes that the software
has been installed appropriately. The following is the directories and files
that should exist when installation has been completed.

*** IMPORTANT NOTE ***
Any reference to $HOME should be replaced, in any case where something
requires keyboard input, by the character string obtained from the UNIX
'echo $HOME' command.

The converts need to be able to write out temporary files as well as to
create/read from the PST files for configuration data.  In order to do 
there is now an environment variable called:  GAMES_DATA_DIR
This should be set to the working directory that the user has write access
to.  If it is not set then the converters will use /usr/tmp as the default
location.

 
    directories:

	$GAMES_DATA_DIR


       files:

       reader.c
       FORMAT_RTG
       README_RTG
       rtg
       rtg.pst
       rtg.pst-defaults
       rtg_drv
       rtg_output_v1.75

       new files for animation output:

       README_rtgAnim
       rtgAnim


HOW TO SETUP TO RUN AS EXTERNAL APPS
------------------------------------

1. Launch PowerAnimator.

2. Select Model->File->External Applications from the menu.

3. In 'External Applications' sub area click on 'Add', then in the
   highlighted Application Name area double click and type in

         $GAMES_LOCATION/bin/rtg %i

4. In 'Application Input' sub area set 'Write Input' to ON. Then set
   the 'Input File' to 'rtg_output_wire.temp'.

5. In 'Application out' sub area set 'Read output' to OFF.


... NOW you are all set to run the translator straight from the interactive
package! Just click on 'GO' from the External Applications window while the
'GAMES_LOCATION/bin/rtg %i' Application is highlighted. This
will launch the Wire to Real Time Games Output converter.


EXAMPLE OF RUNNING AS EXTERNAL APP
----------------------------------

1. With PowerAnimator up and running, create some polygonal geometry with
   texture maps.

2. Select Model->File->External Applications.

3. Click once on the $GAMES_LOCATION/bin/rtg in the Application
   Name area. In the 'Application Input' area the Input Scope (i.e. input
   for the converter) can be set to ALL objects or to be just ACTIVE objects.
   The converter will process all polygonal data within the scope selected.

   NOTE: make sure that the 'Application out' option for 'Read output' is OFF.

4. Click on the 'Go' button to launch the converter. Click once to place the
   'xterm' window that comes up.

5. At this point the "Wire to Real Time Games Output v1.75" options window
   should appear. May take a second to pop up.

6. Set options as desired. Ensure 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.

   ... in the 'Path for Output' option area (NOTE: a forward slash is automatic-
   ally 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).
   Now, as an example, type in:

       test

   ... in the 'Output File Prefix' option area. 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 it's corresponding .rtg file.

   NOTE: new to this version of RTG is the option to generate image files
         (such as Alias pix and SGI rgb files) for each texture entry in
         the table on every frame. In this case the file naming goes as
         follows:  <prefix><frame_no>_T<textable#>.<imagetype>

         ... so if there were 3 texture entries over 2 frames of animation,
         with the prefix 'test' and image output selection for Alias pix, then
         the output would generate the following files:

             test1.rtg
             test2.rtg

             test1_T0.pix
             test1_T1.pix
             test1_T2.pix

             test2_T0.pix
             test2_T1.pix
             test2_T2.pix


7. Click on the 'SAVE' button to execute the converter. In the xterm window
   that had previously poped up (described in step 4 above) feedback from
   the converter session is displayed. When the converter has completed
   processing it will display 'DONE.' in this status window. The window will
   stay up for your reference until you close it by double clicking on the
   icon at the top left corner of the window.

8. 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 displayed in the xterm status window
   as well for reference ( 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 will be created.
        The path you specify does not need to end with the forward slash
        character, '/', but it can be added without any adverse effects.


'Output File Prefix'

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


'Object Level'

        This options will specify 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 through the 'Polyset w/ Hierarchy' selection in this option.
        All other options will not generate hierarchy.

        NOTE: when hierarchy is output thru the 'Polyset w/ Hierarchy'
              selection, object space coordinates are used for vertex position
              and vertex & polygon normals.
              All other selections of this options will utilize world space
              coordinates for vertex position and vertex & polygon normals.


'Hier. Xform Output'

        This option will specify the type of output for hierarchy transform
        data. This only has an effect when 'Polyset w/ Hierarchy' is selected
        for 'Object Level' option. You can specify to output the Xforms along
        with their Pivots, OR you can specify to output Local and World
        Transformation Matrices at each node. See FORMAT_RTG doc for more
        info.

        The Local and World transformation matrices are to be pre-multiplied
        to point coordinates for application of the transforms.


'Scale Factor'

        This will allow you to apply a scale on vertex coordinates in case
        your wire file model is too small (or too large) for your game's world
        space coordinate system. This option will only be effective if NO
        heirarchy is being output. Hierarchy output utilizes object space
        coordinates (not world space) and applying a scale could adversely
        affect transforms applied to object space verts.


'Geometry Mode'

        Specifies what kind of polygonal geometry is desired:

        * Tris Only - only triangles will be output to the .rtg file. Quads
                      will be 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) will be output to the
                       .rtg file. Triangles will be processed and output as
          degenerate quads. Polygons with less than 3 or greater than 4 verts
          are NOT processed.

        * Tris & Quads - triangles and quads will be output to the .rtg file.
                         Polygons with less than 3 or greater than 4 verts
          are NOT processed.

        * Tri/Quad Degen - triangles and quads will be 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, will be output to
                    the .rtg file. Note that if 'Texture per Polygon' is
          selected for Texture Mode (see below) and a < 3 or > 4 vert polygon
          is processed a texture may be generated but it will most likely
          be quite useless.


'Vertex Orientation'

        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 a front face.


'Quad to Tri Strip'

        This flag is only in 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 will have their vertices specified in
        a triangle strip form. This can be used, for example, for bringing
        geometry into a GL or OpenGL program that makes use of triangle strips.


'Output Vertex Norms'

        If this flag is 'OFF' then vertex normals will not be generated on
        output.  If 'ON' then a vertex NORMAL list will be generated for each
        object and each polygon entry for the object will contain a vertex
        normal index list.


'Output Texture Coord'

        If this flag is 'OFF' then vertex texture coordinates will not be
        generated on output.  If 'ON' then a vertex TEXCOORD list will be
        generated for each object and each polygon entry for the object will
        contain a vertex texture coordinate index list.


'Output Polygon Norms'

        If this flag is 'OFF' then polygon Normals will be omitted from
        polygon data lines. If 'ON' a polygon Normal entry will be included
        on each polygon data line. The Normal entry will start with an 'N'
        tag and will be specified in nX nY nZ order.


'Vert/VNorm Optimize'

        If this flag is 'OFF' then vertices in the VERTEX position list
        and the vertex normals in the vertex NORMAL list are not optimized
        ... i.e. one entry in each list will be generated for each vertex
        in a polyset.

        If it is 'ON' this means that the converter optimizes the VERTEX
        positions, i.e. only unique positions will generate an entry in the
        list. The vertex normals are similarly optimized when this flag is
        'ON'.


'Generate Textures'

        Two options:

        'for First Frame Only' - textures will only be generated on the first
                                 frame of animation.

        'for All Frames' - textures will only be generated on ALL frames of
                           animation.


'Texture Output'

        Select one of the following for texture output:

        'RTG bin' - RTG rgba byte oriented pixel binary file.

        or an image file output type:

        'Alias pix'
        'SGI rgb'
        'TIFF 8bit'
        'TIFF 16bit'

        Note that selecting RTG bin generates 1 file for all the textures of
        a frame. Selecting any of the image output formats will generate an
        image file for each texture swatch of a frame.


'Texture X res'
'Texture Y res'
'Texture Mode'
'Encoded Tex Res'

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

        'Texture Mode' specifies at what level to generate textures: Color
        Only (no textures generated - color assigned to polygon), Texture per
        Polygon (a texture is generated for each polygon), or Texture per
        Shader (a texture is generated for each shader that is assigned to
        outputted 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 Shader per Polygon and this option is 'Use Polyset
        Name' then the resolution will be decoded from the first polyset name
        encountered.

    IMPORTANT NOTE ON TEXTURE RESOLUTIONS:

        The converter will ignore these texture resolution values if the
        texture resolution is encoded in the Shader's/Polyset's name (within 
        PowerAnimator) AND if the 'Encoded Tex Res' option is not NONE.

        To edit a Shader's name in PowerAnimator first bring up the Multi-
        Lister from the 'Object Mod' menu. Double click on the Shader to bring
        up it's shader window, then edit it's Name field.

        To edit a Polyset's name in PowerAnimator first Pick all polysets for
        name editing. Then bring up the Object Mod->Render Stats window. In
        the window double click on the polyset name you wish to edit then type
        in a new name.

        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 will be created from a shader only if (1) it is assigned to
        a polyset or a group of polygons, AND if the shader is NOT just a color
        shader (i.e. it has texture or other mappings applied to it). Vertex
        texture coordinates are used for material assignment on polygons,
        so that only one texture is created for a shader that is assigned to
        many polygons. The polygons simply map into that one texture with
        vertex texture coordinates.

        If a polygon is assigned to a shader that is just a color then NO
        texture is created or referenced and a single RGB color is generated
        in that polygon's entry in the POLYGON_LIST.

        Texture per Polygon:

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


'Simple Lighting'

        If this flag is 'ON' and 'Texture Mode' is not 'Color Only' then all
        textures generated will have prelighted pixel values based on a fixed
        light source. Currently this does not use lighting from within
        PowerAnimator and simply uses a predetermined lighting model.


'Format Precision'

        This is an option to specify the precision on floating point
        values (i.e. number of decimal places to display) when the converter
        formats data for ASCII text output. The range is 1 to 15 decimal
        places.


'Newline'

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


'Show Index Counters'

        If this flag is 'ON' then index counters will be 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 are
        the first entry of each list entry, if specified to be included on
        output. If this flag is 'OFF' these index counters are omitted from
        output.


'Feedback Level'

        Option for how much info you want to see as the converter processes.
        'per Polygon' gives you the most ongoing feedback to let you know
        it's chugging along.



IMPORTANT NOTES
---------------

* All TEXTURES generated for a single .rtg file are put into one corresponding
  .bin file if 'RTG bin' is selected for the 'Texture Output' option. For data
  format details on both the .bin and .rtg file see the FORMAT_RTG
  documentation file.

* For image file output selection for the 'Texture Output' option one image
  file is generated per texture entry in the texture table for a single .rtg
  file.



GETTING WORLD TRANSFORMATIONS
-----------------------------

NOTE: you can ignore some of the following if you use the new option to
      output 'Local & World Transform Matrices' on Hierarchy output.

    The following is a description of one method to put together a transform
matrix for a leaf node. This hasn't been tested and verified as yet but it will
hopefully provide a starting point to putting together world (or global)
transformations.

One Approach:

    One way to get this going 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. Once 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 will need to build a transform matrix from the transform
data at that level in the hierarchy list. The following is the order of
operations in applying the data to build the matrix:

    1. Apply a translation from the scale pivot to the origin (0,0,0).

    2. Apply the scale factors in x, y, and z.

    3. Apply a translation from the origin back to the scale pivot.

    4. Apply a translation from the rotate pivot to the origin.

    5. Apply the x-axis rotation by x component of rotation.

    6. Apply the y-axis rotation by y component of rotation.

    7. Apply the z-axis rotation by z component of rotation.

    8. Apply a translation from the origin back to the rotate pivot.

    9. 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 then 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.

If you have our OpenModel API you can obtain the global matrices yourself
quite easily. Ask your local Alias|Wavefront sales office for information on
obtaining OpenModel. As well, if you do obtain OpenModel you can call our
Technical Support (provided you are on our maintenance program) with questions
on using the OpenModel API.


[END]
