Soldak Entertainment Forums

Soldak Entertainment Forums (
-   Din's Curse modding (
-   -   Model File formats (

Bluddy 05-21-2012 05:24 PM

Model File formats
Hey Shadow

I'd like to possibly mod the models, and to convert them to Blender format.

I've figured out some of the model file format:
1. Header
2. An unknown section (possibly bones but haven't encountered a full section yet)
3. Polygon section
4. Info about points: u,v coords and normal
5. Points
6. Unknown optional section. 32 bits per point.

Could you fill in the missing gaps? Once I figure this section out I'll also check out the animation file format, so if you could provide the specs there it'd make things easier :)

Bluddy 05-22-2012 03:13 PM

OK I figured out all the formats except for the unknown 2nd section in the model file and the optional last section in the same file.

Shadow 05-22-2012 06:05 PM

Which file type are you looking at (skl, mda, mds, mdm)?

Bluddy 05-22-2012 06:28 PM

I got how the mda and mds files work, so my questions are about the mdm file.

1. Looking at the mdm files, the first section after the header does nothing in files for objects (even ones with skeletons) but does have a little bit of content in files for more complex things like monsters. This is the section before the polygons are laid out, and I can't figure out what it does. It seems to have some offsets and some other numbers.

2. Then, the mdm file has another optional section that's only available for complex objects. This section appears in the end, and there's a uint32 number for every vertex in the object. Not sure what this does either.

Those are the main things I couldn't get, but there are 2 more minor things:

3. The section that I believe has U,V and normal values per vertex has the format (I think) {float u; float v; float norm_x; float norm_y; float norm_z; uint32 number; uint32 count} where number is usually 1, 2 or 3, and count is a count of vertices that skips number from the last count. Not sure what the number and the count are for.

4. The vertex section has the format {uint32 surface; float x; float y; float z; float unknown;} and I'm not sure what unknown does. I think it's the vertex magnitude with respect to the surface but I'm not sure.

Shadow 05-23-2012 09:42 AM

The mdm format is below but it is probably easier to write out to our skl format and then use our skelConvert tool in the SDK. Skelout is a relatively simple text format.

Mdm format:

int32 identifier
int32 version;
int32 numSurfaces
int32 numTris
int32 numVerts
int32 surfacesOffset
int32 trisOffset
int32 vertsOffset
int32 weightsOffset
int32 collapseMappingsOffset

For all of the surfaces:

int32 surfaceNumber
int32 numVerts
int32 numTris
int32 vertsOffset
int32 trisOffset
int32 collapseMappingsOffset

For all of the tris:

int32 vertIndexes[ 3 ]

For all of the verts:

float32 u
float32 v
Vector3 normal
int32 numBones
int32 firstBone

For all of the vert/bone info

int32 boneIndex
Vector3 vertOffset
float32 boneWeight

Collapse mappings for each surface (these are the order to lose verts in the poly reduction stuff)

int32 vertIndex

Bluddy 05-23-2012 09:10 PM

Awesome -- thanks, it filled in the gaps I had.

Bluddy 05-24-2012 11:01 AM

BTW for poly reduction -- is that based on the 'low model' setting?

Shadow 05-24-2012 11:26 AM


Originally Posted by Bluddy (Post 30600)
BTW for poly reduction -- is that based on the 'low model' setting?

Yes. You can probably give a 0 as the offset and ignore the entire section though.

Bluddy 05-02-2019 02:55 PM

Looks like the vert section specified above has a new vector and a new float?

(For DL, btw)

Shadow 05-02-2019 05:00 PM

Yeah, for Zombasite and Din's Legacy the vert info looks like this:

float32 u
float32 v
Vector3 normal
Vector4 tangent
int32 numBones
int32 firstBone

All times are GMT -4. The time now is 01:56 AM.

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright 2007 - 2019 Soldak Entertainment, Inc.