Code Herder Code Herder

Mesh files

Mesh files

Hello, I was looking at the mesh files for sins and it looks like it's gonna be quite a bit of work to reverse engineer so I was wondering if anyone was already working on it or had reversed engineer the file format already.

Doing the graphic editing suite for galciv wasn't too hard, I cheated by using the extremely cryptic pear editor but without any way of fiddling and seeing the changes it could become painful.

Cheers!
53,037 views 91 replies
Reply #26 Top


Can't really tell you much. Not really allowed.


Sometimes I hate rules, how about you?
Reply #27 Top
Yea those damn non disclosure agreements are a pain in the @ss
Reply #28 Top
Code Herder, if you could give some documentation on how to modify the weapon hardpoints, I'd be very grateful. The inability to change the number of weapons on ships has been affecting how much progress I can make on adjusting balance in Kin of the Stars.

Major Stress, I don't suppose I could prevail on you to make a few models for Kin of the Stars, could I? I don't really have contact with experienced modelers.
Reply #29 Top
Therax: Well it's "easy" I could explain it to you but you need an hex editor and lots of patience. I can give you the file format doc.

Also, you could wait a bit if you don't know how to use one, I'm hoping for a crude importer tommorow night depending on the amount of free time I have after work. Could be longer depending on how many snags I hit.
Reply #30 Top
I know my way around a hex editor, so if you've got a file format doc already written I'd love it if you could send it my way. Glad to hear you're working on a friendlier tool as well!
Reply #32 Top
The hardpoints on the models are just simple points with a naming convention for lightwave users. Vertices, or "dummys" if you are a 3dsmax user. I am not sure how they would show up in MS3D. Perhaps if i saw the model itself ill see the hardpoints, and how MS3D displays them.

As far as how Hardpoints are referenced in a ships entity file i am assuming that the entity file must have the same number of hardpoint reference entry's as the mesh has hardpoints. You probably can have less entry's in the entity file than what the mesh has, but not vice versa. I haven't experimented with this yet so i am just speculating.

I have my plate full with the Star Trek mod i am working on. I have over 100 ships i need to model, and texture. The ones i already built need to be remapped to work in Sins. To top this i travel for work. So there are times i will not home for days, or weeks at a time. So building models for others mods is out of the question, sorry.

If you have Modeling, or 3dsmax questions ill be happy to help if i know the answer. I use 3dsmax 5 so anything after version 6 will probably be new to me.
Reply #33 Top
I think that's great that you guys figured this out but has anyone bothered finding out how to make a civilization selectable once it's been created.

I mean after all you'll probably have all these nice shiny models why not put them to use in your own custom civ.

Reply #34 Top
Factions that users create are automatically picked up by the faction chooser in the full version so you won't have to mod anything but beta 3 is hardcoded to only allow TEC. A few more months and you will get your wish
Reply #35 Top
Well, I wouldn't know how they assign the various emitters, like engine exhaust, lights or weapons in max or maya I'm guessing it's a single vertex with a specific tag/name on it that's exported like you said.

As for the entity files, well as far as I understand it for weapons you just specify damage output for each side of the ship: front, back, left, right. There's no firing points set in there. The firing points set in the mesh file are just cosmetic emitter of bullets, you can have as many as you wish for each side.
Reply #36 Top

Factions that users create are automatically picked up by the faction chooser in the full version so you won't have to mod anything but beta 3 is hardcoded to only allow TEC. A few more months and you will get your wish


How does that work in MPlayer? Auto-desynch?

BTW, question for devs: Will this game have a built-in mod manager, to enable easy control of which mods are active at any given time?
Reply #37 Top
It should be automatically assumed that all players in MP should have the exact same files when playing a mod to avoid sync errors. I think blair answered that question a while back which was a yes about the mod folder iirc.
Reply #38 Top

I'm pretty sure the .fx files are just shader files.


Yeah, they may very well be that. Doesn't help me since I've no clue what the commands there mean.

The highest programing language I know is C++ and even there I never made much with graphics...


The .fx files are written in Microsoft's High-Level Shader Language (HLSL). There's a decent tutorial on it on AMD/ATI's site:

http://ati.amd.com/developer/ShaderX2_IntroductionToHLSL.pdf
Reply #39 Top
What are you guys using for hex editting and comparison tools?
Reply #40 Top
Some refinements for you on the .mesh format:

Everywhere there is a stringLength, it looks to be a long, not a char as your doc currently indicates.

Textures look to be always composed of 3 DDS textures, as described by Major Stress here.

The long you have listed as Unknown2 in the file header (at address 0x21) looks to be a count of textures. Then each texture is 3 Unicode strings, then 18 floats. These 18 floats are associated with the texture, not with the emitters that follow the texture list. I've been looking at CapitalShip_TechBattleship.mesh, which uses two textures, EffectTechActurret-*.dds and CapitalTechBattleship-*.dds, and there is a set of 18 floats separating the two sets of filenames, in addition to following the second set of filenames.

In other notes, I see emitters up to Ability-4 for the Kol, which is odd, because the capital ship entities only support 4 abilities (0,1,2,3). It may be a leftover artifact, currently unused.

Blair,

I've been using XVI32, for no reason than because it's the first hit when Googling for "hex editor". It has some handy features, like the ability to search for a Unicode string, and to interpret a set of 4 bytes as an IEEE float in realtime. I haven't felt the need to look for another one yet, at least.
Reply #41 Top
Wow, I wrote char eh? Well, I guess I made a typo and then the evil copy paste did the rest .

As for the unknown2 thats a good observation, I hadn't happened on a file with 2 set of texture. A more appropriate term would be a material I suppose as that's the term usually used for combination of properties for texturing. On another note, I've often seen model with one or two texture per material, some models like the shield even have no texture.

If those unknown floats are attached to the texture I'm guessing it would make sense for them to be things like the emissive light, specular or some such lighting parameters. Maybe not of course, it would be a bit odd with shaders and the way they read a lot of it from their data texture. Could also be parameters for the shaders, we'd have to experiment with them.

On an annoying note, the unicode string seems to follow a different pattern for the texture name in some files. I either miss calculated when checking offsets or there are different formats supported. Some meshs could be from say version 0.1 and others from version 0.2. I just need to check for the version value to find out.

You could check out EffectMesh_GreenBlock.MESH for an atypical example. Two textures for a material and the unicode strings are a bit odd, might be that I miss calculated their sizes but I don't think so.

Blair: I'm using Hex Workshop, it's a bit dated I guess but I'm used to it. It has the ability to view chunks of data as data following a pattern I defined which is nice. The new hex editor I've seen seem to have these now of course and even scripting language in some cases, maybe I'll upgrade soon .

Reply #42 Top
PS: there's an unknow block of data after the indices.
Reply #43 Top
Ok, I've solved the material list format issues I had remaining with a few files. Turns out even if the model is using two texture or one instead of two, it's going to leave a blank longword to indicate it's empty. I've updated the file format file with my finding.
Reply #44 Top
Makes sense. There isn't a field that I saw indicating the number of filenames, so when less than 3 are used, the remaining ones are listed as empty strings (length 0).

I've worked up a Perl script that I'm using to edit emitters. It's not very user friendly: I feed in a .mesh file, and it dumps out a text file of emitter information:


Above;0,25.3130931854248,0;0
Aura;0,-37.4141960144043,0;0
Centered;3.00000010611257e-06,0,30.6516609191895;0
Exhaust;-7.44873380661011,-6.97546815872192,-42.049144744873;-180
Weapon-0;-12.0242156982422,-0.30706200003624,50.5269889831543;0
Exhaust;7.49103403091431,-6.97546815872192,-42.049144744873;-180
Weapon-0;12.0731573104858,-0.30706200003624,50.5269889831543;0


Then I edit the text file, and feed it back in, along with the original .mesh, and get a new .mesh with the updated emitters. However, it's enough for me to start fiddling with adding and removing weapons on the existing Sins models.
Reply #45 Top
Well, I've really hit a wall with the last part of the file. Just after the indices, there's a bunch of values and I've no idea what they're for or even how to determine their number. setting them to 0 seems to do nothing in game but erasing them crashes the game on load time. I would just set them all to 0 but I cannot determine how many should be present to begin with. Suggestions?
Reply #46 Top
At least with other data files, Sins seems to be far more tolerant of extra data hanging around than of having data missing. Have you tried just appending (a really huge number) zeros to the end? What sort of relative size are you seeing for this block? Would (# of vertices + # of triangles) do it?

I'm afraid I'm not up to date on modern 3D engine design, so I'm not sure what to suggest for what other kinds of data the Sins engine might be looking for. Maybe some sort of hierarchical structure of triangles into larger objects? Sins doesn't support animated models right now, but if the IC folks ever planned on doing that, the engine would need larger order objects than triangles.
Reply #47 Top
Mmmm yes you're right adding more seems to work fine.
Reply #48 Top
Well, sorry for not delivering on time but I had that little snag with the unknown data at the end. I would've done it this week end but I'm finishing the basement with my father in law so...

After that I'm thinking a collaborative visual map editor *grins*.
Reply #49 Top
Damn Stress you forgot i'm suppose to help ya on this mod, sheesh, no love!
Reply #50 Top
Well, I got it working! This is awesome, space dwarf to the rescue!