- Current version is
0.0
- File extension is
.p3m
- Data is little endian
Type | Description |
---|
"Header" | File header |
"Data" | Model data |
Type | Value | Description |
---|
char[3] | {'P', '3', 'M'} | Header magic |
u8 | 0 | Major version |
u8 | Header flags | Flags |
Bit (Listed from LSB to MSB) | Value | Description |
---|
1-8 | 0 | Reserved |
Data
Type | Value | Description |
---|
u8 | – | Part count |
u8[0..32] | – | Part visibility bitmask (Bytes ordered from least to most significant) |
"Part"[0...] | – | Parts |
u8 | – | Material count |
"Material"[0...] | – | Materials |
u8 | – | Texture count |
"Texture"[0...] | – | Textures |
u8 | – | Bone count |
"Bone"[0...] | – | Bones |
u8 | – | Animation count |
"Animation"[0...] | – | Animations |
u8 | – | Action count |
"Action"[0...] | – | Actions |
char[1...] | {..., 0} | String table |
Part
Type | Value | Description |
---|
u8 | Part flags | Flags |
"String" | – | Part name |
u8 | – | Material index |
u16 | – | Vertex count |
"Vertex"[0...] | – | Vertices |
"Normal"[0...] | – | Normals (only present if “Has normals” flag is set) |
u16 | – | Index count |
u16[0...] | – | Indices |
u8 | – | Weight group count |
"Weight group"[0...] | – | Weight groups |
Part flags
Bit (Listed from LSB to MSB) | Value | Description |
---|
1 | – | Has normals |
2-8 | 0 | Reserved |
Vertex
Type | Description |
---|
float[3] | XYZ |
float[2] | UV |
Normal
Type | Description |
---|
float[3] | XYZ |
Weight group
Weight range
Type | Description |
---|
u16 | Vertices to skip |
u16 | Weight count (0 if last range) |
u8[0...] | Weights |
Note: Weights in Blender are stored as floats from 0.0 to 1.0. The P3M exporter multiplies each weight by 256 and rounds it. Weights with a value of 0 are omitted and the remaining non-zero weights are decremented by 1. To read in weights, add 1, then divide by 256.0.
Material
Type | Value | Description |
---|
u8 | Material render mode | Render mode |
u8 | – | Texture index (255 for none) |
u8[4] | – | RGBA color |
u8[3] | – | RGB emission |
u8 | – | Shading |
Note: The ‘shading’ value determines how directional light is. The lower the value, the more light is evenly distributed.
Material render mode
Name | Value |
---|
P3M_MATRENDMODE_NORMAL | 0 |
P3M_MATRENDMODE_ADD | 1 |
Texture
Texture type
Name | Value |
---|
P3M_TEXTYPE_EMBEDDED | 0 |
P3M_TEXTYPE_EXTERNAL | 1 |
Embedded texture
Type | Value | Description |
---|
u32 | – | Data size |
u8[...] | PTF texture | Data |
External texture
Type | Description |
---|
"String" | Resource path |
Bone
Type | Description |
---|
"String" | Name |
float[3] | Head XYZ |
float[3] | Tail XYZ |
u8 | Child count |
Animation
Animation action
Type | Description |
---|
u8 | Action index |
float | Speed multiplier |
u16 | Start frame |
u16 | End frame |
Action
Action part list mode
Name | Value |
---|
P3M_ACTPARTLISTMODE_DEFAULTWHITE | 0 |
P3M_ACTPARTLISTMODE_DEFAULTBLACK | 1 |
P3M_ACTPARTLISTMODE_WHITE | 2 |
P3M_ACTPARTLISTMODE_BLACK | 3 |
Note: The modes with “DEFAULT” in the name use the part visibility mask instead of starting with all or none.
Action data
Type | Value | Description |
---|
"String" | – | Bone |
u8 | – | Translation keyframe count |
u8 | – | Rotation keyframe count |
u8 | – | Scale keyframe count |
u8[0...] | – | Translation keyframe frame skips |
u8[0...] | – | Rotation keyframe frame skips |
u8[0...] | – | Scale keyframe frame skips |
u8[0...] | Action interpolation mode | Translation keyframe interpolation modes |
u8[0...] | Action interpolation mode | Rotation keyframe interpolation modes |
u8[0...] | Action interpolation mode | Scale keyframe interpolation modes |
float[0...][3] | – | Translation keyframes |
float[0...][3] | – | Rotation keyframes |
float[0...][3] | – | Scale keyframes |
Note: In Blender, a keyframe’s interpolation type is used to transition from that keyframe to the next. In P3M, a keyframe’s interpolation mode is used to transition from the previous keyframe to that keyframe. The P3M exporter will start with the interpolation mode from the last keyframe before the start of the action. If there are no keyframes before the start of the action, the exporter will start with ‘LINEAR’.
Action interpolation mode
Name | Value |
---|
P3M_ACTINTERP_NONE | 0 |
P3M_ACTINTERP_LINEAR | 1 |
String
Type | Description |
---|
u16 | Offset in string table |