TDDD

Also Known As: Turbo Silver 3D Data Description, T3D


Type 3D vector and animation
Colors 16 million
Compression Uncompressed
Maximum Image Size Unlimited
Multiple Images Per File Yes
Numerical Format Big-endian
Originator Impulse
Platform All
Supporting Applications Turbo Silver
See Also Interchange File Format

Usage
Interchange of 3D image information, primarily on the Amiga.

Comments
A slightly modified version of IFF that is widely used.

Vendor specifications are available for this format.


The TDDD (Turbo Silver 3D Data Description) format is used to store object data created by the Turbo Silver 3.0 application from Impulse. The TDDD format is actually the Electronic Arts Interchange File Format (IFF) with modifications to two of its chunks. For this reason, please read the IFF article before you read this article about TDDD.

Contents:
File Organization
File Details
For Further Information

File Organization

Like IFF files, TDDD files consist of a series of sections called chunks.

The FORM chunk of a TDDD file uses only two types of IFF chunks: INFO and OBJ.

The INFO chunk stores information describing observer data and appears in cell files. Each INFO chunk contains standard IFF sub-chunks. The INFO chunk is optional and might not appear at all in the FORM chunk.

The OBJ chunk contains data which describes an object hierarchy and appears in both cell and object files. One or more OBJ chunks are contained in the FORM chunk and each OBJ chunk contains one or more sub-chunks.

There are three types of OBJ sub-chunks:

  1. EXTR describes an "external" object in a separate file.

  2. DESC describes a single node of a hierarchy.

  3. TOBJ marks the end of a hierarchy chain.

Each hierarchy node is described either by an EXTR chunk or by a DESC and TOBJ chunk pair.

The TOBJ sub-chunks contain no data and have a length of zero. The DESC and EXTR sub-chunks contain sub-chunks as defined by the IFF file format. Unrecognized sub-chunks are skipped over by TDDD readers, and the default values are assumed for any missing sub-chunks.

The object hierarchy contains a head object and one or more brothers. Each brother may have child objects; the children may have grandchildren; and so on. The brother nodes are stored in a doubly linked list, and each node has a pointer to a doubly linked "child" list. (If no child is present, then the pointer is NULL.) Child lists point to grandchildren lists and back to their parent, and so on.

Each of the "head" brothers is written in a separate OBJ chunk, along with all its descendants. Each child, grandchild, and so on in the descendant hierarchy begins a DESC chunk and ends with a TOBJ chunk. Objects stored in external files are described only with a single EXTR chunk. The children and grandchildren of this external object are also stored in the same external file.

File Details

Several data types are used to represent fields within several sub-chunks. RGB values are always represented by an array of three BYTE values and the values are stored in RGB order. Fractional (FRACT) and point values are stored as LONG values. A VECTOR is an array of three FRACT values and a MATRIX is an array of three VECTOR values. With this in mind, here are the structures for these data types:

typedef BYTE COLOR[3];  /* Red, Green, and Blue values */
typedef LONG FRACT;     /* Point */
typedef struct _Vectors
{
  FRACT X;
  FRACT Y;
  FRACT Z;
} VECTOR;
typedef struct _Matrices
{
  VECTOR I;
  VECTOR J;
  VECTOR K;
} MATRIX;

The following structure is used in generating animated cells from a single cell. It can be attached to an object or to the camera. It is also used for Turbo Silver's "extrude along a path" feature.

typedef struct _Story
{
  BYTE   Path[18];      /* Name of object */
  VECTOR Translate;     /* Translate vector */
  VECTOR Rotate;        /* Rotate vector */
  VECTOR Scale;         /* Scale vector */
  WORD  Info;           /* Coordinate flags */
} STORY;

Path is the name of a named object in the cell data.

Translate is not used.

Rotate specifies rotation angles about the X, Y, and Z axes of the vector.

Scale specifies X, Y, and Z factors of the scale vector.

Info contains a collection of bitfield flags with the following definitions:

0x0001 ABS_TRA Translate in world coordinates (not used)
0x0002 ABS_ROT Rotation in world coordinates
0x0004 ABS_SCL Scaling in world coordinates
0x0010 LOC_TRA Translate in local coordinates (not used)
0x0020 LOC_ROT Rotation in local coordinates
0x0040 LOC_SCL Scaling in local coordinates
0x0100 X_ALIGN Not used
0x0200 Y_ALIGN Align Y axis to path's direction
0x0400 Z_ALIGN Not used
0x1000 FOLLOW_ME Children follow parent on path

INFO Chunk

The following sub-chunk structures are found only in the INFO chunk. All of these INFO sub-chunks are optional, as is the INFO chunk itself. If a sub-chunk is not present, then its default value is assumed. The base default values for an INFO chunk are the following:

The BRSH sub-chunk defines a brush. There may be up to eight brushes defined in an INFO chunk.

typedef struct _Brush
{
  WORD BrushNumber;     /* Brush number (0 to 7) */
  CHAR FileName[80];    /* IFF ILBM filename */
} BRSH;

BrushNumber is the identification number of the brush, and this value may be in the range of 0 to 7.

FileName is the name of the IFF file which stores the brush information.

The STNC sub-chunk defines a stencil. There may be up to eight stencils defined in an INFO chunk.

typedef struct _Stencil
{
  WORD StencilNumber;    /* Stencil number (0 to 7) */
  CHAR FileName[80];     /* IFF ILBM filename */
} STNC;

StencilNumber is the identification number of the stencil, and this value may be in the range of 0 to 7. FileName is the name of the IFF file which stores the stencil information.

The TXTR sub-chunk defines a text resource. There may be up to eight resources defined in an INFO chunk.

typedef struct _Text
{
  WORD TextNumber;      /* Text number (0 to 7) */
  CHAR FileName[80];    /* Code module name */
} TXTR;

TextNumber is the identification number of the resource, and this value may be in the range of 0 to 7.

FileName is the name of a code module that can be loaded using the LoadSeg() function found in Turbo Silver.

The OBSV sub-chunk specifies the location, position, and focal length of the camera observer. The rotation angles are in degrees and specify the degree of rotation around the X, Y, and Z axes.

typedef struct _Observer
{
  VECTOR Camera;        /* Camera position */
  VECTOR Rotate;        /* Camera rotation angles */
  FRACT  Focal;         /* Camera focal length */
} OBSV;

The OTRK sub-chunk specifies the name of an object; otherwise the camera always follows the tracked object.

typedef struct _ObjectTrack
{
  BYTE TrackName[18];   /* Name of tracked object */
} OTRK;

The OSTR sub-chunk contains the story information for the camera.

typedef struct _ObjectStory
{
  STORY CStory;         /* STORY structure for the camera */
} OSTR;

FADE contains the parameters for a fading operation.

typedef struct _Fade
{
  FRACT FadeAt;         /* Distance to start fade */
  FRACT FadeBy;         /* Distance of total fade */
  BYTE  Pad;            /* Pad byte (always 0) */
  COLOR FadeTo;         /* RGB color to fade to */
} FADE;

The SKYC sub-chunk defines the color of a rendered sky.

typedef struct SkyColor
{
  BYTE    Pad1;         /* Pad byte (always 0) */
  COLOR   Horizon;      /* Horizon color */
  BYTE    Pad2;         /* Pad byte (always 0) */
  COLOR   Zenith;       /* Zenith color */
} SKYC;

The AMBI sub-chunk defines the ambient light color of the rendering.

typedef struct _AmbientLightColor
{
  BYTE    Pad;          /* Pad byte (always 0) */
  COLOR   Ambient;      /* Ambient light color */
} AMBI;

The GLB0 sub-chunk contains an array of eight global property values used by Turbo Silver.

typedef struct _GlobalProperties
{
  BYTE Props[8];        /* Eight global properties */
} GLB0;

The elements are defined as follows:

0 GLB_EDGING Edge level value
1 GLB_PERTURB Perturbance value
2 GLB_SKY_BLEND Sky blending factor
3 GLB_LENS Lens type
4 GLB_FADE Sharp/fuzzy focus
5 GLB_SIZE Apparent size
6 GLB_RESOLVE Resolve depth
7 GLB_EXTRA Genlock sky flag

GLB_EDGING and GLB_PERTURB correspond to the edging and perturbance values heuristics control in ray tracing.

GLB_SKY_BLEND is zero for no blending and 255 for full blending.

The GLB_LENS value corresponds to the boxes in the "camera" requester, and may be 0 (manual), 1 (wide angle), 2 (normal), 3 (telephoto), or 4 (custom).

GLB_FADE turns the "fade" feature ON (non-zero) and OFF (zero).

GLB_SIZE is 100 times the "custom size" parameter in the camera requester and is used to set the focal length for a custom lens. GLB_RESOLVE specifies the number of rays the ray tracer will shoot for a single pixel.

The GLB_EXTRA flag indicates if the sky is colored or is set to the "genlock" color (color 0 to black) in the final picture. If "genlock" is set in TurboSilver, a "zero color" is written into the bitplanes for genlock video to show through.

DESC Chunk

The following sub-chunk structures are only found in the DESC chunk. Many of these sub-chunks are optional (the SHAP sub-chunk is required to appear), and all have default values if they are not present. Note that if there is a FACE chunk, there must also be a CLST, an RLST, and a TLST sub-chunk as well, all with matching Count fields.

The default for the DESC chunk sub-chunks are: Colors set to (240,240,240); reflection and transmission coefficients set to zero; illegal shape; no story or special surface types; position at (0,0,0); axes aligned to the world axes; size fields all 32.0; intensity at 300; no name; no points/edges or faces; texture parameters set to zero; refraction type 0 with index 1.00; specular, hardness and roughness set to zero; blending at 255; glossy off; phong shading on; not a light source and not brightly lit.

The NAME sub-chunk contains the name of the object itself and is used by a number of operations, including camera tracking and specifying story paths.

typedef struct _ObjectName
{
  BYTE Name[18];         /* The name of the object */
} NAME;

The SHAP sub-chunk defines the visible appearance of an object.

typedef struct _ObjectShape
{
  WORD Shape;           /* Object type */
  WORD Lamp;            /* Lamp type */
} SHAP;

Shape values include:

0 Sphere
1 Stencil
2 Axis
3 Facets
4 Surface
5 Ground

Lamp values include:

0 No lamp
1 Light is sunlight
2 Light is from a lamp, and intensity falls off with distance

The POSI sub-chunk specifies the position of an object in a rendering.

typedef struct _ObjectPosition
{
  VECTOR  Position;     /* The object's position in space */
} POSI;

Legal coordinates are in the range -32768 to 32767 and 65535/65536.

The AXIS sub-chunk describes a direction (orthogonal unit) vector for the object coordinate system.

typedef struct _VectorAxis
{
  VECTOR  XAxis;              /* X axis of vector */
  VECTOR  YAxis;              /* Y axis of vector */
  VECTOR  ZAxis;              /* Z axis of vector */
} AXIS;

The SIZE sub-chunk is used by a variety of operations requiring a vector size value.

typedef struct _Size
{
  VECTOR Size;                /* Object size */
} SIZE;

The PNTS sub-chunk stores all the points defining a custom objects.

typedef struct _Points
{
  WORD   PCount;               /* Point count */
  VECTOR Points[PCount];       /* Points */
} PNTS;

The EDGE sub-chunk contains the edge list for custom objects.

typedef struct _EdgeList
{
  WORD ECount;                 /* Edge count */
  WORD Edges[ECount][2];       /* Edges */
} EDGE;

The FACE sub-chunk contains the triangle (face) list for custom objects.

typedef struct _FaceList
{
  WORD   TCount;               /* Face count */
  WORD   Connects[TCount][3];  /* Faces */
} FACE;

The COLR sub-chunk contains the main object color coefficients.

typedef struct _Color
{
  BYTE  Pad;                   /* Pad byte (always 0) */
  COLOR Color;                 /* RGB color */
} COLR;

The REFL sub-chunk contains the main object reflection coefficients.

typedef struct _Reflection
{
  BYTE  Pad;                   /* Pad byte (always 0) */
  COLOR Color;                 /* RGB color */
} REFL;

The TRAN sub-chunk contains the main object transmission coefficients.

typedef struct _Transmission
{
  BYTE  Pad;                   /* Pad byte (always 0) */
  COLOR Color;                 /* RGB color */
} TRAN;

The CLST sub-chunk contains the main object color coefficients for each face in custom objects.

typedef struct _ColorList
{
  WORD Count;                  /* Count of colors */
  COLOR Colors[Count];         /* Colors */
} CLST;

The count should match the face count in the FACE chunk and the ordering corresponds to the face order.

The RLST sub-chunk contains the main object reflection coefficients for each face in custom objects.

typedef struct _ReflectionList
{
  WORD Count;                  /* Count of colors */
  COLOR Colors[Count];         /* Colors */
} RLST;

The count should match the face count in the FACE chunk and the ordering corresponds to the face order.

The TLST sub-chunk contains the main object transmission coefficients for each face in custom objects.

typedef struct _TransmissionList
{
  WORD Count;                  /* Count of colors */
  COLOR Colors[Count];         /* Colors */
} TLST;

The count should match the face count in the FACE chunk and the ordering corresponds to the face order.

The TPAR sub-chunk contains a list of parameters for texture modules when texture mapping is used.

typedef struct _TextureParameters
{
  FRACT Params[16];           /* Texture parameters */
} TPAR;

The SURF sub-chunk contains an array of five surface property specifications.

typedef struct _SurfaceProperties
{
  BYTE SProps[5];             /* Object properties */
} SURF;

The elements are defined as follows:

0 PRP_SURFACE Surface type
1 PRP_BRUSH Brush number
2 PRP_WRAP IFF brush wrapping type
3 PRP_STENCIL Stencil number for stencil objects
4 PRP_TEXTURE Texture number if texture mapped

PRP_SURFACE is the type of surface. Values for this element include 0 (normal), 4 (genlock), and 5 (IFF brush).

PRP_BRUSH is the brush identification number if the brush is mapped to an IFF file.

PRP_WRAP is the IFF brush-wrapping type. Values for this element may be 0 (no wrapping), 1 (wrap X), 2 (wrap Z), or 3 (wrap X and Z).

PRP_STENCIL is the stencil number for stencil objects.

PRP_TEXTURE is the texture number if the object is texture-mapped.

The MTTR sub-chunk contains refraction data for transparent or glossy objects. Type may have a value of 0 for air (refraction index of 1.00), 1 for water (1.33), 2 for glass (1.67), 3 for crystal(2.00), or 4 for a custom index (1.00 to 3.55). Index contains the value of the custom refraction index.

typedef struct _RefractionData
{
    BYTE Type;	/* Refraction type (0-4) */
    BYTE Index;	/* Custom index of refraction */
} MTTR;

The SPEC sub-chunk contains specularity information.

typedef struct _SpecularInfo
{
BYTE Specularity;	/* Specular reflection (0 to 255) */
BYTE Hardness;	/* Specular exponent (0 to 31) */
} SPEC;

Specularity contains the amount of specular reflection in the range of 0 (none) to 255 (fully specular).

Hardness specifies the "tightness" of the specular spots. A value of zero gives broad specular spots and a value of 31 gives smaller spots.

The PRP0 sub-chunk contains an array of object properties that programs other than Turbo Silver might support.

typedef struct _MiscProperties
{
    BYTE Props[6];	/* Object properties */
} PRP0;

The elements are defined as follows:

0 PRP_BLEND Blending factor
1 PRP_SMOOTH Roughness factor
2 PRP_SHADE Shading flag
3 PRP_PHONG Phong shading flag
4 PRP_GLOSSY Glossy flag
5 PRP_QUICK Quickdraw flag

PRP_BLEND controls the amount of dithering used on the object in the range of 0 to 255 (255 being fully dithered).

PRP_SMOOTH specifies how rough the object should appear in the range of 0 (completely smooth) to 255 (maximal roughness).

PRP_SHADE indicates how the object is shaded. If the object is a light source and the flag is ON, then the object casts a shadow; otherwise it does not. If the object is a normal object and the flag is ON, the object is always considered fully lit and is not affected by other light sources.

PRP_PHONG indicates that phong shading is on by default. Any non-zero value turns it off.

PRP_GLOSSY indicates if an object is to be rendered as glossy or normal.

PRP_QUICK flag, when set, indicates that the image should not be drawn with all the points and edges, but instead should be drawn as a rectangular solid centered at the object position using sizes determined by the axis lengths.

The INTS sub-chunk is the intensity field for light source objects.

typedef struct _Intensity
{
  FRACT Intensity;      /* Light intensity */
} INTS;

An intensity of 255 for a sun-like light fully lights object surfaces which are perpendicular to the direction to the light source. For lamp-like light sources, the necessary intensity will depend on the distance to the light.

The STRY sub-chunk contains the story information for the description.

typedef struct _Story
{
  STORY CStory;
} STRY;

The EXTR chunk only contain sub-chunks which are required to appear.

EXTR Chunk

MTRX is used to represent a set of matrix coordinates.

typedef struct _Matrix
{
  VECTOR Translate;     /* Translation vector */
  VECTOR Scale;         /* X, Y, and Z scaling factors */
  MATRIX Rotate;        /* Rotation matrix */
} MTRX;

Translate is the translation vector in world coordinates.

Scale is the scaling factors with respect to local axes.

Rotate is the rotation matrix with respect to the world axes.

The LOAD sub-chunk contains the name of an external FORM object file, which may contain any number of objects, possibly grouped into hierarchies.

typedef struct _FileName
{
    BYTE FileName[80];	/* External object file name */
} LOAD; 

For Further Information

For further information about TDDD, see the summary description included on the CD-ROM. See also the article about TTDDD, an ASCII format based on TDDD, and the article on IFF, the format on which TDDD is based.



Copyright © 1996, 1994 O'Reilly & Associates, Inc. All Rights Reserved.