HMD (Hierarchical 3D Model and Animation Data)
Integrated format for model and image and animation data.
| Extension | .HMD |
|---|---|
| Version ID | 0x00000050 |
| Library | libhmd |
This is an old revision of this page, as edited by RemmyLee at 02:27, 23 October 2026. Edit this revision | Latest revision
Overview
HMD is a generic graphics format. Model data, texture data and animation data are handled within one framework.1
HMD is extended to new kinds of data through a unique identification code called a type.1
A program that plays back HMD data is called a primitive driver. Primitive drivers are linked to HMD data through their type.1
Sony Computer Entertainment made a set of standard primitive drivers for libgs. The drivers have standard interfaces, so users and middleware companies can write their own.1
The HMD format is supported by Library Version 4.0 and later.1
Up to library 4.2 the HMD functions were part of libgs and libgte. They are now in the separate library libhmd. Its header file is libhmd.h.1
The environment map was a beta version in this release. Its format could change.1
Structure
HMD data has two main parts:1
- The HMD header
- The HMD body
The HMD body is made of sections. The primitive section and the primitive header section are always required.1
Other sections are present only when the type needs them. A model can also have a coordinate section.12
Pointers
Pointer values are converted into real memory addresses at run time. This step is called mapping, and GsMapUnit() performs it.2
HMD data can be used only after its addresses are mapped.2
The initial value of a pointer is a count of 32-bit words from the top of the HMD data.2
HMD Header
The HMD header holds the following fields:23
| Field | Contents |
|---|---|
| Version ID | 0x00000050 |
| MAP FLAG | 1 after GsMapUnit() has mapped the data, otherwise 0 |
| Primitive header section pointer | Start of the primitive header section |
| Number of blocks | Number of primitive block pointers |
| Pointer to the primitive block 0..n | One pointer for each primitive block |
GsMapUnit() reads and changes MAP FLAG.3
Primitives
The primitive section is a collection of primitive blocks.3
A primitive block is a chain of one or more primitives. Pointers join the primitives of the chain.3
A primitive has a control section and one or more data sections.3
The parts are as follows:
| Part | Field | Contents |
|---|---|---|
| Control section | Next Prim pointer | Header of the next primitive in the chain. 0xFFFFFFFF ends the chain. |
| Control section | Primitive header pointer | The primitive header of this primitive |
| Control section | Type count | Number of data sections. The MSB is 1 while the pointers are unmapped and 0 after mapping. |
| Data section | type | Identifier of the data |
| Data section | Data count / size | Upper 16 bits: number of data sets. Lower 16 bits: size of one data section in words. |
| Data section | Data | The data, in a format set by type |
SCAN
A SCAN overwrites each type field with the start address of its primitive driver.4
GsScanUnit() finds the address and value of the type field of each primitive. The driver address can then be written into the type field.4
Changing the value of type changes the meaning of the data and its driver.4
Primitive Header
The primitive headers are grouped in the primitive header section. The HMD header points to that section.4
There is one primitive header for each primitive block. Its first word is its size in words, and pointers to the sections follow.4
A word with the MSB set is a pointer to a section.4
A word with the MSB clear is a numeric value. It can serve as a parameter to the primitive driver.4
Type Field
The type field is 32 bits in four parts:56
| Bits | Field | Contents |
|---|---|---|
| 28..31 | DEVELOPER ID | ID of the developer of the format. 0x0 is SCE, 0xf is user defined. |
| 24..27 | CATEGORY | Category of the data |
| 16..23 | DRIVER | Bits that change the behavior of the primitive driver |
| 0..15 | PRIMITIVE TYPE | Bit assignment depends on the primitive type |
A developer with a unique ID can use the other bits freely.5
The categories are as follows:576
| Category | Data |
|---|---|
| 0 | Polygon data |
| 1 | Shared polygon data |
| 2 | Image data |
| 3 | Animation data |
| 4 | MIMe data |
| 5 | Ground data |
| 6 | Pseudo-environment map (beta, library 4.2) |
| 7 | Device primitives (camera and light) |
The manual gives the type 0x00100008 as an example. It is developer SCE, category CTG_POLY, driver bit BOT (double-sided) and primitive type TRI (triangle).6
The name of the driver function is "GsU_" followed by the bit pattern.6
Categories
Model Data (Category 0)
Model data must have the HMD header, primitive header, coordinate, primitive, polygon and vertex sections. It can also have normal and image sections.8
Each coordinate system of a model is assigned to its own primitive block.8
The DIV bit of the polygon driver enables polygon subdivision. The FOG bit turns fog on.9
Shared Primitives (Category 1)
Shared primitives use two kinds of driver: PRE-CALCULATION drivers and shared drivers.10
A PRE-CALCULATION driver converts a 3D shared vertex array into a perspective-transformed 2D vertex array. For normals it calculates vertex colors.10
A shared driver takes the calculated vertices and builds GPU packets into the OT. It is chained to the POST-PROCESS primitive block so that it runs last.10
Image Data (Category 2)
HMD can hold image data as a primitive. Model, image and animation data can then be managed together.11
Image data can also stay outside HMD in TIM files.12
Animation Data (Category 3)
An animation primitive section has five subsections:13
- Animation primitive header section
- Sequence pointer section
- Interpolation function table section
- Sequence control section
- Parameter section
MIMe Data (Category 4)
The MIMe primitive is described in the libgs reference. The MIMe types are joint MIMe and vertex or normal MIMe. Each type also has a reset form.14
Ground Data (Category 5)
A ground primitive generates packets at run time from the width and height of a grid and the number of grids.15
This method reduces the amount of HMD data.15
Device Primitives (Category 7)
Device primitives hold camera (viewpoint) and light (light source) settings that applications used to make in code.7
Camera primitives set the projection and the camera position and direction.7
References
-
^ a b c d e f g h i j Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-49.
-
^ a b c d e Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-50, Figures 98 and 99.
-
^ a b c d e Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-51, Figures 100 and 101.
-
^ a b c d e f g Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-52, Figure 102.
-
^ a b c Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-60, Figure 107.
-
^ a b c d Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-131.
-
^ a b c Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-128.
-
^ a b Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-53.
-
^ Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-61, Figure 108.
-
^ a b c Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-90.
-
^ Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-92.
-
^ Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-93.
-
^ Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-95.
-
^ Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-118.
-
^ a b Sony Computer Entertainment Inc. File Formats. November 1998. Page 2-125.