Page 4 of 4

Posted: Tue May 09, 2006 8:58 pm
by Martoon
Marc wrote:
Martoon wrote:I've modified the script so the Ogre meshes it generates have the y-axis up (instead of z-up like NWN).
Is this configurable? I always prefer z-up ...
I guess I assumed people would be working with y-up in Ogre, since all of the Ogre Direction and LookAt functions assume y-up (and won't let you specify otherwise, as far as I can tell).

But I could throw another parameter in the script.

Posted: Tue May 09, 2006 9:20 pm
by Martoon
Okay, here it is (just for Marc :wink: ). The script now takes a "-zup" parameter. Without the "-zup" flag (by default), it converts everything to y up. With the "-zup" flag, it leaves it at the NWN orientation.

http://www.jcvr.org/rabens/mdl2mesh.lua

Posted: Thu May 11, 2006 12:02 am
by Martoon
Having one small problem with massconvert and some of the content I'm converting. Ogre material names are case sensitive. Massconvert generates the universal material script from the filenames of the .tga files. However, some of my .mdl's refer to bitmaps with a different case than the name of the .tga file. For example, there's a "helopad.tga" file, but the .mdl has "bitmap HELOPAD". The Ogre mesh that's generated wants a material named "HELOPAD", but the material file has a material named "helopad", so when the mesh is loaded, it has no material.

I'm trying to figure out the best way to deal with this. Ideally, I think the material script should have material names with their case taken from the materials referenced in the models (instead of from the .tga filenames).

I'm thinking of modifying the massconvert program to do this, but it would alter the flow pretty significantly, since it would need to convert the models first (and glean the material names from each model), then generate the materials afterward.

Posted: Sun Mar 18, 2007 1:06 pm
by Pascal
Is there any way to convert files like "c_yfem01.MDL" or "c_yshopkeep.MDL" (man or female models)? I get model with skeleton, but without any animations.

In .mdl files I see lines:
c_yfem01.MDL wrote:setsupermodel c_yFem01 a_fa
c_yshopkeep.MDL wrote:setsupermodel c_yShopkeep a_ba
It means that model needs another file ("a_fa.mdl" or "a_ba.dml") to work. Anyone know how to convert it? :)

Posted: Sun Mar 18, 2007 8:01 pm
by Borundin
What I did was to convert the a_ba.mdl file. Open the created XML file and then copy and paste the animation part into the XML file for the mesh I wanted to use it in (c_yfem01.MDL in your case). Then convert it ti the final mesh format.
Of course this will not be very efficient if you have several meshes that use the same animations. I think you can tell Ogre to use a skeleton from another mesh and then animate it as it had those animations from the beginning.

Posted: Sat Mar 24, 2007 8:20 pm
by Pascal
I think that last version of script posted here has some bug.
This model comes with NWN Model Viewer 1.0 (Dire_Cat.mdl).

The first version, without animations working, but model looks fine:

Image

The last version posted here, animations are working, but some bones are translated or rotated incorrectly:

Image

I don't know much about LUA, so I tried to use .mesh file from the first converion and .skeleton from the second. The model looks fine (like 1st image), but animated model looks strange (like 2nd image)...

EDIT: Models like Deer.mdl or Boar.mdl also have this bug. I think that all animals with 4 (or more) legs have this problem ;) Sorry for my English, I am not a native English speaker ;)

Posted: Mon Mar 26, 2007 6:05 pm
by Borundin
I will look into this. Thanks for the feedback.

Posted: Mon Mar 26, 2007 6:47 pm
by Borundin
It seems the last revision messed up a couple of things. I have removed the applyNodeOrientation code and updated mdl2mesh.lua in OgreAddons so that Dire_cat.mdl and others should work.

Remember for this model you need to set the parameter "-nobonerot" otherwise it will not work. This is the same as using 0 as value when asked "Apply bone rotation?"

Posted: Tue Apr 03, 2007 6:29 pm
by cloud
Hi, I had a troubles under the New Eihort XMLconverter (with OSX) I just downloaded the latest cvs version, the mesh xml file generated has this

Code: Select all

       <submesh material="c_werewolf
"
This \n after the material name din't used to be a problem for me XMLconverter, but it seems to be now

I added from a google search :wink:

Code: Select all

  
-- removes end-of-line characters in a string
  function Chomp(line)
    return string.gsub(line, "[\r\n]+$", "")
  end
and changed line 970

to io.write(" <submesh material=\"" .. Chomp(ktex) ..

and its working nicely again.

many thanks

Posted: Tue Apr 03, 2007 9:06 pm
by Borundin
cloud wrote:...and changed line 970

to io.write(" <submesh material="" .. Chomp(ktex) ..

and its working nicely again.
Thanks for your feedback!
I will add this to the mdl2mesh in Addons. Cant see anything that this would break... Programmers famous last words, I know :)

Posted: Thu Apr 05, 2007 5:06 pm
by Lord LoriK
Hi! I use this converter a lot and I found some models that give some wrong results, but not completely wrong. For instance, PLC_OAK207.mdl from the LUSH hakpack:

Image
Image

As you can see, only one of the thicker branches has the correct rotation. The same applies for the rest of the branches: one well positioned, the rest with wrong rotation.

Any ideas? I tested all the possible combinations of animation and bone rotation, and none fixed it.

Posted: Fri Apr 06, 2007 8:12 am
by Borundin
Did you try the latest version of mdl2mesh.lua from AddOns?
I removed a couple of lines recently that caused a lot of models to be converted with strange artifacts like those you describe.

Posted: Fri Apr 06, 2007 7:44 pm
by Lord LoriK
I didn't remember if it was indeed the last version, so I downloaded it again, and ran every possible combination again. All give the same messed result.

Posted: Fri Apr 06, 2007 9:47 pm
by Borundin
Ok, I will download the PLC_OAK207.mdl model and see if I can solve this somehow.

Edit: Yes there is definately something wrong here. PLC_oak101.mdl seems OK but not this one. One thing that is different is that plc_oak207.mdl uses orientation but plc_oak101 does not. This might take some time to solve Im afraid...

Posted: Sat Apr 07, 2007 3:49 am
by Lord LoriK
I'll be waiting, then. :) Hope you manage to fix it.

Posted: Sun Apr 15, 2007 10:27 pm
by karnewarrior
awsome :twisted:

Posted: Sat Apr 28, 2007 11:00 pm
by nindim
I seem to be having the same problem that Spot was having way back when. Here's what he had to say at the time:
Hi,

I've used the script to convert the 400meg hakpak that someone put together and it seems to work fine. However, when I try to convert a model from the "base game" that I extracted with NWN Explorer it fails to do the conversion.

The material files are always blank.

Mesh file
<mesh>
<submeshes>
</submeshes>
<skeletonlink name="c_demon.mdl.skeleton" />
</mesh>

Skeleton file
<skeleton>
<bones>
</bones>
<bonehierarchy>
</bonehierarchy>
<animations>
</animations>
</skeleton>

Lua output
filename: c_demon.mdl
scale: 100
bonerot: 1
animpos: 1
creskel: 1
animation----->
{ }

tmp - { }

Scene hieracrchy:
{ }
Finished


Any ideas?
Unofrtunately he never posts what he was doing wrong. Ive tried NWN explorer to extract the model as well as bif unpacker as it lets you pick the key file for the bif, whereas nwnViewer doesnt... I dont have the game installed, I have a friends install direcotry copied onto a DVD which I placed in "C:\Neverwinter Nights\NWN". I dont seem to be able to use nwnmdlcomp as iyou have to have the game installed.

The tool works with users mods I have extracted from hak packs (well an older version of the script, the current version seems to screw things up a little, seems like when the rotation was added it went bad for me)

Any ideas on the base models?

Posted: Sun Apr 29, 2007 11:36 pm
by nindim
Decompiling the models into ascii format did the trick. I had to use mdl2ascii.exe available in the ctools package. This doesnt require you to have NWN installed so all is good.

Posted: Sun May 20, 2007 12:52 pm
by Duncan Mac Leod
Martoon wrote:Okay, here it is (just for Marc :wink: ). The script now takes a "-zup" parameter. Without the "-zup" flag (by default), it converts everything to y up. With the "-zup" flag, it leaves it at the NWN orientation.

http://www.jcvr.org/rabens/mdl2mesh.lua
Is this version the latest??

Does it generate the new Mesh (1.4) format?

Posted: Tue May 22, 2007 12:31 pm
by SiENcE
Its doesn't generate binary meshes. It only generates Ogre-Mesh.xml files which you can convert to Ogre.Mesh using the Ogre commandline tools.

http://downloads.sourceforge.net/ogre/O ... i?download

Posted: Sun May 27, 2007 9:05 pm
by Duncan Mac Leod
Hi!

Does anyone of you have BoundingBox Problems with the Animated (converted) Models ??

Use an animated model and place it on the 'ground', then start an animation (i.e. walking), the model 'jumps' in the air - the animated model is ABOVE the ground, so I put it 'down on the ground' again, BUT its BoundingBox is still at its original location, only the animation is played 'high in the air'...

Putting the animated model back on the ground is not the problem, BUT I want the Bounding Box around my Model, NOT outside...

Look at the screenshots - as you can see the BBox of the Model is lower than the played anim...

Image Image

On the first shot you can see how deep the BBox is under the Plane...

Do you know what's wrong? Please help! Thank you!

Duncan

Problem : convert Iron_golem.mdl

Posted: Fri Sep 14, 2007 2:43 pm
by pfepark
when I converted to Iron_golem.mdl(from official NWN1 homepage ) using mdl2mesh I saw This Error Message.

lua5.1: mdl2mesh.lua:171: attempt to index field '?' (a nil value)
stack traceback:
mdl2mesh.lua:171: in function 'CheckVert'
mdl2mesh.lua:954: in main chunk
[C]: ?


What problem is it now ... ? I dont know LUA.

Re: Problem : convert Iron_golem.mdl

Posted: Mon Sep 17, 2007 8:36 pm
by Borundin
pfepark wrote:when I converted to Iron_golem.mdl(from official NWN1 homepage ) using mdl2mesh I saw This Error Message.
There is a new converter that perhaps can solve your problem:
http://www.ogre3d.org/phpBB2/viewtopic. ... highlight=

Also remember that you need to have an ASCII model, not the binary ones the NWN engine uses for best performance.

Re: mdl2mesh - Neverwinter Nights model converter

Posted: Sun Sep 06, 2020 2:14 am
by sercero
Hello,

You can find it here:
https://sourceforge.net/p/ogreaddons/co ... /mdl2mesh/

Be aware that this has not been updated since the year 2007.