.worldterrain - M2TW
The .worldterrain file primarily provides the height information for the battle map terrain under settlements and ambients.
The file also applies merge values which influence the rate at which the terrain under the settlement blends with the surroundings. The file also provides paths to the masks and textures applied to the area.
See this tutorial by wilddog for further information.
Contents
Height Grid
The height values given in the .worldterrain file are just a series of float values with a number of rows and columns. They are applied by the game at (in milkshape equivalent terms) 8 metre spacing, using a hardcoded pattern of triangles. From experimentation this pattern is as shown in the image below;
You will see this pattern if you use IWTE to export a .worldterrain to ms3d or use the 'show triangles' function in the 2d editing window. The pattern can make it hard to obtain smooth gradients in certain locations and directions...
Merge Functions
All Terrains
Each height value in the .worldterrain also has a merge value from 0 to 1.0 associated with it. At 1.0 the .worldterrain height value will be applied, and any masked texture and any .worldvegetation setting will be applied 100%. At 0 the height value for the underlying (without .worldterrain) will be applied, and none of the masked texture or .worldvegetation settings will apply. Values between 0 and 1.0 progressively merge the heights and other functions.
Settlement Terrains
The .worldterrain files for settlements also contain a notional flat plane at 0 height which has a fixed size (around the same area as the playable battle-map). This notional plane has merge values, again from 0 to 1.0, which influence how much of it is used. This is why vanilla settlements tend to appear on a large flat area even if the campaign map where they are sited contains mountains or valleys. The mechanism is used to ensure that attacking and reinforcing armies can always reach the settlement without being stuck up or down a cliff! If you extend the size of the .worldterrain file to cover beyond the playable battle-map area, with around a 251 x 251 file, and control the heights out to the edge of that you can enforce a completely accessible area without the flat plane taking effect.
Masks and Textures
The .worldterrain file also contains the file location and file name of up to four masks, and the names and paths to macro and micro textures which are applied by them. There is also a scaling factor for each of the macro and micro textures which can be altered.