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 Linuxfunction data() return { importFbxPath = "C:/Users/<Name>/AppData/Roaming/Transport Fever 2/fbx_import/", installPath = "", userDataPath = "D:/Steam/userdata/162364699/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.
To start the Model Editor, execute the ModelEditor.bat
in the installation directory of Transport Fever 2 on Windows or ModelEditor.sh
in the installation directory of Linux. 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
2 model rendering options
3 animation trigger
4 detail windows and screenshots
5 options
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.
Independent of where the model was loaded or imported from, a click on SAVE will save the currently loaded model to the mod that is selected in the dropdown above. To close a model without saving, use the CLOSE 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.
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 icon in the top right corner. There you can add new property types to the metadata of the currently loaded vehicle. 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 icon on the right.
To reset a single property or only a value of the property, you can use the arrow on the right side.
Some properties contain lists, e.g. the labels. You can add a new entry by clicking on button.
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.
The OVERVIEW tab provides several general options:
.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
, there is no ground face.
The CONFIG tab provides options to test various features of vehicles:
model/
directory in the currently loaded mod. If a model is referenced, it is visible as static asset. It won't be used in the screenshots.
To generate vehicle icons and take representative screenshots of the vehicle models, you can use the SCREENSHOT button in the fourth button group. 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
.
To generate icons or screenshots for all models of a mod, you can use the buttons in OPTIONS > ICONS:
.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.
==== Filenames ====
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>-<folder>/
. 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.
==== Meshes ====
If the name of the mesh starts with a /
, the path is evaluated as absolute. Otherwise, the meshes are located relative to models/mesh/<Model-Path>/
.
If a name contains the #
character, everything behind it will not be used for the mesh names.
If the name contains #ignore
, the mesh will be ignored and not imported.
To reference existing meshes, use absolute paths starting with /
like /vehicle/bus/volvo_5000/w1
. 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.
==== Materials ====
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
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.
==== Animations ====
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
==== Misc ====
It is possible to predefine particle emitters by adding emitter_<number>
items. The position, rotation and scale (used for velocity) will be imported.
To predefine seats, items with seat_
can be imported as part of an .fbx
file. The position and rotation info is used. To mark a seat as a crew position, crew_
should be used.
To test the import of .fbx
files, you can download an example in binary and non-binary version.