I know this is a problem a lot of people encounter and sometimes (like me) after a moth of searching fell into despair.
After weeks trying anything I can think of to convert the NWN .mdl format to something Irrlicht support, just before I quit trying I found the way. Then, when I loaded it into Irrlicht I saw I cant animate the animated meshes. After getting frustrated from no success I quit trying and accepted failure, then, a few days later I said to myself "give it One more shot, so you can say you have covered every option" and guess what? IT WORKED! I found the way to to animate the NWN (converted) meshes without any problem just as if they were any other animated mesh.
So, I thought to myself, here is your chance to contribute the community and help all who is still lost and don't know how to do it.
The whole journey can be found here (shorter then it sounds - I really recommend to check it out!):
Converting NWN .mdl mesh to 3DS - Click Here.
Converting NWN 3DS meshes to .X and Animating the NWN converted .X format meshes - Click Here.
This is the final product you should get following my instructions:
http://rapidshare.com/files/54073043/Ir ... 1.3.1_.rar
O.K, lets get to work:
What you need:
To Convert the NWN .mdl format to 3DS:
3ds Max - You can get the 30-Day Trial Here.
NWmax 0.8 3ds max v6 Installer (1.1MB) - NWmax .8 Homesite.
To Convert the NWN 3DS meshes to .X:NWmax is a suite of import, export and modeling scripts and utilities for Discreet’s free gmax 3D modeling software. Unlike the previous scripts available to the community, NWmax is a no compromise full implementation of all features available to NWN 3d models. Skinmesh, Aura Lights, Emitters, animations, danglymesh… it’s all there and it exports and saves without any copy+pasting required. NWmax offers the user a suite of custom utilities to use while importing, creating and exporting NWN weapons, creatures, placeables, tiles and VFX creations.
Panda Directx Exporter (4.9.63.0) for 3DS Max - Click Here.
Some free-for-testing models from BioWare:
- Click Here - Note: The effects which are in .mdl format should be made in your game in another way - after reading all of this try use one of the effects and see what you get.
In short what is everything:
3DS Max is a modeling application.
NWmax is a plug-in to MAX which converts NWN .mdl format to 3DS - with animation and everything.
Panda Directx Exporter - as its name - an exporter to .X format - WITH animations!
O.k - Install Max, NWmax, Panda Directx Exporter and at least 1 model from BioWare's site - I'll use the Iron Golem model.
Enter Max - If you installed NWmax right you should get the following screen:
Press MDL Loading -> Browse -> Locate the Iron_Golem.mdl (make sure all its textures are in the same folder as it is) -> Press Import.
You should get something like this:
Now press File -> Export - in the "Save as type" if you installed the Panda's exporter right you should have (last one) "Panda DirectX (*.X)" like in here:
Call it "Iron_Golem_X" or anything else you want and press "Save".
Now just change few configurations:
And you will get 3 files where you saved it:
Iron_Golem_X.x - The mesh with animations.
c_golem_iron.tga - Texture A (for the body except the sword)
W_metal_tex.tga - Texture B (for the sword)
From now its few lines of code to show it on screen. This is how it should be done in your application:
Code: Select all
scene::IAnimatedMesh* mesh = smgr->getMesh("Iron_Golem_X.x");
scene::IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(mesh);
if (node)
{
node->setMaterialFlag(video::EMF_LIGHTING, false);
node->setMaterialTexture(0,driver->getTexture("c_golem_iron.tga"));
node->setPosition(core::vector3df(0.0f , 0.0f , 0.0f));
node->setRotation(core::vector3df(-90.0f , 0.0f , 0.0f));
node->setFrameLoop(0, 625);
node->setAnimationSpeed(20);
node->setLoopMode(true);
}
Code: Select all
smgr->addSkyBoxSceneNode(
driver->getTexture("default_skyboxup.jpg"),
driver->getTexture("default_skyboxdn.jpg"),
driver->getTexture("default_skybox3.jpg"),
driver->getTexture("default_skybox1.jpg"),
driver->getTexture("default_skybox2.jpg"),
driver->getTexture("default_skybox0.jpg"),0);
Special Note:
* I don't know why but you "Have" to change two parameters:
1 - Rotate the model on the X-Axis by 90 (-90) : node->setRotation(core::vector3df(-90.0f , 0.0f , 0.0f));
2 - Change the speed of the animation - as much as you need, I suggest 20.
This is the final product you should get following my instructions:
http://rapidshare.com/files/54073043/Ir ... 1.3.1_.rar
After playing with it a bit more I made something nice with 3 different models - it uses DirectX9.
http://rapidshare.com/files/53451416/AT ... orOGL_.rar
I hope it solves a Lot of people a big Massive headache about how to do it.
Big thanks to all who helped me through this journey to NWN<->Irrlicht Land
I'll appreciate making this Sticky if people finds it helpful .
PS: Anyone knows maybe why there is the X-Axis "problem"?