HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

MDX Format

06-15-2002, 08:35 AM#1
KMK
I've been taking a look at the MDX format with the help of YobGul's War3 File Converter. I've come up with a rough and rather ugly description of the format (see sig), however that does little to help understand it.

What I'm having trouble in understanding is the information in the KMTA, KGAO, KGTR, KGRT, KGSC, KATV, KEVT chunks.
In mdl files it shows things like 70533: 0. Any ideas what they might mean?

KMK
06-17-2002, 05:31 PM#2
BlacKDicK
This is VB, but it can help you:


Private Type TRIPLE_FLOAT
x As Single
y As Single
Z As Single
End Type

Private Type BOU_MIN_MAX
BoundsRadius As Single
MinimumExtent As TRIPLE_FLOAT
MaximumExtent As TRIPLE_FLOAT
End Type

Private Type MATS_CHUNK
GroupsCount As Long
Groups() As Long
MaterialID As Long
SelectionGroup As Long
Unknown1 As Long ' Seems to be 0
BoundsRadius As Single
MinimumExtent As TRIPLE_FLOAT
MaximumExtent As TRIPLE_FLOAT
Sub_Anims_Count As Long
Anims() As BOU_MIN_MAX
End Type
06-19-2002, 09:45 AM#3
KMK
The MDX data file has been updated. It should be fairly accurate and is much tidier, but there are still variables that I don't know anything about. The most puzzling being what the long / float pairs in the KMTA, KGAO, KGTR, KGRT, KGSC, KATV, KEVT chunks. In there lies the solutions for animation.
06-20-2002, 07:35 AM#4
KMK
Some things that I've learnt relating to animation.
KGAO shows the visibility of an object for the periods listed. It gives it for each sequence or if it's visible for most, those where it isn't.
The object id in bones, etc. is the group id for the vertices of it.
Have a look at track view (in 3ds max) to check out what hermite, etc. do.
All the K*** chunks work in a similar way to KGAO.

There might be a few mysteries left but this information should make animations exportable.

KMK
06-20-2002, 03:02 PM#5
StonedStoopid
Stickied... please use this thread for future discusion of the mdx format, having a perfect outline of it would be an awsome break through. Nice job so far guys.
06-26-2002, 08:27 PM#6
BlacKDicK
Private Type LAYS_SUBITEM
Size As Long
FilterMode As Long '01=transp, 03=aditive, 00 = none (is 2 blend??)
Flags As Long '1=unshaded,16=TwoSided,32=Unfogued
StaticTextureID As Long
Separator As Long 'Seems to be FF...
Unknown1 As Long 'Seems to be 0
Unknown2 As Long 'Seems to be 0000803F 'This 3 longs look like a ending tag, then the KMTA block starts...
End Type

Private Type MTLS_SUBITEM
MaterialSize As Long
Flag1 As Long
FLag2 As Long
Layers_Signature As Long ' "LAYS"
Layers_Count As Long
Layers As LAYS_SUBITEM
End Type

Private Type PTYP_CHUNK
Count As Long
PrimitivesTypes() As Long
End Type

Private Type PCNT_CHUNK
Count As Long
PrimitivesCount() As Long
End Type
06-27-2002, 09:22 AM#7
KMK
Quote:
(is 2 blend??)
Seems to be.
Quote:
Flags As Long '1=unshaded,16=TwoSided,32=Unfogged
Ok this is fairly correct. if it's unshaded then it equals 1, else it equals zero. If it is two sided then 16 (0x10) is added to that result or if it's unfogged, 32 (0x20). The possible results are:
0x00000000: no flags
0x01000000: unshaded
0x10000000: twosided
0x11000000: unshaded and twosided
0x20000000: unfogged
0x21000000: unshaded and unfogged

The seperator seems to be just that, they are included throughout the mdx format.
Quote:
Unknown2 As Long 'Seems to be 0000803F '
Unknown2 is actually a float Alpha. It is the visibility of the layer.

PTYP and PCNT chunks
Are the "Count As Long"s the number of longs following? And what is "PrimitivesTypes() As Long". The PrimitivesCount() is 3 times the number of faces, or each vertex counted for everytime they're used in a face.
06-27-2002, 04:57 PM#8
BlacKDicK
I got this from DarkYoda's mdx:

case 'PCNT': // primitives count
{
p.dw++;
int size = *p.dw++;
mPolyCount = (*p.dw)/3;

p.c += size*4;
++n;
}
break;

case 'PVTX': // primitives vertices
{
p.dw++;
int size = *p.dw++;
mTriangles = p.tri;

if(size/3 != mPolyCount)
{
printf("Polycount and size of triangle block do not match!!!!!!!!!!!\n");
return;
}

p.c += size*2;
++n;
}
break;

I suck in C. Maybe you can guess what is that for.
06-27-2002, 06:10 PM#9
DJBnJack
type PCNT
-Size as long
-Unknown() as long
end type

Then the unknown should be redimmed to Unknown(1 to Size/4)
And in this example Size/4 is the primitivecount


Now this is from the top of my head (was a while ago)...

Greetz,
DJBnJack
06-28-2002, 06:43 AM#10
KMK
From Dark Yoda's source it seems that in PTYP 'PrimitivesTypes() As Long' is 4 if the primitives are triangles, and there is a problem if they are anything but triangles.

PCNT:
long: number of longs following (always 1)
long: number of triangle (primitive) corners

PVTX:
long: number of triangle (primitive) corners
foreach triangle (primitive)
{
long: vertex 1
long: vertex 2
long: vertex 3
}

number of triangle (primitive) corners is the number of longs used for vertices, so 3 times the number of triangles.
07-09-2002, 05:30 AM#11
Guest
OT, but here goes:

How are you guys interpreting this stuff? Where are you getting all of these variables? I'm a "programmer in training", so to speak, and would like to get involved with things like this. Are you using a hex editor to read all of this out of a .mdx and somehow interpreting into a readable format?
07-09-2002, 06:03 AM#12
KMK
Hex Editor and YobGul's MDX -> MDL Converter (MDL is a readable (ascii) version of the model). By comparing the data you can interpret a lot. That's basically all you need.
07-14-2002, 05:20 AM#13
Guest
I can't get the mdx > 3ds to work as it always crashes the moment I click on the 'mdx to 3ds' button. So what dir do I put the 3ds file to import stuff?
07-14-2002, 06:30 AM#14
KMK
The mdx -> 3ds converter doesn't convert back. Considering the fact that the 3ds format doesn't support all that the mdx format does it most likely won't be updated. The maxscript importer does a better job already.
07-14-2002, 03:32 PM#15
Guest
Quote:
Originally posted by KMK
The mdx -> 3ds converter doesn't convert back. Considering the fact that the 3ds format doesn't support all that the mdx format does it most likely won't be updated. The maxscript importer does a better job already.

the mdx importer doesnt impoer the arch mage.