Page 1 of 1

How to use the blender xmesh exporter

Posted: Thu Sep 20, 2007 5:27 pm
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).

Posted: Thu Sep 20, 2007 10:26 pm
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 :)

Posted: Fri Sep 21, 2007 12:22 am
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 :)

Posted: Fri Sep 21, 2007 12:35 am
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 :)

Posted: Fri Sep 21, 2007 6:37 pm
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...

Posted: Fri Sep 21, 2007 10:36 pm
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?

Posted: Fri Sep 21, 2007 10:55 pm
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.

Posted: Sat Sep 22, 2007 3:35 am
by klauss
Well, I just tried xmeshing and bfxming the fighter barracks (which has one lod) and it works fine.

Posted: Sat Sep 22, 2007 10:15 am
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...