psx.wiki

TOD (Animation Data): Difference between revisions

Revision as of 02:22, 23 October 2026
RemmyLee
(Hardware and system software pages from the Sony manuals)
Revision as of 02:27, 23 October 2026
RemmyLee
(File format pages from the Sony File Formats manual)
Line 1:Line 1:
+---
+title: TOD (Animation Data)
+type: format
+summary: Frame-by-frame animation data for 3D objects of the extended graphics library (libgs).
+category: File formats
+info: Extension = .TOD
+info: File ID = 0x50
+---
+
+## Overview
+
+The TOD format describes a 3D object along the flow of time. It is used with the extended graphics library (libgs).[^ff240]
+
+For each frame of a 3D animation, a TOD file holds the data for objects that are created, changed or erased.[^ff240]
+
+The frames are arranged in time order.[^ff240]
+
+A TOD file has a file header followed by frame data.[^ff240]
+
+## Header
+
+The header is 2 words (64 bits):[^ff240]
+
+Table: TOD file header
+
+| Word | Bits | Field | Contents |
+| --- | --- | --- | --- |
+| 0 | 0..7 | File ID | Identifies an animation file. The value is 0x50. |
+| 0 | 8..15 | Version | Animation version. The value starts at 0x00. |
+| 0 | 16..31 | Resolution | Time one frame is displayed, in ticks (1 tick = 1/60 second) |
+| 1 | 0..31 | Number of frames | Number of frames in the file |
+
+## Frame
+
+The frames follow the header in time order. Each frame has a frame header followed by packets.[^ff241]
+
+The frame header is 2 words:[^ff241]
+
+Table: TOD frame header
+
+| Word | Bits | Field | Contents |
+| --- | --- | --- | --- |
+| 0 | 0..15 | Frame size | Frame length in words, including the header |
+| 0 | 16..31 | Number of packets | Number of packets |
+| 1 | 0..31 | Frame number | Frame number |
+
+## Packet
+
+Each packet has a one-word packet header followed by packet data.[^ff241]
+
+The size of the packet data differs between kinds of packets. It can also differ between packets of the same kind.[^ff241]
+
+The packet header is as follows:
+
+Table: TOD packet header
+
+| Bits | Field | Contents |
+| --- | --- | --- |
+| 0..15 | Object ID | The object to be handled |
+| 16..19 | Packet type | The type of packet data |
+| 20..23 | Flag | Meaning depends on the packet type |
+| 24..31 | Packet length | Size of the packet in words (4 bytes), including the header |
+
+The object is a 3D object (a GsDOBJ2 structure) of libgs. The packet data is applied to that object.[^ff242]
+
+The packet type gives the kind of data in the packet:[^ff242]
+
+Table: Packet type values and packet data contents
+
+| Packet type | Packet data |
+| --- | --- |
+| 0000 | Attribute |
+| 0001 | Coordinate (RST) |
+| 0010 | TMD data ID |
+| 0011 | Parent object ID |
+| 0100 | Matrix value |
+| 0101 | TMD data |
+| 0110 | Light source |
+| 0111 | Camera |
+| 1000 | Object control |
+| 1001..1101 | User defined |
+| 1110 | System reserved |
+| 1111 | Special commands |
+
+## Packet Data
+
+### Attribute
+
+Packet type 0000 holds the attribute of the GsDOBJ structure. The flag is not used.[^ff243]
+
+The packet data is 2 words. The first word is a mask, and the second holds the new value.[^ff243]
+
+In the mask a 0 bit marks an item that changes. A 1 bit marks an item that does not change.[^ff243]
+
+In the new value the bits of changing items hold the new data. The other bits are 0.[^ff243]
+
+The bits of the attribute are as follows:[^ff243][^ff244]
+
+Table: Packet data bit-by-bit breakdown
+
+| Bit | Item | Values |
+| --- | --- | --- |
+| 0..2 | Material damping | 0 to 3: material damping 0 to 3 |
+| 3 | Lighting mode, part 1 | 0 fog off, 1 fog on |
+| 4 | Lighting mode, part 2 | 0 material on, 1 material off |
+| 5 | Lighting mode, part 3 | 0 use lighting mode, 1 use default lighting mode |
+| 6 | Light source | 0 light-source calculation off, 1 forced light-source calculation on |
+| 7 | NearZ overflow handling | 0 z overflow clip, 1 z overflow not clip |
+| 8 | Back clipping status | 0 valid, 1 invalid |
+| 9..27 | Reserved | Initialized at 0 |
+| 28..29 | Semi-transparency rate | 00 50% back + 50% polygon, 01 100% back + 100% polygon, 10 100% back - 100% polygon, 11 50% back + 25% polygon |
+| 30 | Semi-transparency | 0 off, 1 on |
+| 31 | Display | 0 display, 1 no display |
+
+To switch forced light-source calculation on, the mask is 0xffbf and the new value is 0x0040.[^ff244]
+
+### Coordinate (RST)
+
+Packet type 0001 sets the coordinates of the GsDOBJ structure.[^ff244]
+
+The flag bits are as follows:[^ff244][^ff245]
+
+Table: Flag when Coordinate (RST)
+
+| Bit | Flag | Values |
+| --- | --- | --- |
+| 0 | Matrix type | 0 absolute value, 1 differential matrix from the preceding frame |
+| 1 | Rotation (R) | 0 none, 1 has |
+| 2 | Scaling (S) | 0 none, 1 has |
+| 3 | Translation (T) | 0 none, 1 has |
+
+The packet data holds the R, S and T values whose flags are set. They appear in the order R, S, T.[^ff245]
+
+The values are as follows:
+
+Table: RST values
+
+| Values | Contents | Format |
+| --- | --- | --- |
+| Rx, Ry, Rz | X, Y and Z components of the angle of rotation. One degree is 4096. | Fixed point (1, 19, 12) |
+| Sx, Sy, Sz | X, Y and Z components of the scaling | Fixed point (1, 3, 12) |
+| Tx, Ty, Tz | X, Y and Z components of the translation | Integer (1, 31, 0) |
+
+Each R value takes one word. Sx and Sy share one word, and Sz takes the low half of the next.[^ff245]
+
+### TMD Data ID
+
+Packet type 0010 holds the modeling data ID (TMD data) of the object. The ID is 2 bytes. The flag is not used.[^ff245]
+
+### Parent Object ID
+
+Packet type 0011 holds the ID of the parent object. The ID is 2 bytes. The flag is not used.[^ff246]
+
+### Matrix Value
+
+Packet type 0100 holds the coord members of the GsCOORDINATE2 structure that the GsDOBJ2 structure points to. The flag is not used.[^ff246]
+
+### TMD Data Body
+
+Packet type 0101 holds TMD data. This type is not supported at present.[^ff246]
+
+### Light Source
+
+Packet type 0110 sets a light source. The object ID becomes a light source ID. Light source IDs are separate from the normal object IDs.[^ff246]
+
+The flag bits are as follows:
+
+Table: Flag when Light Source Packet
+
+| Bit | Flag | Values |
+| --- | --- | --- |
+| 0 | Data type | 0 absolute value, 1 difference from the preceding frame |
+| 1 | Direction | 0 none, 1 has |
+| 2 | Color | 0 none, 1 has |
+
+Each axis of the direction takes one word. The color takes one word.[^ff247]
+
+### Camera
+
+Packet type 0111 sets the viewpoint. The object ID becomes a camera ID. Camera IDs are separate from the normal object IDs.[^ff247]
+
+Bit 0 of the flag is the camera type. The meaning of the other bits depends on it.[^ff247]
+
+The flag bits are as follows:
+
+Table: Flag for Camera
+
+| Bit | Camera type 0 | Camera type 1 |
+| --- | --- | --- |
+| 1 | Data type: 0 absolute, 1 difference from the preceding frame | Data type: 0 absolute, 1 difference from the preceding frame |
+| 2 | Position and reference position: 0 none, 1 has | Rotation (R): 0 none, 1 has |
+| 3 | Reference angle (z angle): 0 none, 1 has | Translation (T): 0 none, 1 has |
+
+With camera type 0, Tx, Ty and Tz are the camera position. TRx, TRy and TRz are the close-up position, and Z is the angle.[^ff248]
+
+With camera type 1, Rx, Ry and Rz are the rotation. Tx, Ty and Tz are the translation.[^ff248]
+
+### Object Control
+
+Packet type 1000 has no packet data.[^ff248]
+
+The flag gives the operation:
+
+Table: Flag for Object Control
+
+| Flag | Meaning |
+| --- | --- |
+| 0 | Create |
+| 1 | Kill |
+| 0010..1111 | System reserved |
+
+### Extended and Special Commands
+
+Packet type 1110 holds extended commands.[^ff248]
+
+Packet type 1111 controls the animation. The details of these special commands were not final in the manual.[^ff248]
+
+## References
+
+[^ff240]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-40, Figure 81.
+[^ff241]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-41, Figure 82.
+[^ff242]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-42, Figures 83 and 84.
+[^ff243]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-43, Figure 85 and Table 2-3.
+[^ff244]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-44, Figures 86 and 87.
+[^ff245]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-45, Figure 88.
+[^ff246]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-46, Figures 89 to 92.
+[^ff247]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-47, Figures 93 and 94.
+[^ff248]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-48, Figures 95 to 97.