About meshes, IM and LOD

F2Andy

Member
I am hoping someone can explain the technical details here. As I understand it the model has a series of meshes, each with its own texture, and the one displayed depends on how far away the viewer is. If you are close, the high poly mesh is used, far away, and the low poly mesh is used.

So what I am wondering is how this is set up in Trainz. Are the different meshes put together in blender/GMax/whatever, or when the model is exported to Trainz format, or are all the meshes there separately in the folder that Trainz uses? Can you look at or even modify the different meshes in CCP?

The reason I am asking is because I am looking for a good BR Blue class 37. The ones I have found on the DLS have quite different colouring at different viewing distances. Nearby, the colours look excellent, but move away, and suddenly the blue looks way too pale. In one case it suddenly flips to a modern coal livery when you move away! If I wanted to correct this (just for my own use) what would I need to do?
 
I'm no expert on this but would the 37s you're using be by tmz06003 perchance? If so, then I'm almost certain I recall a mention that when viewed from a distance, the original mesh will 'show through' his adjusted mesh which explains why you see the livery change entirely.

Unfortunately, I can't remember how to fix it and tmz06003 is on a sabbatical at present. One of our other esteemed content creators may well know the answer though.
 
I am hoping someone can explain the technical details here. As I understand it the model has a series of meshes, each with its own texture, and the one displayed depends on how far away the viewer is. If you are close, the high poly mesh is used, far away, and the low poly mesh is used.

That is the jist of it, yes, although technically it's not the 'distance' that determines the LOD mesh in trainz, but the amount of screen space (specifically, a fraction of the width of the screen) occupied by the object, which is a somewhat weird way of doing it and makes it hard to work out how it will appear, but it's the approach Auran went with...

So what I am wondering is how this is set up in Trainz. Are the different meshes put together in blender/GMax/whatever, or when the model is exported to Trainz format, or are all the meshes there separately in the folder that Trainz uses? Can you look at or even modify the different meshes in CCP?

They are exported as seperate mesh/texture sets, the mesh used at a specific screen usage is specified in the config.txt and a .lm file, which is just a text file and easily edited. I don't think CCP includes any support for editing the LOD settings manually, other than support for the LOD tags in the mesh table.

Probably the closest thing to a reference is :

http://online.ts2009.com/mediaWiki/index.php5/LM.txt_file


The reason I am asking is because I am looking for a good BR Blue class 37. The ones I have found on the DLS have quite different colouring at different viewing distances. Nearby, the colours look excellent, but move away, and suddenly the blue looks way too pale. In one case it suddenly flips to a modern coal livery when you move away! If I wanted to correct this (just for my own use) what would I need to do?

This is a common problem with reskins of PikkaBird's 37s, although Warbo40, tmz06003 and others appear to have gotten around it recently, their more recent reskins don't exhibit this behaviour.

It's basically a problem with the way LOD meshes behave when an aliased asset points at them - as I understand it, you can only really reskin the closest LOD mesh in this situation, and the more distant meshes default back to the original's textures.

Best way to fix it is probably to find one of the newer reskins and see what they've changed compared to a reskin that exhibits the weirdness, then duplicate that in the one(s) you want to fix.

Personally, I just avoid the older reskins in favour of the new ones, although that often means dealing with out-of-prototype situations, eg I might want to run a split headcode blue '37 on the ECML, but only have a scottish region numbered 37 to use (worst of all, most of Warbo/tmz's reskins are late era blue or beyond, so in the time period where the depots had started painting on their motifs :/ - granted, Pikka's generic blue era original 37s would suffice for earlier than that, but I feel the blue shade on the reskins is closer to realistic)
 
I'm afraid the alias feature was broken (as described above) when they introduced the LOD feature. It's been this way for many years so I can only guess it isn't something easy or cost effective to fix. The only way I know to fix it is to use the original mesh files with the reskinned asset. Which eliminates the use of the alias tag. Maybe what Auran has been hoping for, for years now. 8-(

You have a couple of choices - at least for your own personel use. You need an asset that has the original mesh files in it (its kuid is referenced in the alias tag in the asset you wanted to edit) . You can clone the original asset which will make a copy of it and give it your user id. This is probably a copyright infringement if it ever escapes from your computer. So you are now responsibe for it's safe keeping. Open the clone with CM for editing in explorer and also the alias version (not the original). Replace the texture files in your clone with the textures of the same name from the alias version. Save and commit. See if the asset works correctly now.

You may find that the same problem exists. If so you will have to create new texture files for the other .im files in the LOD sequence by editing the ones you find in the folders. If you don't know how or what to edit then you've got some homework to do. It's a complete subject in its own right.

The other way is to just edit the alias asset (again probably a copyright infringement of both original and reskinner if you ever try to redistribute without permission from both). Some thing - open it with CM for editing in explorer. Remove the alias tag and add in the missing mesh files (.im files) from the original asset by copy and paste into the appropriate folders. Commit and check it out. If it has the same problem then you have to provide new textures as mentioned above.

If you happen to find all the .im files in the alias asset then the reskinner didn't do his job right and redistributed the original mesh files. If he had permission to do this then there was no reason to use the alias feature. He also messed up because he could have gotten the asset to work correctly. But in this case all you need to do is remove the alias tag. Then check it out same as above.

It would be so much easier if Auran fixed this long broken feature. But don't hold your breadth. I been hoping for 5 or 6 years now. For some reason they just haven't done it. In the end it just forces reskinners to redistribute the original mesh files with their assets. Hopefully with the knowledge and permission of the original content creator.

Bob Pearson
 
Last edited:
Nikki, I went back and reread your post. I still think there is no way to make alias work correctly with LOD.

The 37's that PikkaBird revised for reskinning disable the LOD feature. It still uses a .LM.txt file in the config and has addtiional .im files in the asset but the .LM file only references the primary .im file which effectively disables the LOD feature. He mentions this on the web site as required to make reskins work.

I checked a recent reskin by Warbo40 on the DLS and it uses a base model that has the LOD feature disabled as stated above.

I don't think you can do this with the alias asset itself. I think I tried it years ago but memory isn't as good as it was. Afaik you can only do it if the original model is modified to disable the LOD feature.

Bob Pearson
 
Last edited:
Thanks for the replies.

I will have a go at your option 2, Rob, and see how that goes. If nothing else it should give me some idea of how Trainz handles these things.
 
Yes it is a good way to see how things get put together.

If the asset was set up correctly the alias will be missing a couple of folders that contain the mesh files and textures for them. These you can copy over from the original. That will leave a bunch of texture files in the main folder of the alias that are the modified textures (.texture.txt files and image files - .bmp, .tga and .jpg usually). You'll have to manually move these into the new folders with the mesh files and overwrite the original texture files there.

The alias feature works because the .texture.txt file names for the modified textures match up with the originals they replace. It is possible however that the image file names won't. The modified .texture.txt files can reference different image files. If that's the case you can just open the .texture.txt file and read the image files that it references. Usually only 1 folder is involved xx_body or something even though you may have to move over a shadow and art folder. Cut and pasting all the texture.txt and image files into it probably will overwite the correct files and the modified .texture.txt files will point to the ones they need. You may end up with extra image files but other than taking up space on your HD they won't effect the asset in the game.

It's always best to make a backup copy if you edit something. In this case cloning the alias asset is probably a good idea to start as it keeps the original intact and you can work on the clone til you either give up or get something to work.

Good luck,

Bob Pearson
 
Back
Top