Changes between Version 5 and Version 6 of PMD_File_Format
- Timestamp:
- Jul 28, 2012, 8:49:57 AM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
PMD_File_Format
v5 v6 1 1 PMD files store a model, which includes vertex positions, normals and texture coordinates, faces (all faces are triangles), rest state bone transformations (if bones are used), and prop point positions and transformations (where other models may be propped onto this one). 2 2 3 The following is the version 3 PMD format.3 The following is the version 4 PMD format, which adds support for multiple UV sets per model (i.e. multiple texture coordinate pairs per vertex). 4 4 5 5 Basic types: … … 16 16 PMD { 17 17 char magic[4]; // == "PSMD" 18 u32 version; // == 318 u32 version; // == 4 19 19 u32 data_size; // == filesize-12 20 20 21 21 u32 numVertices; 22 u32 numTexCoords; // number of UV pairs per vertex 22 23 Vertex vertices[numVertices]; 23 24 … … 31 32 PropPoint propPoints[numPropPoints]; // note: PropPoint has variable size (see below) 32 33 } 33 34 34 35 Vertex { 35 36 Vector3D position; // in world space, matching the restStates pose 36 37 Vector3D normal; 38 TexCoord coords[numTextureCoords]; 39 VertexBlend blend; 40 } 41 42 TexCoord { 37 43 float u, v; 38 VertexBlend blend;39 44 } 40 45 … … 77 82 }}} 78 83 79 Some meshes also use PMD version 1. The only difference between this and version 2 is that no prop points are specified (there is no numPropPoints and no propPointsarray).84 Some meshes also use PMD version 1. The only difference between this and version 2 is that no prop points are specified (there is no `numPropPoints` and no `propPoints` array). 80 85 81 Some use PMD version 2. These store vertex positions/normals already transformed by the inverse of restStates. That can only work correctly when !VertexBlendhas only a single non-zero weight, so PMD version 3 stores vertices in world space instead.86 Some use PMD version 2. These store vertex positions/normals already transformed by the inverse of `restStates`. That can only work correctly when `VertexBlend` has only a single non-zero weight, so PMD version 3 stores vertices in world space instead. 82 87 83 88 The algorithm for calculating vertex data under a skeletal animation is: … … 95 100 norm = normalise(norm) 96 101 }}} 102 103 PMD version 3 supported only one UV pair per vertex, so there was no `numTexCoords`.