User Tools

Site Tools

Urban Games

modding:repaintmods

Repaint Mods

A very common use case for mods is the addition of liveries to existing vehicles. These are usually called Repaints. There are several kinds of repaints regarding the level of complexity:

  • Different textures for existing models
  • Different textures and additional meshes for existing models
  • Different textures and modified meshes for identical models

While the first two cases do not require original files to be present in the repaint mod, the third one requires adapted contents of the original mod. Thus it is required to get permission by the original author before such a mod is shared with others.

In general, it is recommended to only deliver files that are changed or new to reduce duplicates. Those files that are included in the mod should have unique filenames or folder names to reduce possible side effects with other mods. The description below only covers the first type of repaint where only textures are changed.

Neccessary Files

To get a working repaint mod, there are several required files:

  • basic mod files as described in the mod components section
  • a .mtl file for every material that should use other textures
  • a .mdl file for every new model variant
  • the ui icons for every new model variant
  • the new textures

To get a better overview over the folder structure of a repaint mod, you can download an empty template. It contains the basic mod files and folders for the common needs of a repaint mod. In every subfolder is a small textfile explaining what belongs there.

Basic Mod Files

The mod.lua does not differ from the mod.lua of other mods. It is a nice gesture when the original author is named as a co-author. The mod name should be chosen so that it is clear what the content is. It is useful to point out in the mod description if other mods are mandatory. The preview image should represent the mod content to give the user a hint of what he should expect from the mod.

Material Files

The .mtl files contain all the texture file references. Thus it is required to add a new material file if a material should use another texture. Usually up to 4 different texure map entries have to be changed:

  • map_albedo_opacity is the texture with the actual color and transparency information.
  • map_normal is the texture for normalmapping, this could be relevant e.g. for old number plates.
  • map_metal_gloss_ao is the texture with physical effects information.
  • map_cblend_dirt_rust ist the texture with the information which areas can be recolored ingame.

Learn more about material definitions in the material description.

The relevant lines where something has to be changed usually are:

function data()
return {
  ...
  params = {
    ...
    map_albedo_opacity = {
      fileName = "models/vehicle/train/<subfolder>/<vehiclename_liveryname>_albedo_opacity.dds",
      ...
    },
    map_cblend_dirt_rust = {
      fileName = "models/vehicle/train/<subfolder>/<vehiclename_liveryname>_cblend_dirt_rust.dds",
      ...
    },
    map_metal_gloss_ao = {
      fileName = "models/vehicle/train/<subfolder>/<vehiclename_liveryname>_metal_gloss_ao.dds",
      ...
    },
    map_normal = {
      fileName = "models/vehicle/train/<subfolder>/<vehiclename_liveryname>_normal.dds",
      ...
    },
  },
  ...
}
end

Model Files

The .mdl file contains all the neccessary metadata as well as the actual 3D model tree. Learn more about model definitions in the model description.

Usually there are several things to change:

  • the material references to the new .mtl files. Remember to change them in every level of detail.
  • the availability information.
  • the vehicle name and description

The relevant lines where these things can be changed are:

function data()
return {
  ...
  lods = {
    {
      node = {
        children = {
          {
            materials = { 
              "vehicle/train/<subfolder>/<vehiclename_liveryname>.mtl", 
              "vehicle/train/<subfolder>/<vehiclename_liveryname>_alpha.mtl", 
            },
            mesh = "vehicle/train/<subfolder>/body_lod0.msh",
            ...
          },
          ...
        },
        ...
      },
      ...
    },
    ...
  },
  metadata = {
    availability = {
      yearFrom = 2000,
      yearTo = 0,
    },
    description = {
      description = _("VEHICLE_<vehiclename_liveryname>_DESCRIPTION"),
      name = _("VEHICLE_<vehiclename_liveryname>_NAME"),
    },
    ...
  },
  ...
}
end

UI Icons

There are two UI icons needed for vehicle models in two folders:

  • models_small for the buy menu
  • models_20 for other windows and lists ingame

Both can be generated with the Model Editor by loading the mod and pressing the SCREENSHOT button in the top right corner. They are automatically moved to the correct folder.

Textures

The technical requirements for texture files apply here too. As most texture files are using DDS format with a compression that is not lossless, it is not recommended to base texture work on DDS textures, as these contain some artifacts. Instead existing texture workfiles should be used whenever possible. You may ask the original author if he can provide you some.


modding/repaintmods.txt · Last modified: 2020/06/20 10:59 by yoshi