MDL2Mesh        

MDL2Mesh.jpg
Author: Magnus 'Borundin' Gustafsson
Project: OGRE Add-on Project (mdl2mesh)
Type: LUA Script
Documentation: ReadMe
Sources: OGRE Addons SVN, Mirror
Status and bug reports: OGRE Forum Thread
External Links: NWVault


MDL format is used by some Bioware games such as Neverwinter Nights. There are alot of community provided content that can be downloaded from the net. NWVault in particular has a wide collection of different models, textures and animations.

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

Limitations

  • Treats "danglymesh" as standard trimesh
  • No emitters
  • No events
  • Only a few material properties supported yet (Transparency is on the TODO list)

Known bugs

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 =(

Support

I will do what I can to provide support for this script. 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.