TpFMC Advanced model convertor

Willkommen in der Transport Fever Community

Wir begrüßen euch in der Fan-Community zu den Spielen Transport Fever und Train Fever, den Wirtschaftssimulatoren von Urban Games. Die Community steht euch kostenlos zur Verfügung damit ihr euch über das Spiel austauschen und informieren könnt. Wir pflegen hier einen freundlichen und sachlichen Umgang untereinander und unser Team steht euch in allen Fragen gerne beiseite.

 

Die Registrierung und Nutzung ist selbstverständlich kostenlos.

 

Wir wünschen euch viel Spaß und hoffen auf rege Beteiligung.

Das Team der Transport-Fever Community


  • To resolve the problem mentioned in this topic
    TFMC Source Code?


    I got look into the source code of TPMC, and finally rewritten a convertor of my own


    The link is here:
    TpFMC


    It's very early dev so some functions are not there, but at least it can do one thing neither TPMC nor TPC does: batch conversion from a single file.


    You are welcomed to test it.


    In priori, the tools fits ASE format, but it doesn't reject 3DS, OBJ, and FBX2013, but I just don't guarantee the result.

    This guy is too lazy to create a signature. 8o

  • For an example in the game files there's the db_v100:
    Mesh:
    ~/res/models/mesh/vehicle/train/db_v100/lod_0_logos.msh (~/lod_0_logos.msh.blob)
    Material:
    ~/res/models/material/vehicle/train/db_v100_logo.mtl


    To elaborate further the material type = "PHYSICAL_NRML_MAP_CBLEND_DIRT_LOGO" From what I'm assuming uses uv0 (seen in the msh file) for the vehicles textures and uv1 (seen in the msh file) for the logo texture (I could have it mixed as I've no way to confirm my methodology). I've been messing around and have got it working (able to confirm it working as the normal map gets displayed correctly).


    Is this the kind of example you where looking for?

  • I do in Blender but I've not been able to successfully convert it to .msh instead I kinda frankensteined 2 meshes together and manualy edited the .msh (I'm not 100% if that even worked/mattered, and if it did it would explain the face-glitching) I've been experimenting with sub-meshes as well.
    In terms of what format supports mulitple uv's I've been able to export .dea and import it with uv's intact beyond that, I've read that .fbx supports it as well (but I don't have much experience with that format, a few tries I prolly grasp it better).

  • @Skiwee


    I will upload a version support uv1 tonight but I won't be able to test it....I hope you can try it.


    But I don't know if it works correctly with other format than ASE, since the local transforms are yet counted as I tested with FBX it produces correct model but in wrong position, so perhaps some other works need to be done. But you are welcomed to make suggestions.

    This guy is too lazy to create a signature. 8o

  • Yea thats for adding extra materials. So prime example are repaints (have 1 mesh with multiple textures). they get configured in the .mdl file and in the .msh file would then have the list of materials.
    Taking the v100 as an example again:



    in the .mdl when

    Code
    -- MODEL
    matConfigs = {
    	{
    		0,
    	},

    it shows: vehicle/train/db_v100.mtl


    Code
    -- MODEL
    matConfigs = {
    	{
    		1,
    	},

    it shows: vehicle/train/db_v100_second.mtl



    Submeshes are then represented like:



    Code
    -- MESH
    	matConfigs = {
    		{
    			0, 0, -- first material and first submaterial
    		}, {
    			1, 1, -- second material and second submaterial
    		}, 
    	},

    the srn6 has an example of submeshes:
    ~/res/models/mesh/vehicle/ship/srn6/lod_0_body.msh

  • I love how clean it is, has great potential 8)


    I think managing multiple uv's broke it though, as doing a regular mesh it tries to add the uv1 even when there is no second uv-map.


    But when there is (.fbx test, I've included my file below as well) generates:


    I also have to rotate the fbx z -90° > x 90° for the correct orientation, but that might just be me Blender plugin I have to rotate z-90° and when exporting .obj orientation is perfect.

  • in "indices" section there are an error: there are two uv0s, the second should be uv1


    in vertexAttr, uv1 exists always, since I put it there, but if the count is not 0, that means there's really a uv1 there...I have tested it models with only uv0, it doesn't cause a crash


    however, what lead to crash is the texture path, check if it's correct, currently you need to added the path by yourself

    This guy is too lazy to create a signature. 8o

  • in "indices" section there are an error: there are two uv0s, the second should be uv1
    however, what lead to crash is the texture path, check if it's correct, currently you need to added the path by yourself

    Yea I know all that.
    I was just sharing the raw data TpFMC was generating, so you could see what it's doing. Of course I edited it before testing and it caused a crash. I didn't have time to look into it. Later tonight when I have time I'll see what I can figure out.

  • Ok. I will try to figure it out tonight. I don't know much about vehicle modding so perhaps I need your help.


    @Skiwee


    Could you provide a full set of mdl and material/textures so that I can test by myself easily?

    I can provide an unconverted example. Even my work-around still lacks the first uv-map and was just a means to get it working in-game (untill we get a converter that suports multi-uv), my method also causes the model-viewer to crash. I can give an example but currently the only files that have a first/second working uv-map are the ones provided with the game (which is I think every vehicle).
    If it where posible to open a .msh.blob I'ld know a lot more I think.
    I spent a few hours comparing converters and except for the indices being copy/paste from the normal = { }, your spot-on so I think the problem might be within the .msh.blob (orientation can always come later or leave it to the user).


    Also I can confirm my original thought was correct as I was e-mailed this:

    Zitat von Christian - UrbanGames

    Usually the logos are created as follows :

    • Create a submesh for the logo.
    • Assign the model’s UV to it. This will be [uv0] and specify where on the original mesh the logo lies.
    • Create a second UV set. This will be [uv1] and specify which part of the logo texture is used.
    • Export the logo mesh with the two UV sets. You need an exporter which can handle multiple UV sets.

    I'm tempted to want to figure out how to write a converter, but thats like learning to swim in the deep end of the pool. my level of skill is reading/modifying scripts not writing them from scratch.

  • You can have a look at this files: BR 193 - Siemens Vectron (TPF)


    I created a second uv with the help of a hex editor ;)
    Not really comfortable - but working well. But don't know wether wavefront (obj) does support a second uv map saved within a single file.

    Sadly wavefront(obj) doesn't support multiple-uv's. collada(dae) and filmbox(fbx) do, they're currently the only formats I've played with and I like the .fbx flexibility so far, I'm not sure what other formats can/can't.


    Thx @mediziner I'll take a swing at it with a hex-edit (don't suppose there are any details you could pass on?).

  • You might find all details needed inside msh file. There are several offsets and block lengths. If you have two identical meshes with different uvs, you can copy your uv from one file to another with the hex editor. If it works or not depends on the converter you used before. Merks blender exporter does an excellent job. So uvs can be transfered this way.


    Btw, Merk is working also on uv1 export Options for his Blender plugin. ;)

BlueBrixx