Page 1 of 1

Unreal Engine 1 vertex mesh support

Posted: Mon May 14, 2018 6:38 pm
by Marisa the Magician
Being fed up with how unwieldy the MD3 format is (and after giving up on writing conversion tools from UE1 to MD3), I went and added support for the UE1 vertex mesh format directly, all by myself.

This is fully functional and tested thoroughly (excluding non-Linux platforms) but I think it may be a bit too "niche" of a format to be of any interest.

Source meshes are divided into two files: one for surface data (datafile, suffix _d.3d) and another for vertex positions (anivfile, suffix _a.3d); but I devised a quick and dirty way to pack them together (concatenated "UMSH" string + datafile + anivfile > .umsh file). This is also handy because the source files themselves have no signatures of any kind in their data that could be used for identification.

The branch is here, and here's a mod where I'm testing it all.

Re: Unreal Engine 1 vertex mesh support

Posted: Tue May 15, 2018 12:26 am
by Graf Zahl
I made a pull requesrt out of this so I can actually test it.
But is it necessary to lump the files together? In a packed archive it should be no problem to get the data from the different files as long as they are in the same archive folder.
If you can make it so that it can load it from the separate files I see no reason not to add it.

Re: Unreal Engine 1 vertex mesh support

Posted: Tue May 15, 2018 12:34 am
by Marisa the Magician
Still if that were the case how would I even detect the format in the first place?

Re: Unreal Engine 1 vertex mesh support

Posted: Tue May 15, 2018 12:38 am
by Graf Zahl
I don't know the format's specs. Do you have a demo model I can look at?

Re: Unreal Engine 1 vertex mesh support

Posted: Tue May 15, 2018 12:52 am
by dpJudas
If there is no reliable way of detecting the model, maybe specify one of the files in modeldef and then have it grab the second one by changing the _a suffix to _d. Or maybe just list both files in the modeldef (probably the solution that requires the most work).

Re: Unreal Engine 1 vertex mesh support

Posted: Tue May 15, 2018 1:06 am
by Marisa the Magician
Specs are here
And as an example here's a pair for a simple dice: datafile anivfile

@dpJudas: I'll try doing it like that.

Re: Unreal Engine 1 vertex mesh support

Posted: Tue May 15, 2018 1:27 am
by Graf Zahl
That format is not well defined... :?
I still think this should be done without a specialized merger tool. Such a thing will render it perfectly useless. Any other ideas?

Re: Unreal Engine 1 vertex mesh support

Posted: Tue May 15, 2018 2:34 am
by Marisa the Magician
I've switched up the code so it attempts to load the file pairs if the model filename matches either _d.3d or _a.3d suffix.

I also updated the test mod to reflect this change, everything works just like before in-game.

Re: Unreal Engine 1 vertex mesh support

Posted: Tue May 15, 2018 2:43 am
by Graf Zahl
That's better. Of course it needs no saying that the format itself is not nice, just being raw data with no header to check.
Also, do I get this right that the data contains no normals at all? How does this detect edges then?

Re: Unreal Engine 1 vertex mesh support

Posted: Tue May 15, 2018 2:51 am
by Marisa the Magician
In short, it doesn't. Normals are done per-vertex by averaging the computed normals of each triangle that contains them. Sharp edges are made by duplicating vertices and assigning them to separate faces.

It's all very rudimentary and it shows how this was made with stuff like OpenGL 1.x in mind.

Re: Unreal Engine 1 vertex mesh support

Posted: Tue May 15, 2018 3:03 am
by Graf Zahl
So was MD2 - and that did contain normals. It had other shortcomings, of course.

Re: Unreal Engine 1 vertex mesh support

Posted: Wed May 16, 2018 1:40 pm
by Marisa the Magician
Ah, dangit. You merged it before I committed an important fix.

I opened PR #481 for it.