Someone offered help and asked me to share how I ripped this game's models so I decided to open this thread for those interested. I kind of quit trying to figure out so perhaps more people can continue with this.
It's a mobile game and downloads lots of files. There are many different formats but the ones for units are of "dat" extension and go like "unit_mdl_archangel.dat". In this game most monsters have "awakened" form and their name has "_hr" in it like "unit_mdl_archangel_hr.dat". Buildings/stages seem to be using a different format.
There were a few exceptions like "special_mdl_irene.dat" which have slight differences but generally the format goes like the following. (It's been a while since I worked on these so I may remember a few things wrong.) The formats are in LITTLE_ENDIAN.
Let's say the file consists of chunks, each chunk has 4 byte integer size value, then this size amount of bytes.
Now I'll explain what I managed to figure out so far regarding these chunks.
I just skip the header chunk.
PMM Chunk:
I can't share my export codes since they are in Flash AS3 and not in a ready-to-use-by-anyone state but I believe some people here can write scripts for common programs that are usually used around here.
Updated Info: Some models have an encrypted PMM chunk. Basically you need the array below. Simply read each byte and use it as an indice for this array to get the actual value. For example, the first 4 bytes of encrypted PMM chunks are 0xa68a8ac8 hexadecimal values. Get the values in the array from indices a6, 8a and c8. We end up with 0x504d4d24 which are the ascii codes for "PMM$" string as in regular files.
Here's an example file for those who don't have the game or don't want to bother getting, which should produce this model:
http://www.models-resource.com/mobile/su...odel/9565/
unit_mdl_ninja.zip (Size: 510.49 KB / Downloads: 651)
It's a mobile game and downloads lots of files. There are many different formats but the ones for units are of "dat" extension and go like "unit_mdl_archangel.dat". In this game most monsters have "awakened" form and their name has "_hr" in it like "unit_mdl_archangel_hr.dat". Buildings/stages seem to be using a different format.
There were a few exceptions like "special_mdl_irene.dat" which have slight differences but generally the format goes like the following. (It's been a while since I worked on these so I may remember a few things wrong.) The formats are in LITTLE_ENDIAN.
Let's say the file consists of chunks, each chunk has 4 byte integer size value, then this size amount of bytes.
- First chunk is a short unknown chunk, probably some kind of header.
- PMM chunk which contains vertices, indices, normals, uvs and weights data. Weights seem to be 1 joint assignment per vertex.
- PLM chunk which contains bones and animation data I think, this needs figuring out the most.
- Textures chunk which contains PNG images for different elements. (Monsters come in various elements in the game.) Each element seems to be using a single texture for the entire model, 3D geometry is common for each element. This chunk seems to lack chunk_size value. Read below.
Now I'll explain what I managed to figure out so far regarding these chunks.
I just skip the header chunk.
PMM Chunk:
- 4 bytes String "PMM$"
- 2 bytes Unknown
- 2 bytes indice_count
- 2 bytes vertex_count
- 4 bytes unknown
- 2 bytes scale_divider
- 55 bytes unknown
- vertex_count * 12 bytes > x,y,z values each 4 bytes signed integer. Divide each by scale_divider.
- vertex_count * 3 bytes > normal values each 1 signed byte. Divide each by 127.
- vertex_count * 8 bytes > u,v values each 4 bytes signed integer. Divide each by 65536.
- indice_count * 2 bytes > indice values that 3 of them make 1 face. Short value, probably unsigned .
- vertex_count * 1 bytes > ID of the assigned joint of each vertex in order. Byte value, probably unsigned.
- 4 bytes String "PLM$"
- 2 bytes > unknown_size_A
- 20 bytes > some unknown value
- unknown_size_A * 7 bytes > more unknown data
- 1 byte joint_count, probably unsigned
- 32 bytes unknown, might be armature/skeleton's values
- joint_count * 39 bytes > So each joint has 39 bytes of data which I couldn't properly figure out. First byte is usually 0xff, second is ID (same in weights data above), third is parent joint ID. Seems to be right but can't be sure.
Updated Info: If we count from 0, the bytes 7-14 of these 39 bytes are Quaternion values. Read 4 signed integer values (2 bytes each) and divide by 32767. These make up the x,y,z,w components of a quaternion. Then the next 12 bytes are x,y,z location values of the bone. Similar to vertex position data, each is 4 bytes signed integer and should be divided by scale_divider. Then the bones should be normalised.
- The rest is probably animation data, length can be calculated using chunk_size value. The last 4 bytes seem to be always "****" string.
- 4 bytes > element ID probably, you can see from 1 to 6
- 4 bytes texture_size > if 0, no texture
- texture_size * bytes > PNG data, simply export into PNG files
I can't share my export codes since they are in Flash AS3 and not in a ready-to-use-by-anyone state but I believe some people here can write scripts for common programs that are usually used around here.
Updated Info: Some models have an encrypted PMM chunk. Basically you need the array below. Simply read each byte and use it as an indice for this array to get the actual value. For example, the first 4 bytes of encrypted PMM chunks are 0xa68a8ac8 hexadecimal values. Get the values in the array from indices a6, 8a and c8. We end up with 0x504d4d24 which are the ascii codes for "PMM$" string as in regular files.
Quote:var encrypt_array = [
0x2f,0x7c,0x47,0x55,0x32,0x77,0x9f,0xfb,0x5b,0x86,0xfe,0xb6,0x3e,0x06,0xf4,0xc4,
0x2e,0x08,0x49,0x11,0x0e,0xce,0x84,0xd3,0x7b,0x18,0xa6,0x5c,0x71,0x56,0xe2,0x3b,
0xfd,0xb3,0x2b,0x97,0x9d,0xfc,0xca,0xba,0x8e,0x7e,0x6f,0x0f,0xe8,0xbb,0xc7,0xc2,
0xd9,0xa4,0xd2,0xe0,0xa5,0x95,0xee,0xab,0xf3,0xe4,0xcb,0x63,0x25,0x70,0x4e,0x8d,
0x21,0x37,0x9a,0xb0,0xbc,0xc6,0x48,0x3f,0x23,0x80,0x20,0x01,0xd7,0xf9,0x5e,0xec,
0x16,0xd6,0xd4,0x1f,0x51,0x42,0x6c,0x10,0x14,0xb7,0xcc,0x82,0x7f,0x13,0x02,0x00,
0x72,0xed,0x90,0x57,0xc1,0x2c,0x5d,0x28,0x81,0x1d,0x38,0x1a,0xac,0xad,0x35,0x78,
0xdc,0x68,0xb9,0x8b,0x6a,0xe1,0xc3,0xe3,0xdb,0x6d,0x04,0x27,0x9c,0x64,0x5a,0x8f,
0x83,0x0c,0xd8,0xa8,0x1c,0x89,0xd5,0x43,0x74,0x73,0x4d,0xae,0xea,0x31,0x6e,0x1e,
0x91,0x1b,0x59,0xc9,0xbd,0xf7,0x07,0xe7,0x8a,0x05,0x8c,0x4c,0xbe,0xc5,0xdf,0xe5,
0xf5,0x2d,0x4b,0x76,0x66,0xf2,0x50,0xd0,0xb4,0x85,0xef,0xb5,0x3c,0x7d,0x3d,0xe6,
0x9b,0x03,0x0d,0x61,0x33,0xf1,0x92,0x53,0xff,0x96,0x09,0x67,0x69,0x44,0xa3,0x4a,
0xaf,0x41,0xda,0x54,0x46,0xd1,0xfa,0xcd,0x24,0xaa,0x88,0xa7,0x19,0xde,0x40,0xeb,
0x94,0x5f,0x45,0x65,0xf0,0xb8,0x34,0xdd,0x0b,0xb1,0x29,0xe9,0x2a,0x75,0x87,0x39,
0xcf,0x79,0x93,0xa1,0xb2,0x30,0x15,0x7a,0x52,0x12,0x62,0x36,0xbf,0x22,0x4f,0xc0,
0xa2,0x17,0xc8,0x99,0x3a,0x60,0xa9,0xa0,0x58,0xf6,0x0a,0x9e,0xf8,0x6b,0x26,0x98
];
Here's an example file for those who don't have the game or don't want to bother getting, which should produce this model:
http://www.models-resource.com/mobile/su...odel/9565/
unit_mdl_ninja.zip (Size: 510.49 KB / Downloads: 651)