Author Topic: A .MDL exporter  (Read 8331 times)

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: A .MDL exporter
« Reply #30 on: October 06, 2010, 07:21:17 pm »
I've attached a new Somimp_view.exe download to the top post which is built with a patch I setup just now for Assimp that makes the (malformed) .x files (from wherever you all are getting them) work.

I will try to prepare a new build for x2mdl which is more generous in the error reporting dept. Cpgen also, though cpgen is pretty cut and dry... your .mdl file is either valid or it isn't.

EDITED: Woops, I guess a new x2mdl download (top post... in a few mins) with the patch integrated is also appropriate...
« Last Edit: October 06, 2010, 07:27:26 pm by Holy Diver »

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: A .MDL exporter
« Reply #31 on: October 06, 2010, 07:52:47 pm »
For the record,

The uh book.x file which Todd had given me at one point was in very small coordinates. It disappears basically when loaded into x2mdl because the points all get rounded to 0.

That said, I had to scale it by 1000 to get enough precision to represent it.

So I'm wondering... does x2mdo (From's tool) want its .x files to be in in game coordinates, where 1 is a meter? Or in the file coordinates, where 1 is a millimeter, and there can be nothing smaller?

I'm assuming it wants meters, because I don't think it would guess the scale of the input or let you say so interactively. In which case I will need to rework everything a little bit. Including the importer...

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: A .MDL exporter
« Reply #32 on: October 07, 2010, 12:38:50 am »
Fixed the scale but came across another shortcoming in the Assimp .x loader. The .x files you all use don't assign names to the materials... doesn't seem to be against the rules, but it throws the Assimp loader for a loop / will have to be fixed.

Also it looks like x2mdl could maybe use a little more thought in the texture mapping dept. to accommodate irregular cases.

I've noticed a lot of the custom Som objects have weird texture mapping ranges which makes things like clamping the texture impossible. Normally things are (0,1) ... I'm assuming that is only even possible with .mdo files, because I can't think of anyway to break outside that with .mdl.

Offline Verdite

  • VIP
  • Dark Slayer Destroyer
  • *****
  • Posts: 1624
Re: A .MDL exporter
« Reply #33 on: October 07, 2010, 07:59:03 pm »
Hows the x converter coming on? Is anyone at assimp working on it?

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: A .MDL exporter
« Reply #34 on: October 07, 2010, 09:30:53 pm »
^Not sure what you mean exactly by that. But yeah I happen to be working on this stuff at the moment...

There were some empty promises to cleanup the .x loader, but no action after all this time, so I fixed it myself last night / found another hitch, which I think I mentioned. Anyway fixed that too / submitted a patch to the Assimp tracker. And today I also found some texture bugs in x2mdl and corrected the scale the other day. Added copious error reporting this afternoon. Will probably have some new releases for each tool up sometime tonight.

I think I will start work on mdl2x here soon (if that's what you mean) ... I think I need to look into what exactly .x is capable of though. It's pretty sorry as graphics formats go. But it can at least export the 3D geometry, if not the animations... probably not the soft animations, but who knows.

I posted for comment about whether there was any intention to work on some better exporters at this point or not / encouraged the idea. I can't think of anything like Assimp, and it's a really great idea, but the core developers seem absent lately, and they kinda suck (read: throw up too many hurdles / bring too little to bear) in terms of allowing outside development to happen.

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: A .MDL exporter
« Reply #35 on: October 07, 2010, 10:32:50 pm »
UPDATE: Attached new versions of x2mdl/cpgen/Somimp_view.exe to top post.

Please give them a try...

Offline Verdite

  • VIP
  • Dark Slayer Destroyer
  • *****
  • Posts: 1624
Re: A .MDL exporter
« Reply #36 on: October 17, 2010, 06:05:00 am »
I recently downloaded your x2mdl again and got the same error message. My file was in x format the same as previous tries.

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: A .MDL exporter
« Reply #37 on: October 18, 2010, 12:53:32 am »
Your untextured.x file works for me, as does Todd's book.x file. You're probably doing something wrong or think you're seeing an error that isn't there.

You'll need to describe what you're seeing either way. Again if necessary. It's possible (though very unlikely) there is some dependency which is not installed on your computer. If so we need to know about that. Any message box which mentions a file is very important. And if you can click on "details" and get to the dump of the error message / post that, that would be helpful.


I will ask Todd to give it a try. He generally is better at that sort of thing / helps iron things out / encourages others to not give up. If nothing else I recommend trying different things to see what works, the same way you would with From's x2mdo app (which also requires some know-how) instead of just giving up.

Again we have to communicate better as a community if we want results.


PS: I don't think I ever intentionally addressed what would happen where a input includes external image files which are not there. I just tested that and it does produce a bad .mdl file... I will look into that asap, however in the meantime, if your file/textures load into the viewer app, things should work with x2mdl.


UPDATE: I've not yet uploaded a new release/download, but I've added some code to keep the file from being flushed (written) whenever there is an abnormal exit status (something I didn't think about when slipping in all the error points) and improved the message for missing texture files. I think a missing texture is going to remain an abort condition because it's not really appropriate to make that material untextured because Som's texture coordinates depend upon the dimensions of the texture. So not only would you be tossing out the texture, but the texture coordinates would not be appropriate either.

If you're seeing a real generic popup box and all error though this probably won't help you. You might want to make sure you're using the new download, and not an old one you had on your computer. The new download might be named something like x2mdl_2 or something if you downloaded to a folder with an x2mdl exe already in it. Also if you're typing things into a command prompt, sometimes (bugger all) Windows will use an older exe / dll file it has cached in memory, even when you overwrite the files.
« Last Edit: October 18, 2010, 01:18:02 am by Holy Diver »

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: A .MDL exporter
« Reply #38 on: October 23, 2010, 12:31:23 pm »
I tried untextured.x with x2mdl on a non-dev XP machine. I did get a dialogue box which I'd setup which says Direct3D9 is probably unavailable or some such, do you wish to continue. I continued, and because there were no textures everything probably went fine. If there were textures it would've given up.

So anyway I set up some feedback to see where things were going wrong (because I knew D3D9 was in fact available) and turns out in that case anyway the "reference" device type was not supported with those drivers, so I setup a fallback to a more generic hardware device and that went thru.

Stupid thing is I chose the reference device because it is independent of hardware, ie. for wider support, but it turned out to be less helpful in that case.

Anyway I'm more just posting to say everything seemed fine from my end. If that was the problem you were having it would not have been too hard to just type the dialogue box message for us, so I'm assuming your troubles are otherwise. But anyway, I can't fix (or even guess at) whatever probs you're having without feedback.


I will upload a new build later today because if your drivers don't recognize the ref device type then texture support is out, and that's not acceptable...


Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: A .MDL exporter
« Reply #39 on: October 24, 2010, 07:13:28 am »
Forgot to mention that I replaced the x2mdl attachment last night. Please let me know if this one does any better / what it does if not.