psx.wiki

PMD (High-Speed Modeling 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 PMD format holds modeling data for the extended graphics library (libgs).[^ff235]+The PMD format is used for modeling data supported by the extended graphics library (libgs). PMD has a narrower range of functions than [TMD](/formats/tmd/), but this smaller scope enables faster processing. PMD handles only triangular and rectangular polygons. The data contains the areas in which packets are created, and polygons that have the same attributes are handled as groups.[^ff235]
−PMD has fewer functions than [TMD](/formats/tmd/). The smaller scope allows faster processing.[^ff235]
−
−PMD handles the following kinds of objects:[^ff235]
−
−- Triangular and rectangular polygons only
−- Packet creation areas contained in the data
−- Groups of polygons that have the same attributes
−
## File Structure## File Structure
−A PMD file holds a table of 3D objects with their PRIMITIVE and VERTEX data.[^ff235]+A PMD file consists of a table of 3D objects along with their PRIMITIVE and VERTEX descriptions. VERTEX groups exist only when vertices are shared, so VERT POINT is 0 for a file of independent vertices. The fields are as follows:[^ff235]
−The file has the following fields:
−
Table: PMD file structureTable: PMD file structure
Line 39:Line 29:
## Coordinate Values## Coordinate Values
−PMD coordinates follow the 3D coordinate space of the 3D graphics library. Each coordinate is a signed 16-bit integer from -32768 to +32767.[^ff236]+Coordinate values in a PMD file follow the 3D coordinate space of the 3D graphics library. The positive X axis points right, the positive Y axis points down and the positive Z axis points into the depth, and each coordinate is a signed 16-bit integer from -32768 to +32767.[^ff236]
−The positive X axis points right. The positive Y axis points down, and the positive Z axis points into the depth.[^ff236]+Vertices are stored as floating point values in the RSD format, so conversion from RSD to PMD converts and scales them as needed. The scale used is recorded in the object structure. However, the current version of libgs ignores the scale value.[^ff236]
−Conversion from RSD to PMD scales the floating point vertex values as needed. The current version of libgs ignores the scale value.[^ff236]
−
## OBJ TABLE## OBJ TABLE
−The OBJ TABLE holds pointers to the primitive groups of each object. One object is made of primitive groups.[^ff236]+The OBJ TABLE holds the pointers to the primitive groups of each object, because a single object is composed of primitive groups. NOBJ gives the number of objects. Each object then has an NPTR field followed by its pointers from POINTER 0 to POINTER (nptr-1).[^ff236]
−The table has the following fields:
−
Table: OBJ TABLE fieldsTable: OBJ TABLE fields
Line 59:Line 45:
| POINTER | Pointer to a primitive group || POINTER | Pointer to a primitive group |
−Each object has an NPTR field. Its pointers POINTER 0 to POINTER (nptr-1) follow.[^ff236]
−
## PRIMITIVE Group## PRIMITIVE Group
−A PRIMITIVE Gp is a group of graphics packets. One packet holds one primitive.[^ff236]+A PRIMITIVE Gp is a group of graphics packets for the primitives of an object, and a single packet contains one primitive. PMD primitives differ from the drawing primitives handled by libgpu. When libgs functions apply the perspective transformation, they are converted to drawing primitives.[^ff236]
−PMD primitives differ from the drawing primitives of libgpu. libgs functions convert them to drawing primitives by perspective transformation.[^ff236]+Each primitive group opens with one word that holds TYPE and NPACKET. The packet data follows:[^ff237]
−A primitive group opens with one word that holds TYPE and NPACKET.[^ff237]
−
−The word is as follows:
−
Table: Packet Gp headerTable: Packet Gp header
Line 78:Line 58:
| 16..31 | TYPE | Packet type || 16..31 | TYPE | Packet type |
−The TYPE bits are as follows:[^ff237]+The TYPE bits are laid out as follows:[^ff237]
Table: TYPE bit layoutTable: TYPE bit layout
Line 92:Line 72:
| 22..31 | Reserved for system | Reserved for system || 22..31 | Reserved for system | Reserved for system |
−The structure of the packet data depends on TYPE. Bits 20 and 21 do not change the packet data structure.[^ff237]+The packet data structure changes with the value of TYPE. However, bits 20 and 21 have no effect on it. Each structure holds a set of two drawing primitives for a double buffer, and the contents of both must be initialized in advance.[^ff237]
−Each packet holds two drawing primitives for a double buffer. Both must be initialized in advance.[^ff237]
−
## Packet Data## Packet Data
−Each TYPE value has its own packet structure:[^ff238][^ff239]+The packet data structure for each TYPE value is shown below. In each structure pkt[] is the corresponding drawing primitive packet. With independent vertices v1 to v4 are the vertex coordinates, and with shared vertices vp1 to vp4 are offsets from the start of the row of shared vertices.[^ff237][^ff238][^ff239]
Table: Packet data structuresTable: Packet data structures
Line 121:Line 99:
| 0f | Quadrangle, Gouraud, texture off, shared vertex | _poly_g4c | POLY_G4 pkt[2]; long vp1, vp2, vp3, vp4 || 0f | Quadrangle, Gouraud, texture off, shared vertex | _poly_g4c | POLY_G4 pkt[2]; long vp1, vp2, vp3, vp4 |
−pkt[] is the matching drawing primitive packet. v1 to v4 are the vertex coordinates.[^ff239]
−
−vp1 to vp4 are offsets from the start of the row of shared vertices.[^ff239]
−
## VERTEX## VERTEX
−The VERTEX group is an array of SVECTOR structures for shared vertices.[^ff239]+The VERTEX group is an array of SVECTOR structures for shared vertices. VX, VY and VZ are the X, Y and Z coordinates of the vertex as 16-bit integers:[^ff239]
−One structure is as follows:
−
Table: VERTEX structureTable: VERTEX structure
Line 138:Line 110:
| 1 | | VZ || 1 | | VZ |
−VX, VY and VZ are the X, Y and Z coordinates of the vertex as 16-bit integers.[^ff239]
−
## References## References