A .MDL exporter

#1
Here (attached) is a new tool for working with .MDL files. It's called x2mdl basically in the spirit of the x2mdo tool that From' released. X2mdo converts .x files to .mdo files from what I understand, and that's what x2mdl does. However you can also try other types of files in place of .x. If that format includes all the features a MDL file requires and is supported by the Assimp library it will also work. If it doesn't include all of the features it will still probably net you a static graphic but might not be useful for animation etc.

As is I think you could get started making new doors and treasure chests etc, and even NPCs and monsters. However Som has two different kinds of animations, and only one kind is supported right now. With the supported kind you can make wooden puppets basically, like most of Som's NPCs but not make one piece rag doll puppets, slugs etc. The animation method you choose must also reflect that or the Assimp library will interpret the animations as the wrong kind and they won't be exportable (yet)

In this release textures will be converted to 16bit and be down sampled to 256x256 if necessary. Afaik as far as we know this is as good as any existing .MDL files, but it may be the format can do better. Just need to setup some experiments.

X2mdl only facilitates .mdl files... you will have to figure out the .prf files and others for yourselves. In some cases you can just overwrite the string of characters in the .prf file that stores the name of the mdo/mdl file. Edited: also I still have to develop another app for generating .cp files (more about that later...)

When you name your animations there are 3 ways x2mdl will recognize them. If the last letter is a closing parenthesis, x2mdl will look backwards for the first opening parenthesis, and if that is followed by the # character, the next characters must be the number, eg. Walking (#1) ...otherwise, the first character must be a number, eg. 1 ...otherwise the actual order of the animations will be used, so first animation is 0, the next is 1, and the next is 2, and so on. If your file format of choice does not let you name animations in any way, you will have to somehow make dummy animations to fill in the animation IDs you don't want/need.

Below is a list of animation IDs used by Som:

if(id<2)
{
switch(id)
{
case 0: set = "Idle (default)"; break;
case 1: set = "Walking (#1)"; break;
}
}
else if(anims<5) //! guessing object
{
switch(id)
{
case 4: set = "Opening (#4)"; break;
case 5: set = "Closing (#5)"; break;
}
}
else if(anims<12) //! guessing enemy
{
switch(id)
{
case 4: ‎ set = "Dying (#4)"; ‎  ‎  ‎ break;
case 6: ‎ set = "Evading (#6)"; ‎  ‎ break;
case 9: ‎ set = "Trigger (#9)"; ‎  ‎ break;
case 10: set = "Attack A (#10)"; ‎ break;
case 11: set = "Attack B (#11)"; ‎ break;
case 12: set = "Attack C (#12)"; ‎ break;
case 13: set = "Attack D (#13)"; ‎ break;
case 14: set = "Attack E (#14)"; ‎ break;
case 15: set = "Attack F (#15)"; ‎ break;
case 16: set = "Defending (#16)"; break;
case 20: set = "Hitting (#20)"; ‎  break;
}
}
else switch(id) //! guessing npc
{
case 2: ‎ set = "Hitting (#2)"; ‎  ‎  ‎  ‎  ‎ break;
case 3: ‎ set = "Dying (#3)"; ‎  ‎  ‎  ‎  ‎  ‎ break;
case 4: ‎ set = "To Left (#4)"; ‎  ‎  ‎  ‎  ‎ break;
case 5: ‎ set = "To Right (#5)"; ‎  ‎  ‎  ‎  break;
case 6: ‎ set = "To Face (#6)"; ‎  ‎  ‎  ‎  ‎ break;
case 16: set = "Seated (#16)"; ‎  ‎  ‎  ‎  ‎ break;
case 17: set = "Standing (#17)"; ‎  ‎  ‎  ‎ break;
case 18: set = "Hitting Seated (#18)"; ‎ break;
case 19: set = "Dying Seated (#19)"; ‎  ‎ break;
case 20: set = "To Left Seated (#20)"; ‎ break;
case 21: set = "To Right Seated (#21)"; break;
case 22: set = "To Face Seated (#22)"; ‎ break;
}

If you want to replace the arm, animation IDs 0, 1, and 2 are used for each swing animation, not sure which is which.

Control points are supported by x2mdl, but x2mdl won't generate the .cp file. In order to create a control point your format needs to support per vertex or per triangle colours. Setting the material won't do. Any triangle that is the same colour on all vertices and that colour is not pure white will be treated as a control point. I'm assuming pure white means the equivalent of no coloration... if that is not so for your format I will add an option to specify what is the neutral colour.

If your model has no control points, and you're impatient, then you can probably get it in game by using the wooden treasure chest's .cp file.

Beyond the scope of the .mdl file I don't really understand control points myself at this point. I'm assuming they are referenced by number in the .prf file. For example a control point at the tip of a sword damages the player when it touches the player during an attack and might be the point where a magic spell originates for example.

The way the program works is very simple at this point. And there are few frills in the case that something goes wrong. Just drop a file on top of it, and if it works it will make a file of the same name with .mdl appended to the end. Alternatively you can evoke the program via a command prompt and pass along the name of the input file as the only argument.

It's a standalone application, but requires Direct3D 9 and the D3DX9 libraries to be installed on the system. The kinds of external images supported are currently limited to the ones supported by the D3DX9 interfaces (.bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga)


Attached Files
.exe   x2mdl.exe (Size: 1.84 MB / Downloads: 181)
.zip   Somimp_view.zip (Size: 976.51 KB / Downloads: 160)
.exe   cpgen.exe (Size: 164 KB / Downloads: 179)
Reply



Messages In This Thread
A .MDL exporter - by HolyDiver - 2010-08-30, 12:08 AM
Re: A .MDL exporter - by HolyDiver - 2010-08-30, 06:19 AM
Re: A .MDL exporter - by Verdite - 2010-08-30, 10:20 AM
Re: A .MDL exporter - by HolyDiver - 2010-08-30, 09:30 PM
Re: A .MDL exporter - by HolyDiver - 2010-08-31, 03:14 AM
Re: A .MDL exporter - by HolyDiver - 2010-09-04, 09:20 AM
Re: A .MDL exporter - by HolyDiver - 2010-09-05, 12:13 PM
Re: A .MDL exporter - by Verdite - 2010-09-05, 12:25 PM
Re: A .MDL exporter - by Verdite - 2010-09-07, 07:44 PM
Re: A .MDL exporter - by HolyDiver - 2010-09-08, 02:59 AM
Re: A .MDL exporter - by HolyDiver - 2010-09-08, 03:15 AM
Re: A .MDL exporter - by Verdite - 2010-09-08, 11:01 PM
Re: A .MDL exporter - by HolyDiver - 2010-09-09, 02:55 AM
Re: A .MDL exporter - by HolyDiver - 2010-09-13, 04:48 AM
Re: A .MDL exporter - by Verdite - 2010-09-15, 12:47 AM
Re: A .MDL exporter - by HolyDiver - 2010-09-15, 07:57 AM
Re: A .MDL exporter - by Verdite - 2010-09-15, 12:13 PM
Re: A .MDL exporter - by HolyDiver - 2010-09-15, 02:05 PM
Re: A .MDL exporter - by HolyDiver - 2010-09-18, 01:17 PM
Re: A .MDL exporter - by Verdite - 2010-09-19, 06:25 PM
Re: A .MDL exporter - by HolyDiver - 2010-09-19, 09:08 PM
Re: A .MDL exporter - by HolyDiver - 2010-09-20, 01:33 PM
Re: A .MDL exporter - by HolyDiver - 2010-09-20, 01:41 PM
Re: A .MDL exporter - by Verdite - 2010-09-20, 08:07 PM
Re: A .MDL exporter - by HolyDiver - 2010-09-20, 09:24 PM
Re: A .MDL exporter - by HolyDiver - 2010-09-20, 09:49 PM
Re: A .MDL exporter - by HolyDiver - 2010-09-20, 09:58 PM
Re: A .MDL exporter - by HolyDiver - 2010-09-24, 01:00 AM
Re: A .MDL exporter - by Verdite - 2010-09-26, 10:50 PM
Re: A .MDL exporter - by HolyDiver - 2010-09-27, 04:18 AM
Re: A .MDL exporter - by HolyDiver - 2010-10-07, 12:21 AM
Re: A .MDL exporter - by HolyDiver - 2010-10-07, 12:52 AM
Re: A .MDL exporter - by HolyDiver - 2010-10-07, 05:38 AM
Re: A .MDL exporter - by Verdite - 2010-10-08, 12:59 AM
Re: A .MDL exporter - by HolyDiver - 2010-10-08, 02:30 AM
Re: A .MDL exporter - by HolyDiver - 2010-10-08, 03:32 AM
Re: A .MDL exporter - by Verdite - 2010-10-17, 11:05 AM
Re: A .MDL exporter - by HolyDiver - 2010-10-18, 05:53 AM
Re: A .MDL exporter - by HolyDiver - 2010-10-23, 05:31 PM
Re: A .MDL exporter - by HolyDiver - 2010-10-24, 12:13 PM
Re: A .MDL exporter - by Verdite - 2010-11-12, 01:49 AM
Re: A .MDL exporter - by HolyDiver - 2010-11-12, 03:24 AM
Re: A .MDL exporter - by Verdite - 2010-11-12, 03:28 PM
Re: A .MDL exporter - by Verdite - 2010-11-12, 03:44 PM
Re: A .MDL exporter - by Verdite - 2010-11-12, 04:01 PM
Re: A .MDL exporter - by HolyDiver - 2010-11-12, 09:52 PM
Re: A .MDL exporter - by HolyDiver - 2010-11-12, 10:12 PM



Users browsing this thread:
2 Guest(s)