User Tools

Site Tools

Urban Games

modding:modeleditor

Model Editor

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.

Configuration

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
function 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.

User Interface

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.

Model Loading

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.

Model Rendering

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:

  • M for the model with the materials as it looks in the game.
  • S for the model in plain white.
  • W for the model as a wire mesh.

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.

Model Animations

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.

Model Properties

In the fourth group 4, there are some buttons that open additional windows for model, metadata and material details.

Model Tree

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.

Metadata Editor

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.

Material Editor

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.

Options

The options window can be opened by a click on the OPTIONS button in the top right.

Overview

The OVERVIEW tab provides several general options:

  • Enable Auto Update decides whether the model should be reloaded whenever one of the source files changes. Be aware that unsaved changes to the model are lost if the model is reloaded. If you encounter black textures or crashes while exporting textures from your graphic program, this might be caused by the Model Editor reloading the texture files before they are completely written by the program. In this case, deactivate the auto update feature before exporting the textures.
  • Render Axes renders the three axis that meet at the origin in the 3D space. These mark the global positive directions of the x (red), y (green) and z (blue) dimension.
  • Render Debug Info renders the hierarchy of nodes in the model node tree as well as their individual orientation.
  • Render Normals renders the normals of vertices.
  • Render Tangents renders the tangents of vertices.
  • Render Bounding Box renders the bounding box as it is specified in the .mdl file. Models without bounding box may not load in the Model Editor.
  • Enable SSAO enables the smooth ambient occlusion that is computed by the engine.
  • Enable Shadows enables shadows that are computed depending on the direction of the sun.
  • Enable HDR enables the higher dynamic lighting range.
  • Speed scale is the speed factor that is used for animations. The default value 10 is the normal game speed.

Environment

The ENVIRONMENT tab provides several environment related options:

  • Render Environment activates a gay ground face at height 0 and a simple blue skybox as the background. If set to false, there is no ground face.
  • FOV is a dropdown that lets you chose the field of view. The larger the chosen value is, the wider is the camera angle.
  • Environment is another dropdown. You can choose the environment that should be used in the model editor.
  • Background can be used to set the rgb values for the background color that should be used when the environment is not rendered (see above). The values can be in a range between 0 and 255.

Config

The CONFIG tab provides options to test various features of vehicles:

  • _ref_obj.mdl is a placeholder for a model reference relative to the 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.
  • Color lets you choose a color for models that have color blending materials in use. Please note that the rendered colors on vehicles are less saturated than the ones in the gui.
  • Age is a slider that can be used to simulate the aging of the vehicle. Depending on the age, the dirt and rust layers have different intensities.
  • Render Seat Locators renders small indicators at the positions of defined passenger seats.
  • Render Cargo Slot Locators renders small indicators at the positions of defined cargo slots.
  • Render Cargo Bay BBox renders the bounding boxes of defined cargo bays.
  • Passengers is a slider that lets you choose the amount of passengers that should be displayed.
  • Cargo indicators is a list of compartments where you can select the cargo type that should be used as well as the amount that can be adjusted with the slider below.
  • Random Seed is a spinner that can be used to select a seed for the randomisation of cargo slots and configurations.
  • Render Label Outlines enables small markers and rectangles where text labels are placed in the model. The text boxes below can be used to define some demo texts to test the display. Be aware that custom labels currently are not compatible to the Model Editor and will likely lead to a crash.
  • Render Particle Systems renders small indicators where particle emitters are located.
  • Render Water Line renders a line that indicates the position of the water line definition of ships.

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:

  • GUI ICONS()</span> will generate the ui icons for all vehicle models in the mod. * WEBSITE(!!) will generate the other renderings for all vehicle models in the mod. 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. ==== Viewport Controls ==== The camera in the model viewer is controlled with the mouse: * Scroll the mouse wheel to zoom in and out. * Press the left mouse button to rotate around the center of the viewport. * Press the right mouse button to move the camera sideways or up and down. To rotate the direction from where the sun shines, press CTRL and the left mouse button while moving the mouse. ===== FBX Import ===== 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. ==== 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.


modding/modeleditor.1594884682.txt.gz · Last modified: 2020/07/16 09:31 by kjell