PDA

View Full Version : Trying to figure out the .mdl format


Bachus
07-15-2006, 03:59 PM
Greetings.

I've been trying my hand at a little KOTOR editing after recently acquiring the Mac version. The problem being that I have nothing but Macs, so I can't use 3D Studio Max or gmax to edit model files. I *do* have Virtual PC which works fine for MDLOps. So I've been dumping .mdl files to the ascii format and manually converting the bits I want to .obj for editing in Blender.

The other problem being, I can't seem to get the edited data back into KOTOR. I'm editing party members (Bastila, etc), and I'm being careful not to add or delete any vertices/tex coords/etc. MDLOps compiles the ascii files back to binary fine (or at least it gives no errors). But when I add the models to the override folder and start up KOTOR, I just get the default model. If I re-decompile the .mdl, it seems that my edited data is gone. It's like MDLOps is replacing the edits with the original data from the binary .mdl.

So I must be doing something wrong. As near as I can tell .mdl files only contain three node types (or at least the ones I'm trying to edit do), dummy, trimesh, and skin. Dummies are just scenegraph and inheritance purposes right? They contain no geometry info. The trimesh nodes contain geometry info (and some of them tex coords for some reason), but when I load them up in blender they're just rough geometric shapes. I take it the trimesh nodes are just for animation purposes and are placeholders/weights/whatever? The skin nodes actually look like characters, so that's what I've been trying to edit and reimport.

Do I need to edit something else entirely? Edit the trimesh as well as the skin nodes? Can what I'm attempting not be done? MDLOps screwed up? I'm at an impasse.

Darkkender
07-15-2006, 06:30 PM
oh there is alot more than 3 node types my man. However I would ask Chainz.2da how he uses gmax as he is a mac user mostly as well. As far as the information on the model format if you visit "Torlak's" site he has a section on the NWN mdl format which has some slight differences but it is what Cchagrin used to help build mdlops. Now there is Taina's replacer tool that allows you to move vert coords of a ascii model in gmax then apply your changes back to the binary. However that still requires one of the modeling programs that you mentioned you can't use.

I'm right now working on a improved modeling tool that should be able to support area models. Also I'm trying to build in 3ds model previewer and a vert coord replacer function. Alot of this is just a matter of integration of different features and converting from Perl to C++.

ChAiNz.2da
07-15-2006, 10:29 PM
oh there is alot more than 3 node types my man. However I would ask Chainz.2da how he uses gmax as he is a mac user mostly as well.
Unfortunately this is one of the rare cases where I use my PC for more than collecting dust.. hehehe ;)

Virtual PC absolutely despises 3dsMAX (not sure about GMAX)... but because it's such a resource hound (as is VPC).. I usually just switch over to my PC to get my modeling done without me griping moreso than usual.. :xp:

However I believe your problem Bachus is the way MDLops translates skin mesh weights.. and that we are still pretty limited on certain operations on meshes at the moment :(

http://www.lucasforums.com/showthread.php?t=167108 (post #21)

What version of MDLops are you using as alpha 6 I think is still in need of some testing since it deals with potential problems like this and animations.. you seem a likely candidate to test ;)

http://www.lucasforums.com/showthread.php?t=155871

and finally, probably not what you want to hear, but It may be the fact that you're using translated .obj and Blender rather than MAX's nwmax plug-in. I can't speak for cc but I'd almost bet the ascii models from MDLops are meant to be read by said plug-in, not to mention the exporting from the plug-in as well :giveup:

Darkkender
07-16-2006, 03:37 AM
The NWMax plugin which is wrote with maxscript imports ascii models which are pretty much universal on game platforms and imports it into either the 3ds or gmax format.(This is a simplification and not the exact science of the matter.) In NWN the engine actually was able to handle uncompiled ascii models however that was something that got changed with SWK.

However on the top of my list of conversions is a direct to 3ds/gmax format of the model so that we can bypass the use of NWMax. I'm going to have to do this just to build in a preview feature for my model tool. Once I get everything figured out for converting the model from binary->ascii->3ds then it wouldn't be that hard to instead convert the model to the ".obj" format. I'm hoping that I'll have my alpha version of my tool ready by the end of august.(considering my freetime.)

Bachus
07-22-2006, 11:43 AM
I finally managed to get it working.

Turns out I was just using MDLOps wrong. I was using the replacer button, when I should have just been using read/write with the edited ascii file. So now I just need to figure out a way to automate the ascii->Blender / Blender->ascii process (Blender python script or whatever).

I actually managed to get gmax working in VPC, but fortunately I didn't need to use it in the end. It runs like a dog, and takes *forever* to load the .mdl files. Plus I've gotten so used to the Blender interface that using gmax was killing me. Blender can handle importing/exporting the skin nodes fine, but I don't know if it or the Python interface can handle the dummy/trimesh/dangly/etc nodes. I'll have to keep fiddling around with it. It should also be possible to get MDLOps working under Mac OS X since it's just a perl script, but I haven't put a lot of time into it yet.

Kha
07-22-2006, 11:59 AM
I would love use Blender instead of Gmax. There is a Blender script for importing NWN models, never worked for me on recent Blender releases... but I understand nothing about programming.
http://www.beastwithin.org/users/wwwwolf/games/nwn/gametools/neverblender/