Background
A couple of years back I discovered the NWN mod Community and NWVault in particular. I was thrilled! Before that it had been a struggle just to get hold of a simple tree with no textures to download and use in your project. Now you had all kinds of models for testing purpose: trees, tiles, boats, monsters, weapons, shields etc all available for instant download. Unfortunately the only way for me to get those into OGRE mesh format was to use one of the two Milkshape MDL importers and then the Ogre exporter. Even worse, both of the importers had several drawbacks and some bugs that were almost hopeless to get around.
So last summer I began coding a LUA script that would read those MDL files and output OGRE XML. This was an intresting project and I managed to convert a few models using it. However on every new model I tried some new unforseen bug or limitation turned up. Got discouraged and dropped the project in August. This summer I found new energy to take this on again and now the script is ready for release
Description
This script starts by asking for a few input parameters. Only the first which is the name of the model should be changed unless you really want to. It then parses the file while building the mesh and skeleton XML files and eventually the material file. Just before the end it also starts up the OGREXmlConverter in order to compile the binary mesh and skeleton files. You need to change the path inside the script (near top) so that it matches your configuration or else it wont find the program. There are a lot of debug text while running the script but nothing to worry about. I might change it to be more silent in later releases.
Another thing I should mention is that most MDL models use a skeleton even if it doesnt have too. For example static geometry such as trees, doors etc usually come with a skeleton. In OGRE I believe a skeleton will slow down the rendering of such objects. I might change the script later so that if it cant find any animations it wont create the skeleton link at all.
Im not a lawyer so I dont know exactly in what ways you can use these models in your own projects. Im pretty sure that you cant use the Bioware models at all except maybe for private testing purposes if you own a copy of NeverWinter Nights. But I believe that some of the content from the Mod community can be used even in commerical products if you get permission from the author. Bioware cant claim intellectual property unless it is obvious that the model is derived or based upon one of the Bioware orginal models.
Features
- Geometry
Texture coords
Normal generation (MDL format doesnt seem to include normals?)
Bones
Animations
Basic material
- Treats "danglymesh" as standard trimesh
No emitters
No events
Only a few material properties supported yet (Transparency is on the TODO list)
Rotation of the bind pose bones. One example is the tail of the pig in the Swine hakpak that floats behind the body. Not very pretty =(
Downloads
The Zip contains mdl2mesh.lua, Lua executeable, a command file and a sample MDL file with its associated textures. Just unzip to a directory and double click the runme.bat file to get started.
mdl2mesh ver 0.9
And another Zip that contains an oak, an Uruk-Hai with one walk animation and a turtle with alot of animations. All converted to OGRE format (oak material fil was handedited to support transparency).
ExConverted
Media
Screenshots:
From Classic Dungeon 0.8.1
From Dwarven Halls
From LUSH: Version One
A movie with a goblin walking and slashing.
] goblin.avi (divx) From Cave Goblins (Full Pack)
Support
I will do what I can to provide support for this script. Sinbad has even hinted at this "project" ending up in the OgreAddons . Anyway if you do want to report a bug please check first that the model does show up properly in the MDLViewer from Bioware (it probably will, cause that app is very forgiving) and that it is not one of the known bugs or a limitation. If not then post in this thread a short description of the error and provide a link to where one could get the model (name of hakpak, model) and I will try to fix the problem.
Enjoy!