ConvertingMSTS Models
One of the implications of adding support for indexed triangles is that it is now much easier to convert msts models for use in Rail3D. This has been demonstrated with a prototype conversion utility and the results are very usable:
- Model conversion is very quick and automated.
- Textures need to be converted by hand using (eg) the tgatool
- Some post conversion work is required, particularly:
- Items such as wheels and bogies need to be converted to the R3D syntax.
- The order of some components needs adjustment to resolve tga transparancy issues.
- Some R3D parameters - eg Physics parameters - sometimes need to be entered.
Version 1.3
Version 1.3 is now available and has a number of enhancements, including:
- Now understands model component hierarchy and outputs sub-components in correct place
- Now automatically converts ace textures to tga (thanks to Martin Wright for conversion dll)
- Improved work around can cope with ffedit’s problems with spaces in folder names
- Corrected some spelling errors
- Can now specify output directory
- Source and output directory remembered
The Rail3D development team entirely respects the right of msts authors to preserve copyright in their work and will not condone conversion of msts models without the original author’s permission. For this reason, we do not publish the conversion tool, but msts model makers who are interested in converting their models are invited to contact the author mark@rail3d.net
Converting a model
If you are the creater of models for msts and would like to convert them for Rail3D please follow the steps below. Note that if your model started life in 3DCanvas it may be better to use Mark Hodson’s 3DCanvas plugin: Building Rail3D Models In3D Canvas : If you do not have 3DCanvas, or you just want to convert the msts model files, this is the way to do it with the direct convertor.
There is a problem with the ffedit decompression tool: it appears not to like folder paths with spaces in them. An updated version of the Rail3D to msts conversion tool (build no 1.0.0.2) has been produced to cope with this problem.
- You will need:
- The msts to Rail3D conversion tool. (Latest version)
- The msts model files (S file, eng or wag file, textures)
- Permission from the model creator to convert the model and distribute the converted result
- Martin Wright’s texture conversion dll mwace.dll. This can be downloaded from http://fly.to/mwgfxConvertingMSTS Models
- The ffedit decompression tool: this comes with msts and can be found on the msts source discs - it is usually installed with msts and will be in a sub-folder of the msts directory.
- Folder structure: it is a good idea to create a working folder for the conversion process and install the conversion tool in that folder. Copy the ffedit folder (and all it’s contents) from the msts folder into this folder. See example: (I have also copied the folder for the model I am going to work on from the msts folders)
- Open the conversion tool:
- Click the browse button and browse to the model file, you can choose to open a shape file .S or a model file .eng/.wag
- If you open the .S file, the program will convert the model shape only
- if you open the .eng/.wag the file, the program will also convert some of the parameters of the model, eg max speed, power, weight, length etc and this will save you quite a lot of work. This is recommended.
- Open the .eng file in the convertor. The convertor reads the file and extracts some information.
- Notice how the convertor has read the .eng file and identified the correct .S file from the eng file, it has also read the length of the model (And a few other things) from the eng file.
- Click the browse button and specify the output directory for the resulting conversion.
- The convertor needs an ascii format .S file to work on: if your .S file is in binary it needs to be decompressed before it can be converted. The convertor will detect if this is the case and enable the “Decompress” button: click the decompress button and wait until the decompression process (using ffedit) is complete.
- The decompression will fail if the ffedit folder is not correctly located as a sub-folder.
- The conversion cannot continue until the decompression is successful.
- Once you have a decompressed file, click “Convert”: the program runs through the model and generates a Rail3d stock file and (v 1.3) converts the ace texture files to tga.
- Close the convertor.
- You should now have a new .stk file. Copy this and any converted textures (tga) to your Rail3D stock library (unless you specifed a Rail3D stock folder as the output folder), open the stock editor and rebuild the index.
- You should now find the new model in your Rail3D library.
(nb v1 shot, v1.3 convertor will convert the textures as well)
- Open the model in the editor (it will take a while for the editor to parse and open the file).
- Notice how the convertor has extracted information such as power and weight from the msts .eng file and has listed the textured used.
- Textures should be converted automatically (v1.3). If not, use the tgatool to convert the missing textures to tga format (keep the names the same) and copy these textures to the Rail3D folder:
Post Conversion steps
It is likely that you will need to edit the Rail3D model after conversion:
- You may wish to modify the parameters such as Power and Weight, and add other Rail3d stock parameters.
- Animated components such as pantographs, bogies, doors and wheels will need to be converted to the Rail3D format.
- Some sub-components may be displaced.
See also, Tweaking ConvertedMSTS Models
Transparancy issues
Because of the way DirectX handles alpha channel transparency, you will often find that transparency of sub-components does not work well and objects behind the transparent component do not show properly.
This is usually fairly easily rectified by identifying the masking component (ie by commenting out the include statements in the model until the problem component is identified) and moving it up the list of included components so that it comes before other sub-components. Some trial and error may be required to get the order right.
This is fixed in build 101.2 and later of Rail3D
Bogies are usually fairly easy to fix. Simply identify the bogie sub-component and change the include statement to a bogie statement (again the easiest way to identify the bogie is to comment out the include statements one at a time to identify which component is which).
So, the conversion of the R class tram above produced this:
Assembly
rclass2.ace
interior
include 0/6865/0 rclass.0.3 pantographbottom1
include −12/10233/422 rclass.0.1 bogie1
which was then edited like this:
Assembly
rclass2.ace
interior
include 0/6865/0 rclass.0.3 pantographbottom1
bogie −12/10233/422 rclass.0.1 bogie1
Note You must also add a wheelbase
term to the bogie sub-component, otherwise it will not align to the track properly.
Wheels
Wheels tend to come out in the wrong place and as a static object, they need to be moved in position and converted to wheels.
As converted the R class tram came out like this:
-
ie, the wheels are centered on the main body.
There are also four sub-components (one for each axle) in the msts conversion:
include −3/7653/−97 rclass.0.5 wheels22
include −3/6048/−99 rclass.0.7 wheels11
and we only need one, which we can re-use four times.
To correct this:
- The wheel components are commented out of the main (top-level) component.
- The wheel (rather axle) components are added to the bogie sub-components using Rail3D wheel syntax:
wheel 0/900/−97 100/0 rclass.0.6 wheels22
- Note that we only need one of the four identical components and we can re-use it
- The position of the wheel (Axle) components is adjusted to fit in the right place.
Re-use of components
As noted above, Rail3d can re-use sub-components where are msts seems to need each item as a seperate sub-component. Removing duplicate sub-components (as for the wheels above) reduces file size and makes the model more efficient.
Doors
If the model has seperate doors, these can be animated using the Rail3d door syntax.
Pantographs
Pantographs (etc) need similar modification to the new Rail3d pantograph syntax (see New Pan Code). This is usually easiest achieved by introducing a new sub-component to hold the pantograph components.
Power parameters, etc
if you start from a .eng file, the convertor will attempt to extract power (etc) data from the file. Whilst this is a helpful start, you will probably need to check and modify these paramters (esp steam locos). Don’t be surprised if a loco does not move on first convesion, but check parameters like cylidner size, boiler pressure etc.
The Convertor
The convertor tool is a bit rough and ready and was built as a simple front end on the conversion process, just to prove the principle of conversion. There are lots of aspects that could be improved if and when I get the time and inclination:
The decompress button ought to wait for the process to complete: this is not hard to code, I just haven’t got round to it as yet fixed in v1.3
If someone could explain to me the heirarchy of the components in the model file I might be able to get the convertor to put the sub-components in the right place and get wheels to come out as wheels fixed (I think) in v1.3 if anyone has models that don’t convert properly, please let me know.
I’d love to know how to convert ace gaphics files to tga progamatically so that this could be automated. Fixed in v1.3, with use of Martin Wright’s conversion dll, with thanks to Martin.
And Finally
Last - definitely not least! Please publish your model: we really appreciate getting more good models for Rail3D. You can publish your model in a variety of ways
- Send it in for the main Rail3D library (send it to Mark@rail3d.net)
- Share it with other users through the Rail3D Yahoo group
- Put it on your own website
import