Page 1 of 2

Converting Sketchup models to Trainz

Posted: Sat Jun 15, 2013 2:58 pm
by bird_d00
This Topic is now obsolete. A full tutorial showing this method of converting Sketchup models in far more detail is now available on my website http://www.lutrainz.com




Hi guys

I see there are now a few of us involved in coverting Sketchup models from the Trimble 3D warehouse into Trainz. This may be of interest to those involved, or those who would like to get involved.

Until this afternoon I had never seen a method of getting these models into Blender/3DS/Gmax that didn't involve partial corruption (at least of the texture mapping) using the free version of Sketchup. However I have just found a rather interesting program that can convert from KMZ or DAE files (as exported by Sketchup) to 3DS format without any corruption whatsoever. Have a look at the following screenshot showing the model of the Putney Bridge (District Line) imported into Gmax.

Image

This took under an hour which includes downloading the program, learning how to use it and correcting a few problems. And yes this will be appearing on TPR some time soon (only 8420 polys before I start work trimming it).

The program Is called ModelConverterX and is available from http://www.scenerydesign.org/modelconverterx/ . It is really for Microsoft Flight simulator, but seems to make a really good job of converting to 3DS. There are options to automatically resize texture files to powers of 2, but I have not figured that bit out yet - it seems to involve calls to another program that I haven't tracked down (part of the Flight Simulator SDK I believe). The only problem I had with it was with texture file naming being truncated so you get file names like "TEXTUR~3.JPG" instead of "texture_16.jpg" after import into Gmax - not too hard to figure out which one is which, and for some reason some of the JPG files on this Sketchup model are named with a ".SAILBOAT" extension - lord knows why.

Dave Bird

Re: Converting Sketchup models to Trainz

Posted: Sat Jun 15, 2013 4:30 pm
by bird_d00
OK, a bit of an update on this. For the texture file conversions you will indeed need the Microsoft Flight Simulator Terrain SDK. If you don't have this already, you can download it for free from http://download.microsoft.com/download/ ... _setup.exe . You will then need to install it and then point ModelConverterX to the imagetool.exe program. Use the menu "Options\Texture settings\ImageToolPath" and point it to the correct file (by default it will install to C:\Program Files\FS2004SDK\TERRAIN_SDK\Terrain_Tools\imagetool.exe).

Before you export your file from Sketchup don't forget you will need to explode all the components & groups. Export from Sketchup as a .KMZ file(so you have all the texture files). Run up ModelConverterX, select Import and select your .KMZ file. Select Export and name your output 3DS file, then finally select the "Mass Texture Editor" icon and tell it what format you want (don't use the default DDS) and where to put the texture files, click on "Update" and you are done.

Finally you can run up Gmax, import the 3DS file and then have fun renaming the texture files in the material editor (the names are wrong because the 3DS format only allows DOS format 8.3 character file names) and click the blue & white chequer world thingy to display each texture. Save your Gmax file and you are done. If you only have a few textures you should be able to do all of this in under 5 minutes (I just picked a bad one to test - Arnos Grove station - it has 60 texture files !)

Dave Bird

Re: Converting Sketchup models to Trainz

Posted: Sat Jun 15, 2013 4:39 pm
by alexfleming380
Wow! Thanks a lot for this. I think I might just give it a go
Alex.

Re: Converting Sketchup models to Trainz

Posted: Sat Jun 15, 2013 9:20 pm
by bird_d00
And just to prove how quick and easy this method makes it, here is the Fulham Bridge as above in Trainz and it has already been uploaded to TPR. I managed to get it down to 7186 polys without too much effort by deleteing the insides of some of the objects (Sketchup often seems to texture the outside and the inside of objects !). Most of the effort was in adding track attachment points, converting the texture files to TGAs and generating the config file & screenshots - simples.

Image

Dave Bird

Re: Converting Sketchup models to Trainz

Posted: Sun Jun 16, 2013 11:52 am
by DavidBrown
Excellent advice there, Dave. The Sketchup warehouse is a godsend for those of us creating real life routes (I've already got a few assets on the DLS) but like you say that poly count is always something to keep a very close eye on. One I have been looking at recently is Exeter's St James' Park stadium - there's a couple of pretty good models on there, but they currently come in at over 100,000 polys - work is definitely needed!!

Re: Converting Sketchup models to Trainz

Posted: Sun Jun 16, 2013 12:27 pm
by bird_d00
Sadly it isn't just the polycount that can be a crippler for Trainz. The other one to keep an eye out for is the number of textures, which is absolutely ridiculous for some of the models. The model of Fulham bridge shown above had 18 textures (which is low for a Sketchup model), but many of them were identical. Not a problem for Sketchup, but loading all those seperate textures can be a big problem in Trainz. Even some of the simpler models can have something like 60 textures.

There is also a lot of dross in the warehouse - I have downloaded most of the London Underground related stuff, and sad to say most of it isn't even worth the effort of converting. There is some nice stuff , but that generally is the ones with high poly and texture counts, and they need a good deal of effort. The Croydon Tramlink model looks very nice, and I was tempted, thinking it would be simple , but it's 70,000 polys and thats without an interior - ouch.

Dave Bird

Re: Converting Sketchup models to Trainz

Posted: Mon Jun 17, 2013 8:20 am
by bird_d00
A quick postscript, for those who download models that have lots of texture names that get truncated by the conversion. It isn't always obvious which filename is which (would you guess that "TE4883~1.PNG" refers to "texture_56.PNG"). The following method should allow you to decipher the names :

Firstly in ModelConverterX when you convert your textures, use the exact same name as the source. So if the source texture was Texture_5.JPG make sure that you have the JPG file type selected. Now convert your texture files as normal.

You should now open a DOS window (I believe it's called "command prompt" now), on Windows XP it's found at START\All Programs\Accessories\Command Prompt - the Icon is a black square with "C:\" in it. You should then navigate to where you stored your texture files using the "cd" command, for example "cd MyDocuments\Sketchup\Arnos Grove". Now type the command "dir /x" and it will list all the real filenames with their shortened equivalents. Type "Exit" when you're finished to close the window.

Hope that is of some help. These stupid names caused me a good deal of grief yesterday until I remembered this trick.

Dave Bird

Re: Converting Sketchup models to Trainz

Posted: Sun Jun 23, 2013 8:52 am
by bird_d00
And some more further comments.

It seems there is a bug in the file renaming by ModelConverterX. For simple models with few textures it works fine, but if there are many textures it can get confused. After you have gotten your model into Gmax, if you followed the above advice and then open Material Navigator you will see it picks up most of the textures, but be very suspicous of any starting "TEXTUR~" it tends to assign these the wrong textures, and normally an equal number of textures will have a totally bogus filename, and so appear blank.

PLAIN COLOURS without a texture at all. Plenty of these in most models. I have found that Gmax will export these to Trainz if you add a "Unwrap UVW" to the mesh in question, and it seems that the correct "m.notex" material is used. They display fine in PEVs mesh viewer, but TRS2004 and TRS2006 render these as plain white. Can someone with a later version of Trainz please try this and let me know whether they display correctly in their version. Please see the screenshots below :

As rendered in Mesh Viewer :
Image

As displayed in Trainz - note tyres
Image

Dave Bird

Re: Converting Sketchup models to Trainz

Posted: Mon Oct 07, 2013 7:29 am
by bird_d00
Can people (presumably admins) please stop moving and retitling posts. As the search function (apparently) does not work at all this just means that not even the original author knows where his own posts are.

Dave Bird

Re: Converting Sketchup models to Trainz

Posted: Mon Oct 07, 2013 8:32 am
by glbotu
Can this get stickied? It's pretty useful info.

Re: Converting Sketchup models to Trainz

Posted: Mon Oct 07, 2013 9:01 am
by bird_d00
I was actually contemplating deleting the whole damned topic in anoyance at it having gone missing. An expanded and tidied version of this is being written up for my website as we speak.

And no-one has yet come back with an answer on whether the plain materials show in later versions of Trainz using the method shown.

Dave Bird

Re: Converting Sketchup models to Trainz

Posted: Mon Oct 07, 2013 9:31 am
by Class172
bird_d00 wrote:Can people (presumably admins) please stop moving and retitling posts. As the search function (apparently) does not work at all this just means that not even the original author knows where his own posts are.

Dave Bird
Sorry, that was me. :oops: I moved it here (though never renamed it) as its more likely to be seen by people — let us know when your new thread is ready and I'll sticky it if you wish.

Re: Converting Sketchup models to Trainz

Posted: Mon Oct 07, 2013 10:07 am
by 73129
Ive stickied this as it is relevant help to the forum.

Re: Converting Sketchup models to Trainz

Posted: Mon Oct 07, 2013 5:08 pm
by clam1952
bird_d00 wrote:I was actually contemplating deleting the whole damned topic in anoyance at it having gone missing. An expanded and tidied version of this is being written up for my website as we speak.

And no-one has yet come back with an answer on whether the plain materials show in later versions of Trainz using the method shown.

Dave Bird
Looks like you need to adjust the specular and ambient and diffuse for the materials that are showing whiteish, Pev's mesh viewer does not use the specular values. Not sure which exporter you are using for Gmax however if it is the one for max 4 / 5 try Ambient and diffuse White and specular black. If its still showing white back of slightly on the ambient and diffuse, you need to test in game as mesh viewer and CCP won't show the specular changes. If however you are using the standard TACs exporter, that doesn't handle specular settings, in which case try darkening the textures of the affected bits, again check in game not with a viewer.

Re: Converting Sketchup models to Trainz

Posted: Mon Oct 07, 2013 5:39 pm
by bird_d00
Looks like you need to adjust the specular and ambient and diffuse for the materials that are showing whiteish, Pev's mesh viewer does not use the specular values. Not sure which exporter you are using for Gmax however if it is the one for max 4 / 5 try Ambient and diffuse White and specular black. If its still showing white back of slightly on the ambient and diffuse, you need to test in game as mesh viewer and CCP won't show the specular changes. If however you are using the standard TACs exporter, that doesn't handle specular settings, in which case try darkening the textures of the affected bits, again check in game not with a viewer.
Please read the post properly. TRS2004 & 2006 CANNOT handle m.notex. The ambient, diffuse and specular settings are all black 0,0,0 and still these show as white in Trainz. PEV's text viewer may not handle specular settings but there are plenty of others that do and I did check with these before posting as I am well aware of the deficiences in that program - it's just Ithat happened to use that one for a screenshot as an example. The question was whether the later versions of Trainz have been altered to fix this problem.

Dave Bird