psx.wiki

RSD (3D Model Data)

Text format for 3D models made with the PlayStation artist tools.

RSD (3D Model Data)
Extension.RSD
Version3.0 (@RSD970401)

Overview

The RSD format is used to represent 3D models, and the PlayStation artist tools are designed to work with it. An RSD model is represented as four separate files, which together are called "RSD" or "RSD data". The RSD file describes how the other files relate, so the collection of files that make up an object can be found from it. The RSDLINK utility converts RSD data to TMD.12

Table 1: RSD model files
File Contents
RSD Relationships between the PLY, MAT and GRP files, the texture files and the extended files
PLY Positions of the vertices of polygons
MAT Material information on polygons
GRP Grouping information on polygons

Four extended files and one sub-extended file were added in this version to support HMD. Because the OGP file is a sub-extended file, it can be named only from within a COD file:1

Table 2: RSD extended files
File Kind Contents
MSH Extended How polygons are linked
PVT Extended Offsets for centers of rotation
COD Extended COORDINATE information for VERTEX
MOT Extended Animation information
OGP Sub-extended Grouping information for VERTEX

All RSD files are text files whose lines end with LF or CR/LF, and lines that begin with '#' are comments. When all the files are in one directory they can be named by file name alone. Otherwise they must be referenced by relative or absolute path names, which is the same convention as a TIM file. The manual describes the following versions:13

Table 3: RSD file versions
File Version
RSD 3.0
PLY 3.0
MAT 3.0
GRP 3.0
MSH 1.0
PVT 1.0
COD 1.0
OGP 1.0
MOT 1.0

Each file opens with an ID string of the form "@XXXnnnnnn", in which XXX is the file type and nnnnnn gives the format version. Version 3.0 of the RSD file is therefore "@RSD970401", and version 1.0 of the MSH file is "@MSH970401".34

RSD File

The RSD file describes how the PLY, MAT and GRP files, the texture files and the extended files are combined for an object. With extended files, one set of RSD files can represent several objects, so data can be managed in character units. The file has an ID followed by the file specifications:35

Table 4: RSD file specifications
Line Contents
PLY= PLY file name
MAT= MAT file name
GRP= GRP file name
MSH= MSH file name
PVT= PVT file name
COD= COD file name
NMOT= Number of MOT files
MOT[n]= File name of the nth MOT file
NTEX= Number of TIM (texture) files
TEX[n]= File name of the nth TIM (texture) file

PLY File

The PLY file contains the positions of the vertices of polygons and related objects. When extended files are not used, its coordinate system is that of libgs. X increases toward the right of the screen, Y increases toward the bottom and Z points into the screen. When extended files are used during HMD conversion, each vertex in the COD file is converted into the libgs system with the rotations and translations of the PVT file.5

The front of a single-faced polygon is set by the order in which its vertices are listed in the POLYGON descriptor. The front is the side from which the vertices run clockwise (CW).5

A PLY file has the following parts. The data length record gives the number of lines in each data block, and its items are separated by spaces or tabs.6

Table 5: PLY file structure
Part Contents
ID "@PLYnnnnnn"
Data length record Number of lines in the VERTEX, NORMAL and POLYGON blocks
VERTEX descriptor X, Y and Z coordinates as floating point values, one vertex per line
NORMAL descriptor X, Y and Z elements of a normal vector as floating point values
POLYGON descriptor A flag and nine parameters

POLYGON Descriptor

The POLYGON descriptor consists of a flag that gives the type of polygon and nine parameters. The flag is a hexadecimal integer written without the '0x' prefix. The meaning of the parameters depends on the TYPE field of the flag:67

Table 6: PLY polygon types
TYPE Polygon type
000 Triangle
001 Quadrangle
010 Straight line
011 Sprite
1XX Reserved
Table 7: POLYGON descriptor parameters
Type Parameters
Triangle or quadrangle Vertex 0 to 3, then Normal 0 to 3
Straight line Vertex 0, Vertex 1, then zeros
Sprite Vertex 0, Width, Height, then zeros

For a triangle the data of the fourth vertex (vertex 3 and normal 3) is 0. A quadrangle is drawn as the triangle of vertices 1, 2 and 3 and the triangle of vertices 2, 3 and 4. A flat-shaded polygon uses the normal of the first vertex for all its vertices, while a Gouraud-shaded polygon has a different normal at each vertex.7

In modeling data a sprite is a rectangular image located in 3D space. It can be viewed as a textured polygon that always faces the viewpoint, and its parameters give its position and the width and height of the sprite pattern.7

MAT File

The MAT file holds the material of each polygon. It opens with the ID "@MATnnnnnn" and the number of MATERIAL descriptors that follow. Each descriptor takes one line. Each descriptor gives a polygon number, a flag, the shading and the material information.89

A polygon number is an index into the POLYGON group of the PLY file. Several polygons can be named on one line by a range or a list:9

Table 8: Polygon numbers
Values Specified polygons
1 1 only
0-5 0 1 2 3 4 5
2,4,6 2 4 6

Flag and Shading

The flag is a hexadecimal integer, written without the '0x' prefix, that gives the material attributes. With light-source calculation the color depends on the orientation of the light source relative to the polygon, while a fixed color stays constant regardless of orientation. When semitransparency is on, an untextured polygon is always semitransparent. A textured polygon is semitransparent or opaque or transparent according to the STP bit of its texture data.9

Table 9: MAT flag bits
Bit Contents
0 Light-source calculation mode: 0 calculations performed, 1 fixed color
1 Back face: 0 single-faced polygon, 1 double-faced polygon
2 Semitransparency: 0 off, 1 on
3..5 Semitransparency rate: 000 50% back + 50% polygon, 001 100% back + 100% polygon, 010 100% back - 100% polygon, 011 100% back + 25% polygon, 1XX reserved
6 Reserved, must be 0
7 Preset HMD generation switch (used only for generating HMD data): 0 off, 1 on

The current library does not permit the semitransparency rate to be changed for individual polygons. The shading is one character: "F" for flat and "G" for Gouraud (smooth). Flat shading is based on the normal of the first vertex in the PLY file.910

Material Information

The format of the material information depends on the material type, which is the first item. TNO selects the TIM file by its texture number in the RSD file, and Un and Vn give the texture position of each vertex. For a triangle the U3 and V3 of the fourth vertex are 0 and its RGB is 0 0 0.101112

Table 10: MAT material types
TYPE Material Items
C No texture (colored polygons and lines) R G B
G No texture (Gouraud-colored polygons and lines) R0 G0 B0 to R3 G3 B3
T Textured polygons and sprites TNO U0 V0 to U3 V3
D Polygons with colored textures TNO U0 V0 to U3 V3, R G B
H Polygons with gradation texture TNO U0 V0 to U3 V3, R0 G0 B0 to R3 G3 B3
W Polygons and sprites with repeating textures TNO TUM TVM TUA TVA U0 V0 to U3 V3
S Polygons with repeating colored textures TNO TUM TVM TUA TVA U0 V0 to U3 V3, R G B
N Polygons with repeating gradation textures TNO TUM TVM TUA TVA U0 V0 to U3 V3, R0 G0 B0 to R3 G3 B3

A colored texture applies a brightness to each polygon texture without light-source calculation, so a textured polygon can be drawn with a 3D look. A gradation texture gives the effect of textured Gouraud shading in the same way. These types are therefore valid only when the light-source calculation mode is fixed color.1112

For repeating textures, TUM and TVM are the UV coordinates of the repeating mask of the texture pattern. TUA and TVA are the UV upper address of the repeating texture pattern.11

GRP File

The GRP file assigns a name to a group of polygons in the PLY file, so that the polygons can be selected together in the material editor. It opens with the ID "@GRPnnnnnn" and the number of GROUP descriptors.13

Each GROUP descriptor has two or more lines. The first line holds the group name and the number of following lines and also the number of polygons in the group. The following lines give the polygon numbers, and a line can hold a range such as 3-7 or a list such as 2,4,6.13

MSH File

The MSH file is an extended RSD file that contains linkage information, and it allows HMD data with linkage information to be generated from RSD data. After the ID "@MSHnnnnnn" it gives the number of mesh groups (polygon entities linked together). Each entity is then written as its number of links followed by the link sequence, which follows the order of the polygon indexes of the PLY file. Line breaks are optional.414

PVT File

The PVT file is an extended RSD file that contains the offsets of the centers of rotation. This information is used when VERTEX values are rewritten in the coordinate system of libgs. After the ID "@PVTnnnnnn" and the number of elements, each line gives a COORDINATE index and its X, Y and Z offset.14

COD File

The COD file is an extended RSD file that applies COORDINATE attributes to the VERTEXes of a PLY file. HMD data with several MATRIXes can therefore be generated from RSD data. After the ID "@CODnnnnnn" the file names an OGP file as OGP=filename, or as OGP=NULL when there is none. The number of COORDINATEs follows, and then the COORDINATE structures and the members of each COORDINATE.15

Each COORDINATE structure takes six lines of decimal numbers:1516

Table 11: COORDINATE lines
Line Contents
1..3 Matrix coefficients m[0][0] to m[2][2]
4 Translation t[0] t[1] t[2]
5 Rotation vector vx vy vz used to generate the matrix coefficients
6 Index of the parent COORDINATE (super). An index that refers to itself means the parent is the world coordinate system.

When an OGP file is named, each member line gives a COORDINATE index, a number of object groups and the object group names. When no OGP file is named, the line gives a COORDINATE index, a number of VERTEXes and the VERTEX indexes of the PLY file. The two methods cannot be mixed in one COD file. Spaces or '-' are used as delimiters.1617

OGP File

The OGP file is a sub-extended RSD file that defines a group of VERTEXes as one object group, which makes the attributes of a whole object group easier to manage. After the ID "@OGPnnnnnn" and the number of object groups, each group is written as its name, its number of VERTEXes and the VERTEX indexes of the PLY file. Line breaks are optional.1718

MOT File

The MOT file is an extended RSD file that contains animation information. After the ID "@MOTnnnnnn" it gives the animation type, which is currently only COORDINATE transformation. The INDEX count follows, and each INDEX entry with its sequence headers is repeated that number of times.18

Each entry gives the INDEX of the data to transform and the number of sequence groups and also the name of the WORK TOP point. With the COORDINATE type, INDEX is the index of a COORDINATE in the COD file and the sequence count is the number of animation patterns. If there is no WORK sequence, an unused point name is given as WORK TOP.1819

The sequence header and control lines use the following reserved words. Stream IDs are 7-bit values in 0x?? notation, which are compared with the stream ID of the sequence. Point names are strings of up to 256 characters.1920

Table 12: MOT reserved words
Line Contents
START name stream-ID Start point of an animation sequence
KEY2 top1 top2 Top points of a key frame, at most two. TOP1 goes to the lower 16 bits of the HMD sequence header and TOP2 to the upper 16 bits.
SEQ frames type index A key frame: the number of frames up to it, the interpolation packet type and the index of the animation packet
GOTO name ID-after ID-before Branch within the sequence flow to the named point
END stream-ID End of a sequence flow

The parameter section gives the values of each animation packet type after the keyword TYPE. The packet types are the same as in HMD. In a name such as ps0r0t0, p marks a parameter and each digit after s, r and t selects the scale, rotation and translation format, where 0 means that the parameter is absent. A scale of 1 is 4096, and 360 degrees of rotation is 4096. Twelve packet types are supported:21

Table 13: MOT parameter packet types
Type Name Values
ps0r0t0 Dummy matrix Dx Dy
ps0r0t1 Translation linear Tx Ty Tz
ps0r0t9 Translation (short) linear Tx Ty Tz
ps9r0t9 Scale (one) translation (short) linear Tx Ty Tz Scale
ps1r0t0 Scale linear Sx Sy Sz
ps0r1t0 Rotation linear Rx Ry Rz
ps9r1t0 Scale (one) rotation linear Rx Ry Rz Scale
ps0r1t1 Rotation translation linear Tx Ty Tz Rx Ry Rz
ps9r1t1 Scale (one) rotation translation linear Tx Ty Tz Rx Ry Rz Scale
ps1r1t1 Scale rotation translation linear Tx Ty Tz Rx Ry Rz Sx Sy Sz
ps0r1t9 Rotation translation (short) linear Tx Ty Tz Rx Ry Rz
ps1r1t9 Scale rotation translation (short) linear Tx Ty Tz Rx Ry Rz Sx Sy Sz

References


  1. ^ a b c Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-3.

  2. ^ Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-24.

  3. ^ a b c Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-4, Figure 18.

  4. ^ a b Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-14, Figure 44.

  5. ^ a b c Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-5, Figure 19.

  6. ^ a b Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-6, Figures 20 to 23.

  7. ^ a b c Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-7, Figures 24 to 27.

  8. ^ Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-8, Figure 29.

  9. ^ a b c d Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-9, Figure 30 and Table 2-1.

  10. ^ a b Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-10, Figures 31 to 33.

  11. ^ a b c Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-11, Figures 34 to 36.

  12. ^ a b Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-12, Figures 37 and 38.

  13. ^ a b Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-13, Figures 40 to 42.

  14. ^ a b Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-15, Figures 45 and 46.

  15. ^ a b Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-16, Figure 48.

  16. ^ a b Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-17, Figure 49.

  17. ^ a b Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-18, Figure 50.

  18. ^ a b c Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-19, Figure 52.

  19. ^ a b Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-20.

  20. ^ Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-21.

  21. ^ Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-22.

Categories: File formats