Changes between Version 5 and Version 6 of PMD_File_Format


Ignore:
Timestamp:
Jul 28, 2012, 8:49:57 AM (12 years ago)
Author:
historic_bruno
Comment:

Updated for version 4, multiple UV sets

Legend:

Unmodified
Added
Removed
Modified
  • PMD_File_Format

    v5 v6  
    11PMD 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).
    22
    3 The following is the version 3 PMD format.
     3The following is the version 4 PMD format, which adds support for multiple UV sets per model (i.e. multiple texture coordinate pairs per vertex).
    44
    55Basic types:
     
    1616 PMD {
    1717    char magic[4];  // == "PSMD"
    18     u32 version;  // == 3
     18    u32 version;  // == 4
    1919    u32 data_size;  // == filesize-12
    2020 
    2121    u32 numVertices;
     22    u32 numTexCoords;  // number of UV pairs per vertex
    2223    Vertex vertices[numVertices];
    2324 
     
    3132    PropPoint propPoints[numPropPoints];  // note: PropPoint has variable size (see below)
    3233 }
    33  
     34
    3435 Vertex {
    3536    Vector3D position;  // in world space, matching the restStates pose
    3637    Vector3D normal;
     38    TexCoord coords[numTextureCoords];
     39    VertexBlend blend;
     40 }
     41
     42 TexCoord {
    3743    float u, v;
    38     VertexBlend blend;
    3944 }
    4045 
     
    7782}}}
    7883
    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 propPoints array).
     84Some 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).
    8085
    81 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.
     86Some 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.
    8287
    8388The algorithm for calculating vertex data under a skeletal animation is:
     
    95100 norm = normalise(norm)
    96101}}}
     102
     103PMD version 3 supported only one UV pair per vertex, so there was no `numTexCoords`.