How to use the blender xmesh exporter

This is the location for all mods to collaborate. Anyone making or planning their own mod should post help requests, screen shots and news here.

Moderators: Omega, tillias, Mod Contributor

Post Reply
Beowulf
Mercenary
Mercenary
Posts: 121
Joined: Thu Jan 15, 2004 5:42 pm

How to use the blender xmesh exporter

Post by Beowulf »

Hi,

could somebody please elaborate on the necessary steps for exporting a model from blender? I've tried it but so far with little success. Here is what I did:
I have an .obj which is lacking a .mtl -- so I imported it into blender, used ImageMagick's convert make .pngs from the texture which came as a Photoshop .psd. I then created materials for the different objects of the model in blender and assigned the diffuse and the glow map .png. At this point everything looks fine in blender. Next I used the blender_xmesh_export.py script that comes with Vegastrike to convert the objects to .xmesh. The script produced one file per object, but doesn't assign any textures. I edited the .xmeshs by hand and added the appropriate texture... entries, then tried to convert the .xmesh to .bfxm with the following command (I already wrote this in another threads...):

Code: Select all

florian@beren:Imp_Assualt_Transport [0]> mesher HULL_LOD0_None_HULL_LOD0_None.xmesh atr.bfxm xbc
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::erase
You can download the obj, xmesh, pngs etc. from http://www.hawo.stw.uni-erlangen.de/~si ... r-test.tar (15MB).
"History is on the move, Captain. Those who cannot keep up will be left behind, to watch from a distance. And those who stand in our way, will not watch at all."
Grand Admiral Thrawn
loki1950
The Shepherd
Posts: 5841
Joined: Fri May 13, 2005 8:37 pm
Location: Ottawa
Contact:

Post by loki1950 »

It is all so possible to go obj + mtl >>bfxm do a mesher --help to get the cmd line syntax so try an export to obj + mtl in blender.

Enjoy the Choice :)
my box::HP Envy i5-6400 @2Q70GHzx4 8 Gb ram/1 Tb(Win10 64)/3 Tb Mint 19.2/GTX745 4Gb acer S243HL K222HQL
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and Lenovo ideapad 320-15ARB Win 10/Mint 19.2
Beowulf
Mercenary
Mercenary
Posts: 121
Joined: Thu Jan 15, 2004 5:42 pm

Post by Beowulf »

Ok, problem solved. It seems the version of mesher that I had installed is completely messed up. I compiled mesher again and now it works nicely. Thanks for the help :)
"History is on the move, Captain. Those who cannot keep up will be left behind, to watch from a distance. And those who stand in our way, will not watch at all."
Grand Admiral Thrawn
loki1950
The Shepherd
Posts: 5841
Joined: Fri May 13, 2005 8:37 pm
Location: Ottawa
Contact:

Post by loki1950 »

Great now to convert all those star wars models you might consider a script to plow though the whole lot at once as i imagine it will be tedious :wink:

Enjoy the Choice :)
my box::HP Envy i5-6400 @2Q70GHzx4 8 Gb ram/1 Tb(Win10 64)/3 Tb Mint 19.2/GTX745 4Gb acer S243HL K222HQL
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and Lenovo ideapad 320-15ARB Win 10/Mint 19.2
Beowulf
Mercenary
Mercenary
Posts: 121
Joined: Thu Jan 15, 2004 5:42 pm

Post by Beowulf »

I'm not sure if there is much that can be automated here. There doesn't appear to be much of a standardized way the models are set up. Is there any documentation on how to make turrets? So far I didn't find anything about it. Some of the models come with nice meshes for their turrets and I would like to use them.

A few more question about the mesher:
In the source code there are some undocumented command line options:
-autolod -- does this do what I think it does? Should I use it or rather use the LODs that came with the models? And if I use the model's LODs how do I get mesher to use them? I included <LOD...> statements in the top level xmesh files but the mesher doesn't find the files. strace shows that mesher is trying to open a file with an empty string as name before it fails.
-autoedge, -autotangent, -forceflatshade, -basepath, several flip and flop options -- what do these do?
If somebody has answers to these questions I'll make a patch against currents svn mesher which will document these options in usage().

Is there any script or something similar that rotates a .xmesh 90 degrees around it's X-axis? would save me a few steps in blender while converting models...
"History is on the move, Captain. Those who cannot keep up will be left behind, to watch from a distance. And those who stand in our way, will not watch at all."
Grand Admiral Thrawn
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Post by klauss »

Beowulf wrote: -autolod -- does this do what I think it does? Should I use it or rather use the LODs that came with the models? And if I use the model's LODs how do I get mesher to use them? I included <LOD...> statements in the top level xmesh files but the mesher doesn't find the files. strace shows that mesher is trying to open a file with an empty string as name before it fails.
Audolod is for Ogre-capable meshers only, and it uses Ogre's autolod functionality which, even if we made it work for objs and bfxm (which is possible), is still too immature if you ask me - it's there since... well... it might be useful sometime (again, with Ogre).
However, if you have custom LODs, you'll always want to use them (Ogre's autolod is that buggy) - LOD statements should work, they always had - I'll try to take a look at why it doesn't. Just a hint, though, maybe you're not adding the <LOD> statements right - try converting a lodded bfxm back to xmesh to see how it's supposed to be.
Beowulf wrote:-autoedge, -autotangent, -forceflatshade, -basepath, several flip and flop options -- what do these do?
All of those except forceflatshade are Ogre stuff too. Autoedge and autotangent automatically computes edges (doh) and tangents (an extra UV coordinate set that shaders usually use as a special thing). Autotangent may begin working for non-Ogre builds, but not yet. Basepath is needed for Ogre builds to find the textures (they're no longer automatically guessed, so you have to provide a full path, or a basepath which all relative paths are relative to). But, again, Ogre stuff. You'll probably want to ignore all that I've flagged as being "Ogre stuff".

Forceflatshade, however, is not ogre stuff.
That does that exactly - force all faces to be flat. At least it should, it hasn't been used in a while and might be broken, given the large amount of changes that happened in the middle - who would want to use it after all?
Beowulf wrote:Is there any script or something similar that rotates a .xmesh 90 degrees around it's X-axis? would save me a few steps in blender while converting models...
Might - there are flipx/y/z, however I believe there's no -swapyz, which is what you'd need. We could work one such thing out, however, why not do it in blender?
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
Beowulf
Mercenary
Mercenary
Posts: 121
Joined: Thu Jan 15, 2004 5:42 pm

Post by Beowulf »

I think the best thing would be to do this in blender---if possible in a dialog that is shown when exporting to xmesh. Blender's obj exporter has such an option.
"History is on the move, Captain. Those who cannot keep up will be left behind, to watch from a distance. And those who stand in our way, will not watch at all."
Grand Admiral Thrawn
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Post by klauss »

Well, I just tried xmeshing and bfxming the fighter barracks (which has one lod) and it works fine.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
Beowulf
Mercenary
Mercenary
Posts: 121
Joined: Thu Jan 15, 2004 5:42 pm

Post by Beowulf »

I copied and pasted an entry from an exported xmesh from vegastrike and now it works -- no idea what went wrong the first time...
"History is on the move, Captain. Those who cannot keep up will be left behind, to watch from a distance. And those who stand in our way, will not watch at all."
Grand Admiral Thrawn
Post Reply