Need some help concerning Mesher.

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
Major A Payne
Insys Pilot
Insys Pilot
Posts: 2
Joined: Fri Jan 15, 2010 9:21 am

Need some help concerning Mesher.

Post by Major A Payne »

Okay so I've done a generall search on google, searched this forum, and also trawled over the VS manual and I'm finally at the end of my tether, so this might be asking a very stupid question (it wouldn't surprise me if I get a bit of ridicule for asking it), but how the smegg do you actually use mesher?? I'm totally new to using a command line program so am unsure how to proceed so any help is highly appreciated.

Also appologies if I've posted this in the wrong place.
charlieg
Elite Mercenary
Elite Mercenary
Posts: 1329
Joined: Thu Mar 27, 2003 11:51 pm
Location: Manchester, UK
Contact:

Re: Need some help concerning Mesher.

Post by charlieg »

Hi there =)

You probably want to use UnitConverter, which is a frontend to mesher (right chuck?).

UnitConverter thread:
http://vegastrike.sourceforge.net/forum ... 20&t=11885

UnitConverter manual:
http://vegastrike.sourceforge.net/wiki/ ... tConverter

If you want to use mesher manually, there is the 'how to add ships' wiki page - which is the closest thing to a mesher manual that I know of:
http://vegastrike.sourceforge.net/wiki/HowTo:Add_Ships
Free Gamer - free software games compendium and commentary!
FreeGameDev forum - open source game development community
charlieg
Elite Mercenary
Elite Mercenary
Posts: 1329
Joined: Thu Mar 27, 2003 11:51 pm
Location: Manchester, UK
Contact:

Re: Need some help concerning Mesher.

Post by charlieg »

Free Gamer - free software games compendium and commentary!
FreeGameDev forum - open source game development community
Major A Payne
Insys Pilot
Insys Pilot
Posts: 2
Joined: Fri Jan 15, 2010 9:21 am

Re: Need some help concerning Mesher.

Post by Major A Payne »

I know about those pages for the manual, but the question is, how exactly do you run the program. I mean do you run it from a dos box and if so what exactly do you enter or is there something I'm missing??

I'll give that Unitconverter a go though. perhaps I'll be able to use it okay, but it usually takes me a while to get to grips with these programs properly.
charlieg
Elite Mercenary
Elite Mercenary
Posts: 1329
Joined: Thu Mar 27, 2003 11:51 pm
Location: Manchester, UK
Contact:

Re: Need some help concerning Mesher.

Post by charlieg »

Yes, use a dos box. Just type in the command:

Code: Select all

mesher whatever.obj whatever.bfxm obc
Where the 'obc' is the instruction on what to do - obc means "obj to bfxm, create output file".

To be honest, mesher.exe is a bit crude - it'll just fail if the file types are incorrect. We could really do with somebody converting it to Python.
Free Gamer - free software games compendium and commentary!
FreeGameDev forum - open source game development community
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Re: Need some help concerning Mesher.

Post by chuck_starchaser »

charlieg wrote:You probably want to use UnitConverter, which is a frontend to mesher (right chuck?).
Wish it were that simple...
The problem with UC is that it hides the mesher crap successfully, but sometimes you need to see mesher crap out.
I've been using mesher 50 times a day for the past week or so, but it's full of bugs, so I wouldn't want it running under the hood of another program.

Essentially, to convert a bfxm to obj, you go

Code: Select all

mesher ship.bfxm ship.obj boc
Then you can import obj into blender, modify it, and export to obj.
Then you convert that obj back to .bfxm by typing,

Code: Select all

mesher ship.obj ship.bfxm obc
Now you need to edit the mesh headers, so you need to convert to readable xml format,

Code: Select all

mesher ship.bfxm ship.xmesh bxc
And you might get a number of xmesh files:

ship.xmesh is the top LOD of the first mesh
1_0.xmesh is the top LOD of the second mesh
0_1.xmesh is the second LOD of the first mesh
1_1.xmesh is the second LOD of the second mesh

Now you open the xmesh files with an editor and add or modify the textures, change
the blending and/or cull modes, and other stuff.
Here's an example for the Agricultural Station hull, which uses the highend_flat shader:

Code: Select all

<Mesh scale="1.000000" reverse="0" forcetexture="0" sharevert="0" polygonoffset="0.000000" blend="ONE ZERO" alphatest="0.000000" technique="highend_flat"  texture="agri_hull.texture" texture1="agri_hull_spec.texture" texture3="agri_hull_glow.texture" texture4="agri_hull_norm.texture" >
<Material power="98.039215" cullface="1" reflect="0" lighting="1" usenormals="1">
	<Ambient Red="0.000000" Green="0.000000" Blue="0.000000" Alpha="1.000000"/>
	<Diffuse Red="0.200000" Green="0.200000" Blue="0.200000" Alpha="1.000000"/>
	<Emissive Red="0.000000" Green="0.000000" Blue="0.000000" Alpha="1.000000"/>
	<Specular Red="0.500000" Green="0.500000" Blue="0.500000" Alpha="1.000000"/>
</Material>
Here's an example for a transparent setup (Agri base glass domes, using the "fireglass" shader):

Code: Select all

<Mesh scale="1.000000" reverse="0" forcetexture="0" sharevert="0" polygonoffset="0.000000" blend="ONE INVSRCALPHA" alphatest="0.000000" technique="fireglass" >
<Material power="777.777" cullface="1" reflect="0" lighting="1" usenormals="1">
	<Ambient Red="0.000000" Green="0.000000" Blue="0.000000" Alpha="1.000000"/>
	<Diffuse Red="0.000000" Green="0.000000" Blue="0.000000" Alpha="0.100000"/>
	<Emissive Red="0.000000" Green="0.000000" Blue="0.000000" Alpha="1.000000"/>
	<Specular Red="1.000000" Green="1.000000" Blue="1.000000" Alpha="1.000000"/>
</Material>
You have to watch for spurious ="" things appearing in xmesh when you convert from bfxm to xmesh, usually next to polygonoffset. Looks like,

Code: Select all

polygonoffset="0.000000" ="" >
because they will cause mesher to crap out when you try to convert back.

Finally, you convert all your xmesh files back to bfxm:

Code: Select all

mesher ship.xmesh ship.bfxm xbc
mesher 1_0.xmesh ship.bfxm xba
mesher 0_1.xmesh ship.bfxm xba
mesher 1_1.xmesh ship.bfxm xba
Notice that the first line is xbc ("Convert") while the subsequent lines are xba ("Add").

Then cross your fingers REALLY hard, and boot the game.
It may happen that one or more of the meshes don't show up at all. What I do is I change
something in blender, divide a polygon, whatever, and export again; --do it all over.
HTH and good luck.
Post Reply