User Tools

Site Tools

Urban Games

modding:modeleditor

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
modding:modeleditor [2020/07/16 09:31]
kjell [Configuration]
modding:modeleditor [2023/08/30 18:31] (current)
yoshi [Configuration]
Line 11: Line 11:
   * ''%APPDATA%/Transport Fever 2/'' for Windows   * ''%APPDATA%/Transport Fever 2/'' for Windows
   * ''~/.local/share/Transport Fever 2'' for Linux   * ''~/.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)
  
 <code lua> <code lua>
Line 24: Line 26:
   * ''importFbxPath'' is the directory from where the ''.fbx'' files can be imported.   * ''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.   * ''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.+  * ''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. 
  
 +<div important 100%>
 +Only use forward slashes / in the path, otherwise the model editor may not start properly. The locations may vary from the exemplaric paths above.
 +</div>
 ===== User Interface ===== ===== 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.+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.
  
 {{:modding:modeleditor:toolbar.png?nolink|}} {{:modding:modeleditor:toolbar.png?nolink|}}
Line 34: Line 39:
 The toolbar is split into 5 different groups of interactive elements: The toolbar is split into 5 different groups of interactive elements:
 <div indent> <div indent>
-<span label>1</span> dropdowns and buttons to select mods and models\\+<span label>1</span> dropdowns and buttons to select mods and models and save them\\
 <span label>2</span> model rendering options\\ <span label>2</span> model rendering options\\
 <span label>3</span> animation trigger\\ <span label>3</span> animation trigger\\
-<span label>4</span> detail windows and screenshots\\ +<span label>4</span> detail windows and validation\\ 
-<span label>5</span> options\\+<span label>5</span> options and screenshots\\
 </div> </div>
 As long as no mod is selected and no model is loaded, most buttons are deactivated. As long as no mod is selected and no model is loaded, most buttons are deactivated.
  
-==== Model Loading ====+==== Model Loading and Saving ====
 To select a mod, click on the dropdown in the top left corner of the first group <span label>1</span>. There you can select all mods that are located in the ''staging_area'' folder that lays within the ''userDataPath'' specified above. To select a mod, click on the dropdown in the top left corner of the first group <span label>1</span>. 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 <span btn>OPEN</span> 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 <span btn>IMPORT</span> button. After a mod was selected, you may use the <span btn>OPEN</span> 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 <span btn>IMPORT</span> button.
  
-Independent of where the model was loaded or imported from, a click on <span btn>SAVE</span> will save the currently loaded model to the mod that is selected in the dropdown above. To close a model without saving, use the <span btn>CLOSE</span> button.+To close a model without saving, use the <span btn>CLOSE</span> button.
  
 +If you want to save a model, use the <span btn>SAVE</span> 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:
 +  * <span btn>MODEL</span> will save the .mdl file
 +  * <span btn>MESH</span> will save the .msh and .msh.blob files if they were just imported from fbx.
 +  * <span btn>MATERIAL</span> will save the .mtl files
 +  * <span btn>ANIMATION</span> will save the .ani files if they were just imported from fbx.
 ==== Model Rendering ==== ==== Model Rendering ====
 The model rendering in the viewport can be influenced by the second group of buttons in the toolbar <span label>2</span>. The three one letter buttons are: The model rendering in the viewport can be influenced by the second group of buttons in the toolbar <span label>2</span>. The three one letter buttons are:
Line 71: Line 81:
 A click on the <span btn>MODEL</span> button opens the model window.  A click on the <span btn>MODEL</span> button opens the model window. 
  
-It has a tab for each level of detail <span label>1</span>. 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 <span label>2</span>, 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 <span label>3</span>.+It has a tab for each level of detail <span label>1</span>. 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 <span label>2</span>, 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 <span label>3</span>. 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 <span label>4</span>.
  
 === Metadata Editor === === Metadata Editor ===
Line 79: Line 89:
 To access the metadata editor, press the <span btn>METADATA</span> button. It presents all the data that is set in the ''metadata'' block of a model <span label>1</span>. To access the metadata editor, press the <span btn>METADATA</span> button. It presents all the data that is set in the ''metadata'' block of a model <span label>1</span>.
  
-To add new properties, you can press on the {{:gamemanual:interface:buttons:settings.png?nolink&20|}} 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**. +To add new properties, you can press on the {{:gamemanual:interface:buttons:settings.png?nolink&20|}} button in the top right corner <span label>2</span>. 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 {{:gamemanual:interface:buttons:filter_visible.png?nolink&20|}} icon on the right.+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 {{:gamemanual:interface:buttons:filter_visible.png?nolink&20|}} button on the right <span label>3</span>.
  
-To reset a single property or only a value of the property, you can use the {{:gamemanual:interface:buttons:turn.png?nolink&20|}} arrow on the right side.+To reset a single property or only a value of the property, you can use the {{:gamemanual:interface:buttons:turn.png?nolink&20|}} arrow on the right side <span label>4</span>. To completely remove it, press the {{:gamemanual:interface:buttons:bin.png?nolink&20|}} button instead <span label>5</span>.
  
-Some properties contain lists, e.g. the labels. You can add a new entry by clicking on {{:gamemanual:interface:buttons:plus.png?nolink&20|}} button.+Some properties contain lists, e.g. the labels. You can add a new entry by clicking on {{:gamemanual:interface:buttons:plus.png?nolink&20|}} button <span label>6</span>If you want to add a duplicate of an existing list element, use the {{:gamemanual:interface:buttons:duplicate.png?nolink&20|}} button next to it <span label>7</span>.  
 + 
 +=== Metadata Validation === 
 +<div right 250px> 
 +{{:modding:modeleditor:validator.png?nolink&250|}} 
 +</div> 
 + 
 +To check if there are major issues with the configured metadata, you can use the <span btn>VALIDATE</span> 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. |
  
 === Material Editor === === Material Editor ===
Line 93: Line 132:
 The <span btn>MATERIALS</span> button leads you to the materials editor. It provides access to all material files that are used in the model <span label>1</span>. The <span btn>MATERIALS</span> button leads you to the materials editor. It provides access to all material files that are used in the model <span label>1</span>.
  
-The type of a material can be converted to any other material type by pressing the {{:gamemanual:interface:buttons:settings.png?nolink&20|}} button on the right side <span label>2</span>. There you can reset a material file to the initially loaded values too by clicking **Reset**.+The [[modding:resourcetypes:mtl#types|type of a material]] can be converted to any other material type by pressing the {{:gamemanual:interface:buttons:settings.png?nolink&20|}} button on the right side <span label>2</span>. 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 <span label>3</span>. Below is a list of all material properties depending on the material type <span label>3</span>.
Line 102: Line 141:
 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. 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 ==== ==== Options ====
-The options window can be opened by a click on the <span btn>OPTIONS</span> button in the top right. +The options window can be opened by a click on the <span btn>OPTIONS</span> 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 <span btn>RESET TO DEFAULT</span> button to revert them to their default values.
  
 === Overview === === Overview ===
Line 110: Line 149:
 The <span btn>OVERVIEW</span> tab provides several general options: The <span btn>OVERVIEW</span> 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.   * **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 Axes** renders the three orientation 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 Debug Info** renders the hierarchy of nodes in the model node tree as well as their individual orientation.
 +  * **Render Collider Info** renders the [[modding:resourcetypes:mdl#collider|collider shape]] as it is specified in the ''.mdl'' file.
 +  * **Render Transport Network Info** renders the [[modding:resourcetypes:mdl#transport_network_provider|nodes and lanes]] as they are specified in the transport network provider metadata in the ''.mdl'' file.
   * **Render Normals** renders the normals of vertices.   * **Render Normals** renders the normals of vertices.
   * **Render Tangents** renders the tangents 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. +  * **Render Bounding Box** renders the [[modding:resourcetypes:mdl#bounding_box|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 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 Shadows** enables shadows that are computed depending on the direction of the sun.
Line 125: Line 166:
 </div> </div>
 The <span btn>ENVIRONMENT</span> tab provides several environment related options: The <span btn>ENVIRONMENT</span> 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.+  * **Render Environment** activates a gray ground face at height 0 and a simple blue skybox as the background. If set to ''false'', no ground face is shown.
   * **FOV** is a dropdown that lets you chose the field of view. The larger the chosen value is, the wider is the camera angle.   * **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 [[modding:environments|environment]] that should be used in the model editor.   * **Environment** is another dropdown. You can choose the [[modding:environments|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.+  * **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). A colorpicker is opened on click to select the color by numbers, hex code or visually.
  
 === Config === === Config ===
Line 135: Line 176:
 </div> </div>
 The <span btn>CONFIG</span> tab provides options to test various features of vehicles: The <span btn>CONFIG</span> 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. +  * **_ref_obj.mdl** is a placeholder for a model reference relative to the ''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 <span btn>...</span> and navigate through the file picker to select a model. With the {{:gamemanual:interface:buttons:transform.png?nolink&20|}} button you can transform the reference model and with the <span btn>SHOW</span> button you can toggle its visibility
-  * **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. +  * **Color** lets you choose a color for models that have [[modding:resourcetypes:mtl#color_blending_dirt_rust|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. +  * **Age** is a slider that can be used to simulate the [[modding:resourcetypes:mtl#color_blending_dirt_rust|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 Seat Locators** renders small indicators at the positions of defined [[modding:vehiclebasics#seats1|passenger seats]]
-  * **Render Cargo Slot Locators** renders small indicators at the positions of defined cargo slots. +  * **Render Cargo Slot Locators** renders small indicators at the positions of defined [[modding:vehicleadvancedtopics#custom_cargo_models|cargo slots]]
-  * **Render Cargo Bay BBox** renders the bounding boxes of defined cargo bays.+  * **Render Cargo Bay BBox** renders the bounding boxes of defined [[modding:vehiclebasics#cargobay|cargo bays]].
   * **Passengers** is a slider that lets you choose the amount of passengers that should be displayed.   * **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.   * **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.
Line 146: Line 187:
   * **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 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 Particle Systems** renders small indicators where particle emitters are located.
 +  * **Render Bogies** renders small indicators where bogies are located.
 +  * **Render Fake Bogies** renders small indicators where [[modding:vehicleadvancedtopics#fake_bogies|fake bogies]] are located.
   * **Render Water Line** renders a line that indicates the position of the water line definition of ships.   * **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 <span btn>SCREENSHOT</span> 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 <span btn>OPTIONS</span> > <span btn>ICONS</span>: 
-  * <span btn>GUI ICONS(!!)</span> will generate the ui icons for all vehicle models in the mod. 
-  * <span btn>WEBSITE(!!)</span> 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.+=== Icons === 
 +<div right 250px> 
 +{{:modding:modeleditor:options_icons.png?nolink&250|}} 
 +</div> 
 +To generate vehicle icons and take representative screenshots of the vehicle models, you can use the <span btn>SCREENSHOT</span> 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''.
  
-Currently, it is not possible to generate screenshots of models other than vehicles.+The <span btn>ICONS</span> tab provides options for the creation of ui icons and other screenshots: 
 +  * **Screenshot extension** lets you choose the file extension that is used for the generation. The game requires the ''.tga'' format, while ''.png'' might be useful for websites. 
 +  * **Stage file (bus, tram, truck)** is the model reference that is used as street segment for screenshots of road vehicles. Click on the <span btn>...</span> and navigate through the file picker to select a model. 
 +  * **Stage file (train, wagon)** is the model reference that is used as track segment for screenshots of rail vehicles. Click on the <span btn>...</span> and navigate through the file picker to select a model. 
 +  * **Top screenshot button** is a list of checkboxes where you can select the types of screenshots which are generated when the screenshot button in the top right corner is pressed. See the listing below for information about the different types. 
 +  * **Disable Screenshot Button** disables the screenshot button in the top bar so it can't be triggered accidentially. 
 +  * **Bulk Generate UI/cblend Icons** will generate the ui icons for all vehicle models in the mod. 
 +  * **Bulk Generate 3D/ortho Screenshots** will generate the other renderings for all vehicle models in the mod. 
 + 
 +<div tip 100%> 
 +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. 
 +</div> 
 + 
 + 
 +== Screenshot types == 
 + 
 +  * **UI icons** generates icons which are used for the vehicle lists and stores. It generates icons in two different sizes. as well as the masks for color blending. 
 +  * **cblend mask** generates the matching color blending masks for the icons above. 
 +  * **3D screenshots** generates two large screenshots from different angles. 
 +  * **ortho screenshots** generates screenshots from side, front and top angle. 
 +  * **viewport screenshots** generates a screenshot with the current perspective in the model editor. This works for models other than vehicles as well. 
 + 
 + 
 +=== Graphics === 
 +<div right 250px> 
 +{{:modding:modeleditor:options_graphics.png?nolink&250|}} 
 +</div> 
 +The <span btn>GRAPHICS</span> tab provides the possibility to adjust the major graphics settings for the model editor display: 
 +  * **Graphics API** selects the used graphic library, this is either OpenGL or Vulkan. 
 +  * **Textures** sets the texture quality used for the display of the model. 
 +  * **Anti-aliasing** reduces the artifacts along sharp shapes. 
 +  * **Bloom** controls the blooming effect around emissive faces. 
 +  * **VSync** adjusts the framerate to 30/60fps if possible, otherwise it is not limited.
  
 +In order for changed graphic settings to take effect, the Model Editor needs to be restarted.
 ==== Viewport Controls ==== ==== Viewport Controls ====
 The camera in the model viewer is controlled with the mouse: The camera in the model viewer is controlled with the mouse:
Line 173: Line 250:
  
 ==== Filenames ==== ==== 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.+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 ''.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 ==== +==== Nodes / 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>/''.+The names of nodes are structured as following:
  
-If a name contains the ''#'' character, everything behind it will not be used for the mesh names. +<code> 
-If the name contains ''#ignore'', the mesh will be ignored and not imported.+[#]<elementname>[|<metadatatype>][#<comment>
 +</code>
  
-To reference existing meshesuse 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.+== # - optional == 
 +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 
 + 
 +== <elementname> == 
 + 
 +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
 + 
 +== |<metadatatype> - optional == 
 + 
 +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 **[[modding:resourcetypes:mdl#bounding_box|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 **[[modding:resourcetypes:mdl#label_list|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 
 +  - need to be rotated in the same way 
 +  - need to lay in the same plane along their x/y axis 
 +  - need to have the z axis to look forward 
 + 
 +A locator with ''|emitter_smoke'' is used to define the **[[modding:resourcetypes:mdl#particlesystem|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 [[modding:vehiclebasics#seats1|**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.  
 + 
 +== #<comment> - optional == 
 +If there is a ''#'' not at the first position of the name, then everything behind it is ignored. 
 + 
 +== Examples == 
 +<code> 
 +middle_interior 
 +middle_interior#borrowed_from_middle 
 +</code> 
 +will both create a node with mesh “…/middle_interior_lodX.msh” and name “middle_interior”. 
 + 
 +<code> 
 +#middle_interior 
 +#middle_interior#borrowed_from_middle 
 +</code> 
 +will both be ignored. 
 + 
 +<code> 
 +front_driver_seat|seat_crew_driving_upright 
 +</code> 
 +will be converted to a seat locator for the driver. 
 + 
 +<code> 
 +cylinder_steam|emitter_smoke#left_cylinder 
 +</code> 
 +will be converted to a smoke emitter.
  
 ==== Materials ==== ==== Materials ====
Line 195: Line 326:
   * ''_metal_gloss_ao.dds'' will use a physical based material   * ''_metal_gloss_ao.dds'' will use a physical based material
   * ''_normal.dds'' will use a material with a normal map   * ''_normal.dds'' will use a material with a normal map
-  * ''_cblend_dirt_rust'' will use a material with dirt and rust blending+  * ''_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. 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.
Line 204: Line 335:
   * ''/man/walk'' will result in ''.ani'' files in ''models/animation/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''   * ''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. 
  
 <div download 100%> <div download 100%>
modding/modeleditor.1594884715.txt.gz · Last modified: 2020/07/16 09:31 by kjell