psx.wiki

PMD (High-Speed Modeling Data)

Modeling data for libgs that holds ready drawing packets for fast processing.

PMD (High-Speed Modeling Data)
Extension.PMD
ID0x00000042

This is an old revision of this page, as edited by RemmyLee at 02:27, 23 October 2026. Edit this revision | Latest revision

Overview

The PMD format holds modeling data for the extended graphics library (libgs).1

PMD has fewer functions than TMD. The smaller scope allows faster processing.1

PMD handles the following kinds of objects:1

File Structure

A PMD file holds a table of 3D objects with their PRIMITIVE and VERTEX data.1

The file has the following fields:

Table 1: 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.2

The positive X axis points right. The positive Y axis points down, and the positive Z axis points into the depth.2

Conversion from RSD to PMD scales the floating point vertex values as needed. The current version of libgs ignores the scale value.2

OBJ TABLE

The OBJ TABLE holds pointers to the primitive groups of each object. One object is made of primitive groups.2

The table has the following fields:

Table 2: 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.2

PRIMITIVE Group

A PRIMITIVE Gp is a group of graphics packets. One packet holds one primitive.2

PMD primitives differ from the drawing primitives of libgpu. libgs functions convert them to drawing primitives by perspective transformation.2

A primitive group opens with one word that holds TYPE and NPACKET.3

The word is as follows:

Table 3: Packet Gp header
Bits Field Contents
0..15 NPACKET Number of packets
16..31 TYPE Packet type

The TYPE bits are as follows:3

Table 4: 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.3

Each packet holds two drawing primitives for a double buffer. Both must be initialized in advance.3

Packet Data

Each TYPE value has its own packet structure:45

Table 5: 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.5

vp1 to vp4 are offsets from the start of the row of shared vertices.5

VERTEX

The VERTEX group is an array of SVECTOR structures for shared vertices.5

One structure is as follows:

Table 6: 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.5

References


  1. ^ a b c d Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-35, Figure 77.

  2. ^ a b c d e f g Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-36, Figure 78.

  3. ^ a b c d Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-37, Figure 79 and Table 2-2.

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

  5. ^ a b c d e Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-39, Figure 80.

Categories: File formats