RSD (3D Model Data): Difference between revisions
| Revision as of 02:27, 23 October 2026 RemmyLee (File format pages from the Sony File Formats manual) | Revision as of 02:47, 23 October 2026 RemmyLee (Formats: Sony paragraph voice; HMD, RSD extended files, full BS code book; sprite editor formats) | ||
| Line 10: | Line 10: | ||
| ## Overview | ## Overview | ||
| − | The RSD format represents 3D models. The PlayStation artist tools work with RSD models.[^ff23] | + | 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](/formats/tmd/).[^ff23][^ff224] |
| − | An RSD model is made of four files. Together they are called "RSD" or "RSD data".[^ff23] | ||
| − | |||
| − | The four files are as follows: | ||
| − | |||
| − | |||
| Table: RSD model files | Table: RSD model files | ||
| Line 26: | Line 21: | ||
| | GRP | Grouping information on polygons | | | GRP | Grouping information on polygons | | ||
| − | Four extended files and one sub-extended file were added to support [HMD](/formats/hmd/).[^ff23] | + | Four extended files and one sub-extended file were added in this version to support [HMD](/formats/hmd/). Because the OGP file is a sub-extended file, it can be named only from within a COD file:[^ff23] |
| − | The extended files are as follows: | ||
| − | |||
| − | |||
| Table: RSD extended files | Table: RSD extended files | ||
| Line 39: | Line 31: | ||
| | COD | Extended | COORDINATE information for VERTEX | | | COD | Extended | COORDINATE information for VERTEX | | ||
| | MOT | Extended | Animation information | | | MOT | Extended | Animation information | | ||
| − | | OGP | Sub-extended | Grouping information for VERTEX. Named only from a COD file. | | + | | OGP | Sub-extended | Grouping information for VERTEX | |
| − | All RSD files are text files. Lines end with LF or CR/LF, and lines that begin with '#' are comments.[^ff23] | + | 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:[^ff23][^ff24] |
| − | Files in one directory are named by their file names alone. Files in other directories need relative or absolute path names.[^ff23] | ||
| − | |||
| − | The manual describes the following versions:[^ff24] | ||
| − | |||
| Table: RSD file versions | Table: RSD file versions | ||
| Line 61: | Line 49: | ||
| | MOT | 1.0 | | | MOT | 1.0 | | ||
| − | RSDLINK converts RSD data to [TMD](/formats/tmd/).[^ff224] | + | 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".[^ff24][^ff214] |
| ## RSD File | ## RSD File | ||
| − | The RSD file tells how the other files combine for one object. With extended files, one set of RSD files can hold several objects.[^ff24] | + | 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:[^ff24][^ff25] |
| − | The RSD file has an ID followed by file specifications.[^ff24] | ||
| − | |||
| − | The ID is a string "@RSDnnnnnn" that gives the format version. Version 3.0 is "@RSD970401".[^ff24] | ||
| − | |||
| − | The file specifications are as follows: | ||
| − | |||
| − | |||
| Table: RSD file specifications | Table: RSD file specifications | ||
| Line 91: | Line 72: | ||
| ## PLY File | ## PLY File | ||
| − | The PLY file holds the vertex positions of polygons and related objects.[^ff25] | + | 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.[^ff25] |
| − | Without extended files, the PLY coordinate system is the libgs system. X increases to the right and Y increases down, and Z points into the screen.[^ff25] | + | 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).[^ff25] |
| − | With extended files, HMD conversion converts each COD vertex into the libgs system. The rotations and translations of the PVT file are applied.[^ff25] | + | 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.[^ff26] |
| − | The order of the vertices sets the front of a single-faced polygon. The front is the side from which the vertices run clockwise.[^ff25] | ||
| − | |||
| − | A PLY file has the following parts:[^ff26] | ||
| − | |||
| Table: PLY file structure | Table: PLY file structure | ||
| | Part | Contents | | | Part | Contents | | ||
| | --- | --- | | | --- | --- | | ||
| − | | ID | "@PLYnnnnnn". Version 3.0 is "@PLY970401". | | + | | ID | "@PLYnnnnnn" | |
| | Data length record | Number of lines in the VERTEX, NORMAL and POLYGON blocks | | | 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 | | | VERTEX descriptor | X, Y and Z coordinates as floating point values, one vertex per line | | ||
| Line 113: | Line 90: | ||
| ### POLYGON Descriptor | ### POLYGON Descriptor | ||
| − | The flag is a hexadecimal integer without the '0x' prefix. Its TYPE field gives the polygon type.[^ff27] | + | 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:[^ff26][^ff27] |
| − | The TYPE values are as follows: | ||
| − | |||
| − | |||
| Table: PLY polygon types | Table: PLY polygon types | ||
| Line 128: | Line 102: | ||
| | 1XX | Reserved | | | 1XX | Reserved | | ||
| − | The nine parameters depend on the type:[^ff27] | ||
| − | |||
| Table: POLYGON descriptor parameters | Table: POLYGON descriptor parameters | ||
| Line 138: | Line 110: | ||
| | Sprite | Vertex 0, Width, Height, then zeros | | | Sprite | Vertex 0, Width, Height, then zeros | | ||
| − | For a triangle, vertex 3 and normal 3 are 0. A quadrangle is drawn as two triangles.[^ff27] | + | 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.[^ff27] |
| − | A flat-shaded polygon uses the normal of the first vertex. A Gouraud-shaded polygon has a normal for each vertex.[^ff27] | + | 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.[^ff27] |
| − | A sprite is a rectangular image in 3D space. It acts as a textured polygon that always faces the viewpoint.[^ff27] | ||
| − | |||
| ## MAT File | ## MAT File | ||
| − | The MAT file opens with an ID "@MATnnnnnn" and a MATERIAL descriptor count. The MATERIAL descriptors follow.[^ff28][^ff29] | + | 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.[^ff28][^ff29] |
| − | Each MATERIAL descriptor holds a polygon number, a flag, the shading and the material information for one polygon.[^ff29] | + | 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:[^ff29] |
| − | The polygon number is an index into the POLYGON group of the PLY file.[^ff29] | + | Table: 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.[^ff29] | ||
| + | |||
| + | Table: 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.[^ff29][^ff210] | ||
| + | |||
| + | ### 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.[^ff210][^ff211][^ff212] | ||
| + | |||
| + | Table: 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.[^ff211][^ff212] | ||
| + | |||
| + | 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.[^ff211] | ||
| + | |||
| + | ## 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.[^ff213] | ||
| + | |||
| + | 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.[^ff213] | ||
| + | |||
| + | ## 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.[^ff214][^ff215] | ||
| + | |||
| + | ## 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.[^ff215] | ||
| + | |||
| + | ## 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.[^ff216] | ||
| + | |||
| + | Each COORDINATE structure takes six lines of decimal numbers:[^ff216][^ff217] | ||
| + | |||
| + | Table: 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.[^ff217][^ff218] | ||
| + | |||
| + | ## 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.[^ff218][^ff219] | ||
| + | |||
| + | ## 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.[^ff219] | ||
| + | |||
| + | 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.[^ff219][^ff220] | ||
| + | |||
| + | 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.[^ff220][^ff221] | ||
| + | |||
| + | Table: 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:[^ff222] | ||
| + | |||
| + | Table: 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 | ## References | ||
| Line 160: | Line 246: | ||
| [^ff27]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-7, Figures 24 to 27. | [^ff27]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-7, Figures 24 to 27. | ||
| [^ff28]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-8, Figure 29. | [^ff28]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-8, Figure 29. | ||
| − | [^ff29]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-9, Figure 30. | + | [^ff29]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-9, Figure 30 and Table 2-1. |
| + | [^ff210]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-10, Figures 31 to 33. | ||
| + | [^ff211]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-11, Figures 34 to 36. | ||
| + | [^ff212]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-12, Figures 37 and 38. | ||
| + | [^ff213]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-13, Figures 40 to 42. | ||
| + | [^ff214]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-14, Figure 44. | ||
| + | [^ff215]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-15, Figures 45 and 46. | ||
| + | [^ff216]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-16, Figure 48. | ||
| + | [^ff217]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-17, Figure 49. | ||
| + | [^ff218]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-18, Figure 50. | ||
| + | [^ff219]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-19, Figure 52. | ||
| + | [^ff220]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-20. | ||
| + | [^ff221]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-21. | ||
| + | [^ff222]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-22. | ||
| [^ff224]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-24. | [^ff224]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-24. | ||