psx.wiki

PMD (High-Speed Modeling 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: PMD (High-Speed Modeling Data)
+type: format
+summary: Modeling data for libgs that holds ready drawing packets for fast processing.
+category: File formats
+info: Extension = .PMD
+info: ID = 0x00000042
+---
+
+## Overview
+
+The PMD format holds modeling data for the extended graphics library (libgs).[^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
+
+A PMD file holds a table of 3D objects with their PRIMITIVE and VERTEX data.[^ff235]
+
+The file has the following fields:
+
+Table: PMD file structure
+
+| Field | Contents |
+| --- | --- |
+| ID | 32-bit word with the version of the PMD file. The current version is 0x00000042. |
+| PRIM POINT | 32-bit offset of the PRIMITIVE Gp section from the start of the file |
+| VERT POINT | 32-bit offset of the VERTEX Gp section from the start of the file. 0 for independent vertices. |
+| OBJ TABLE | The array of objects |
+| PRIMITIVE Gp | Groups of polygons that have the same attributes |
+| VERTEX Gp | Array of vertex coordinates, present only for shared vertices |
+
+## 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]
+
+The positive X axis points right. The positive Y axis points down, and the positive Z axis points into the depth.[^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
+
+The OBJ TABLE holds pointers to the primitive groups of each object. One object is made of primitive groups.[^ff236]
+
+The table has the following fields:
+
+Table: OBJ TABLE fields
+
+| Field | Contents |
+| --- | --- |
+| NOBJ | Number of objects in the OBJ TABLE |
+| NPTR | Number of pointers in one object |
+| POINTER | Pointer to a primitive group |
+
+Each object has an NPTR field. Its pointers POINTER 0 to POINTER (nptr-1) follow.[^ff236]
+
+## PRIMITIVE Group
+
+A PRIMITIVE Gp is a group of graphics packets. One packet holds one primitive.[^ff236]
+
+PMD primitives differ from the drawing primitives of libgpu. libgs functions convert them to drawing primitives by perspective transformation.[^ff236]
+
+A primitive group opens with one word that holds TYPE and NPACKET.[^ff237]
+
+The word is as follows:
+
+Table: Packet Gp header
+
+| Bits | Field | Contents |
+| --- | --- | --- |
+| 0..15 | NPACKET | Number of packets |
+| 16..31 | TYPE | Packet type |
+
+The TYPE bits are as follows:[^ff237]
+
+Table: TYPE bit layout
+
+| Bit no. | When 0 | When 1 |
+| --- | --- | --- |
+| 16 | Triangle | Quadrilateral |
+| 17 | Flat | Gouraud |
+| 18 | Texture-On | Texture-Off |
+| 19 | Independent vertex | Shared vertex |
+| 20 | Light source calculation Off | Light source calculation On |
+| 21 | Back clip | No back clip |
+| 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]
+
+Each packet holds two drawing primitives for a double buffer. Both must be initialized in advance.[^ff237]
+
+## Packet Data
+
+Each TYPE value has its own packet structure:[^ff238][^ff239]
+
+Table: Packet data structures
+
+| TYPE | Primitive | Structure | Members |
+| --- | --- | --- | --- |
+| 00 | Triangle, flat, texture on, independent vertex | _poly_ft3 | POLY_FT3 pkt[2]; SVECTOR v1, v2, v3 |
+| 01 | Quadrangle, flat, texture on, independent vertex | _poly_ft4 | POLY_FT4 pkt[2]; SVECTOR v1, v2, v3, v4 |
+| 02 | Triangle, Gouraud, texture on, independent vertex | _poly_gt3 | POLY_GT3 pkt[2]; SVECTOR v1, v2, v3 |
+| 03 | Quadrangle, Gouraud, texture on, independent vertex | _poly_gt4 | POLY_GT4 pkt[2]; SVECTOR v1, v2, v3, v4 |
+| 04 | Triangle, flat, texture off, independent vertex | _poly_f3 | POLY_F3 pkt[2]; SVECTOR v1, v2, v3 |
+| 05 | Quadrangle, flat, texture off, independent vertex | _poly_f4 | POLY_F4 pkt[2]; SVECTOR v1, v2, v3, v4 |
+| 06 | Triangle, Gouraud, texture off, independent vertex | _poly_g3 | POLY_G3 pkt[2]; SVECTOR v1, v2, v3 |
+| 07 | Quadrangle, Gouraud, texture off, independent vertex | _poly_g4 | POLY_G4 pkt[2]; SVECTOR v1, v2, v3, v4 |
+| 08 | Triangle, flat, texture on, shared vertex | _poly_ft3c | POLY_FT3 pkt[2]; long vp1, vp2, vp3 |
+| 09 | Quadrangle, flat, texture on, shared vertex | _poly_ft4c | POLY_FT4 pkt[2]; long vp1, vp2, vp3, vp4 |
+| 0a | Triangle, Gouraud, texture on, shared vertex | _poly_gt3c | POLY_GT3 pkt[2]; long vp1, vp2, vp3 |
+| 0b | Quadrangle, Gouraud, texture on, shared vertex | _poly_gt4c | POLY_GT4 pkt[2]; long vp1, vp2, vp3, vp4 |
+| 0c | Triangle, flat, texture off, shared vertex | _poly_f3c | POLY_F3 pkt[2]; long vp1, vp2, vp3 |
+| 0d | Quadrangle, flat, texture off, shared vertex | _poly_f4c | POLY_F4 pkt[2]; long vp1, vp2, vp3, vp4 |
+| 0e | Triangle, Gouraud, texture off, shared vertex | _poly_g3c | POLY_G3 pkt[2]; long vp1, vp2, vp3 |
+| 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
+
+The VERTEX group is an array of SVECTOR structures for shared vertices.[^ff239]
+
+One structure is as follows:
+
+Table: VERTEX structure
+
+| Word | Upper 16 bits | Lower 16 bits |
+| --- | --- | --- |
+| 0 | VY | VX |
+| 1 | | VZ |
+
+VX, VY and VZ are the X, Y and Z coordinates of the vertex as 16-bit integers.[^ff239]
+
+## References
+
+[^ff235]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-35, Figure 77.
+[^ff236]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-36, Figure 78.
+[^ff237]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-37, Figure 79 and Table 2-2.
+[^ff238]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-38.
+[^ff239]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-39, Figure 80.