The Model Editor is an assisting tool that can be used to import, view and test models.
The tool allows playing animations, changing the age (dirt and rust overlay) and the color of a vehicle as well as showing different label configurations. Also, passenger seats and cargo loads can be tested.
The Model Editor also includes an option to create screenshots and GUI icons.
The model editor ships with the game itself. To function properly, it is required to put a model_editor_settings.lua
file into:
%APPDATA%/Transport Fever 2/
for Windows~/.local/share/Transport Fever 2
for Linux/Users/<username>/Library/Application Support/Transport Fever 2/
for MacOS (Steam/GOG/Epic)/Users/<username>/Library/Containers/com.gambitious.transportfever2/Data/Library/Application Support/Transport Fever 2/
for MacOS (App Store)function data() return { importFbxPath = "C:/Users/<Name>/AppData/Roaming/Transport Fever 2/fbx_import/", installPath = "", userDataPath = "D:/Steam/userdata/<steamID>/1066780/local/", } end
It contains several references to directories:
importFbxPath
is the directory from where the .fbx
files can be imported.installPath
usually is left empty as the Model Editor executable is in the install directory of Transport Fever 2.userDataPath
is the directory where the userData is located. It is used to find the staging area and screenshot folders. You can find your userdata folder over the game's main menu > SETTINGS > ADVANCED > OPEN USERDATA FOLDER. Only use forward slashes / in the path, otherwise the model editor may not start properly. The locations may vary from the exemplaric paths above.
To start the Model Editor, execute the ModelEditor.bat
in the installation directory of Transport Fever 2 on Windows, ModelEditor.sh
in the installation directory of Linux or ModelEditor.command
in the installation directory of MacOS. This will open two windows, a console window with debug output and the actual user interface window. It has a toolbar at the top and the viewport where the models are rendered below.
The toolbar is split into 5 different groups of interactive elements:
1 dropdowns and buttons to select mods and models and save them
2 model rendering options
3 animation trigger
4 detail windows and validation
5 options and screenshots
As long as no mod is selected and no model is loaded, most buttons are deactivated.
To select a mod, click on the dropdown in the top left corner of the first group 1. There you can select all mods that are located in the staging_area
folder that lays within the userDataPath
specified above.
After a mod was selected, you may use the OPEN button to select the model that should be loaded. The list corresponds to the folder structure within the model/
folder in the mod. To import .fbx
files or open models of the base game, use the IMPORT button.
To close a model without saving, use the CLOSE button.
If you want to save a model, use the SAVE button. It will save the currently loaded model to the mod that is selected in the dropdown above. Please be aware that there is no extra confirmation in case you overwrite existing files. To only save certain file types, you may deselect the options provided in the dropdown next to the save button:
The model rendering in the viewport can be influenced by the second group of buttons in the toolbar 2. The three one letter buttons are:
The Lod spinner below can be used to select the level of detail that should be shown. With -1
the used level of detail depends on the zoom level like in the game. 0
and above select specific levels of detail independend of the zoom level.
The Color config spinner is used only for car model that have a color configuration. It allows to cycle through all defined configurations.
The third button group 3 is relevant for animations. If the model has any animation, it can be selected in the dropdown. Then it can be started with the PLAY button. To loop the animation, activate the LOOP toggle next to it.
In the fourth group 4, there are some buttons that open additional windows for model, metadata and material details.
A click on the MODEL button opens the model window.
It has a tab for each level of detail 1. Below is a tree that shows the node hierarchy of the model with the file references and names if the nodes have names. If you activate a checkbox on the left 2, the node will be highlighted in the viewport. This helps with identifying model parts. To find out the id of a node to use it in some metadata, you can have a look on the numbers in the column next to the checkboxes 3. If you want to manually transform a mesh, e.g. to correct its position, you can open a popup with transformation parameters by clicking on the right buttons 4.
To access the metadata editor, press the METADATA button. It presents all the data that is set in the metadata
block of a model 1.
To add new properties, you can press on the button in the top right corner 2. There you can select new property types and add them to the metadata of the currently loaded model. To delete all metadata, use Delete all. If you want to reset to the initial loaded values, press Reset.
The properties are collapsed by default. Press the arrow markers on the left to unfold the hierarchy levels of properties. To unfold the complete hierarchy inside of a property, you can click on the button on the right 3.
To reset a single property or only a value of the property, you can use the arrow on the right side 4. To completely remove it, press the button instead 5.
Some properties contain lists, e.g. the labels. You can add a new entry by clicking on button 6. If you want to add a duplicate of an existing list element, use the button next to it 7.
To check if there are major issues with the configured metadata, you can use the VALIDATE button in the top bar. It will run a check and informs you as soon as it finds an issue. Run it again after you fixed the issue to check if there are further issues.
Currently the following issues are covered by the validation tool:
railVehicle/configs: number of entries does not match number of LODs | A rail vehicle has less or more config blocks than LODs in the model. |
---|---|
railVehicle/configs/axles: mesh '<name>' does not exist | Has configured axle meshes which are not actually in the configured LOD. This often is either a copy paste error or a typo. |
railVehicle/configs/fakeBogies: fakeBogie group '<number>' is out of bounds (max group size: <number>, lod: <number>). | A fake bogie is configured with out of bound indices. |
roadVehicle/configs: number of entries does not match number of LODs | A road vehicle has less or more config blocks than LODs in the model. |
roadVehicle/configs/axles: mesh '<name>' does not exist | Has configured axle meshes which are not actually in the configured LOD. This often is either a copy paste error or a typo. |
roadVehicle/configs/wheels: mesh '<name>' does not exist | Has configured wheel meshes which are not actually in the configured LOD. This often is either a copy paste error or a typo. |
roadVehicle/configs/fakeBogies: fakeBogie group '<number>' is out of bounds (max group size: <number>, lod: <number>). | A fake bogie is configured with out of bound indices. |
airVehicle/configs: number of entries does not match number of LODs | A plane has less or more config blocks than LODs in the model. |
airVehicle/configs/axles: missing entry | No axle is configured. |
airVehicle/configs/axles: mesh '<name>' does not exist | Has configured axle meshes which are not actually in the configured LOD. This often is either a copy paste error or a typo. |
airVehicle/configs/wheels: missing entry | No wheel is configured. |
airVehicle/configs/wheels: mesh '<name>' does not exist | Has configured wheel meshes which are not actually in the configured LOD. This often is either a copy paste error or a typo. |
airVehicle/configs: invalid landing gear configuration; zero distance between main and front/back gear | The configured wheels and axles are in the same spot. |
airVehicle/configs: invalid landing gear configuration; aircraft's initial pitch on ground is below <number> deg | The plane gear results in a too low pitch on the ground. |
airVehicle/configs: invalid landing gear configuration; aircraft's initial pitch on ground is above <number> deg | The plane gear results in a too high pitch on the ground. |
transportNetworkProvider/laneLists: list <number> node <number> ends at its start position | The described node results in a lane with length 0. |
transportNetworkProvider/laneLists: list <number> node <number> connects the same nodes as list <number> node <number> | There is a duplicate lane in the transport network provider. |
transportVehicle/capacities: cargo type <name> not valid | The specified cargo type is not existing. Be aware that the cargo type may be part of another mod that is not seen by the Model Editor. |
transportVehicle/loadConfigs: list of load configs must not be empty | Either there is no loadConfigs block or it mustn't be empty. |
The MATERIALS button leads you to the materials editor. It provides access to all material files that are used in the model 1.
The type of a material can be converted to any other material type by pressing the button on the right side 2. There you can reset a material file to the initially loaded values too by clicking Reset.
Below is a list of all material properties depending on the material type 3. To unfold properties, you can press the button and to reset a single property, you can click on the arrow on the right side.
You can edit the properties in a similar way as the properties in the metadata editor. Please be aware that some texture related properties are critical and might result in a crash when set to a wrong value, e.g. the compresssion or Red-green properties.
To change file references, click on the …
on the right side of the reference. Then you can browse through available texture files and choose the right one.
The options window can be opened by a click on the OPTIONS button in the top right. It contains several tabs with different settings. All settings are persisted and loaded when the model editor is opened. Most of the tabs have a RESET TO DEFAULT button to revert them to their default values.
The OVERVIEW tab provides several general options:
.mdl
file..mdl
file..mdl
file. Models without bounding box may not load in the Model Editor. 10
is the normal game speed.
The ENVIRONMENT tab provides several environment related options:
false
, no ground face is shown.
The CONFIG tab provides options to test various features of vehicles:
model/
directory in the currently loaded mod or base game. If a model is referenced, it is visible as static asset. It won't be used in the screenshots. Click on the … and navigate through the file picker to select a model. With the button you can transform the reference model and with the SHOW button you can toggle its visibility.
To generate vehicle icons and take representative screenshots of the vehicle models, you can use the SCREENSHOT button on the right side of the top bar. This will generate the neccessary ui icons and moves them at the correct position in the mod. Additionally, larger renderings from all sides as well as a perspective view will be generated and saved in the screenshots/
folder in the specified userDataPath
.
The ICONS tab provides options for the creation of ui icons and other screenshots:
.tga
format, while .png
might be useful for websites.Keep in mind that this may take a long time depending on the number of models in the mod and the hardware of the computer.
Currently, it is not possible to generate screenshots of models other than vehicles with the bulk generator.
The GRAPHICS tab provides the possibility to adjust the major graphics settings for the model editor display:
In order for changed graphic settings to take effect, the Model Editor needs to be restarted.
The camera in the model viewer is controlled with the mouse:
To rotate the direction from where the sun shines, press CTRL and the left mouse button while moving the mouse.
The Model Editor supports the import of .fbx
files. However it is likely that not all .fbx
files can be imported without problems as software from different vendors may have some differences in their .fbx
file exporters. So far, the best results were received with files from Modo. See the information about external tools to find out more about the available modelling software.
To import a single file, drag and drop it into the model editor window. To import multiple files at once, do the same with a folder. Alternatively you may select an .fbx
file from the IMPORT button menu.
Each .fbx
file may contain the 3D model of one level of detail. To import several files together in a model, they should be placed in a folder. The name of the folder will be used to determine the subfolder of res/models/model/
where the model should be located, use hyphens to define the folder hierarchy: <folder>-<folder>-<mdlname>/
. If $
is used, it will be replaced by the mod path.
The .fbx
files for the different levels of detail are distinguished by the _lodX.fbx
ending, where X=0 is mandatory and higher levels of detail are optional.
The names of nodes are structured as following:
[#]<elementname>[|<metadatatype>][#<comment>]
If the first character in the name is a #
, then the whole element and all its children are ignored for export. It can be used to comment out elements
This is the name of the element that is used for the mesh by default. The element name may not contain |
, %
or #
! Usually, the element names consist of lowercase words seperated with _
.
By default, the meshes are located relative to models/mesh/<Model-Path>/
. If the node should reference a shared mesh from elsewhere, the element name uses a path with '/' relative to the models root directory, e.g.: /vehicle/train/twindexx_front/front_b2
. If the importer can find the mesh at this specified location, it will only be referenced, otherwise the mesh at that position in the folder hierarchy will be generated.
Elements used for the specification of metadata information start with a |
character followed by the key of the metadata type. Recognized types are:
bounding_box
label
emitter_smoke
seat_<anim>
seat_crew_<anim>
A mesh named with |bounding_box
will be used to define the size of the bounding box for the model. The mesh itself will be removed on import, it’s bounding box will be used for the whole model though.
A label is defined by two locators with |label
of which one is the child of the other. The parent defines the bottom left corner, the offset to the nested child at the top right corner defines the size of the label. They
A locator with |emitter_smoke
is used to define the smoke emitter position and rotation. The scale along z axis sets the velocity.
A locator with |seat_<anim>
or |seat_crew_<anim>
is used to define the position, rotation and scaling of **seat** positions. <anim>
needs to be replaced by the name of the character animation. If there are meshes attached to the node, they will be removed and not be present in the imported model.
If there is a #
not at the first position of the name, then everything behind it is ignored.
middle_interior middle_interior#borrowed_from_middle
will both create a node with mesh “…/middle_interior_lodX.msh” and name “middle_interior”.
#middle_interior #middle_interior#borrowed_from_middle
will both be ignored.
front_driver_seat|seat_crew_driving_upright
will be converted to a seat locator for the driver.
cylinder_steam|emitter_smoke#left_cylinder
will be converted to a smoke emitter.
If the name of the material starts with a /
, the path is evaluated as absolute. Otherwise, the materials are located relative to models/material/<Model-Path>/
.
The material types that should be used by the importer are determined based on the material names and texture files. The material name ending _transparent
forces the use of a transparent file type.
Depending on the provided texture names, the exact material type will be chosen:
_albedo.dds
will use a non transparent material_albedo_opacity.dds
will use a transparent material (this requires an alpha channel in the texture)_metal_gloss_ao.dds
will use a physical based material_normal.dds
will use a material with a normal map_cblend_dirt_rust.dds
will use a material with dirt and rust blending
To reference existing materials, use absolute paths starting with /
like /street/new_medium_tram_track
. If the importer can find the material at this specified location, it will only be referenced, otherwise the material at that position in the folder hierarchy will be generated with the assigned textures.
Imported models will generate .ani
files from the key frames that are defined in the first level of detail. Animations defined in other levels of detail are ignored. The names of animations in the .fbx
file are used to determine where the .ani
files should be located:
man/walk
will result in .ani
files in models/animation/MODEL_PATH/man/walk/
/man/walk
will result in .ani
files in models/animation/man/walk/
walk
will result in .ani
files in models/animation/MODEL_PATH/walk/head.ani
To test the import of .fbx
files, you can download an example in binary and non-binary version.