Terrain materials are the used for the coloration of the terrain. In Transport Fever 2 it is possible to assign a 2D texture that is projected on small upright standing faces to emulate grass or wheat growth.
The terrain materials themselves are defined in .lua
files in the res/config/terrain_material/
folder. It has some specific parameters:
function data() return { name = _("Grass Cutted 01"), detailColorTexture = "terrain/grass_cutted_01_albedo.dds", detailMetalGlossAoHTexture = "terrain/grass_cutted_01_metal_gloss_ao_h.dds", detailNormalTexture = "terrain/grass_cutted_01_nrml.dds", overlayTexture = "terrain/overlay_0.dds", detailSize = 1 / 32, overlaySize = 0.03, overlayStrength = 0.25, hOffset = 0.3, order = -40, priority = 1 } end
The name
is a string which can be translated in a strings.lua file.
tessellation effect in top down view
The ground texture is defined by the following properties:
detailColorTexture
is a reference to a texture file in res/textures/
that is used for the ground color.detailMetalGlossAoHTexture
is a reference to another texture that is used for the physical effects. The alpha channel is used as a heightmap for the ground texture.detailNormalTexture
is a reference to a texture that is used for the normalmap of the ground.overlayTexture
is a reference to a texture that is used as a irregularity overlay to break the tile tessellation effect of the main detail texture.The detail textures are required to have 4096×4096 pixel resolution. For this reason it is recommended to be sparing with additional textures.
effect of hOffset and detailMetalGlossAoHTexture
The next set of properties is used to scale the textures from above:
detailSize
is the scaling factor of the detail texture.overlaySize
is the scaling factor of the overlay texture.There are several other properties:
overlayStrength
is the intensity factor for the overlay texture.hOffset
is an offset that is added to the texture heightmap of detailMetalGlossAoHTexture
. At the edge of a materials area, the terrain material that has the greater height value is visible.order
entry is used for the sorting in the menu. priority
is a number that sets the priority of the terrain material. The material with the highest priority is painted on top. This is used to ensure that e.g. asphalt is displayed above the dirt ground. When terrain materials are painted manually, this property is ignored.
It is possible to define additional plant sprites that are shown above the ground (as long as they are not deactivated in the graphics settings). They are defined in <terrainmaterialname>.lua
files in the res/config/grass/
folder whereas the filename usually is identical to the one of the terrain material above.
function data() return { colorTexture = "terrain/grass/grass_light_green_albedo_opacity.dds", metalGlossAoTexture = "terrain/grass/grass_light_green_metal_gloss_ao.dds", normalTexture = "terrain/grass/grass_light_green_normal.dds", translucencyTexture = "terrain/grass/grass_light_green_translucency.dds", materials = {"grass_light_green.lua"}, width = 1.0, height = 1.0, density = 6.0, lodDistance = 300.0 } end
The graphics are defined by some properties:
colorTexture
is a texture reference in the res/textures/
folder for the color and transparency.metalGlossAoTexture
is a texture reference in the res/textures/
folder for the physical effects.normalTexture
is a texture reference in the res/textures/
folder for the normalmap effect.translucencyTexture
is a texture reference in the res/textures/
folder for the thickness of the plant. Thin areas let the sun shine through the backside to entlight the front side. Thick areas are fully shaded.
With the materials
list can be selected for which terrain materials the plant should be used. Please note that a material can only use one plant at the same time.
The size and distribution of the faces on which the texture is projected are defined with another set of properties:
width
is the width of the face in meters.height
is the height of the face in meters.density
is the number of plants per square meter. The allowed range is from 0 to 16.lodDistance
is the maximum distance from where the plants are visible.Terrain materials do not use seperate ui icons. Instead the ground texture is displayed in the bottom menu.