Welcome to the TWC Wiki! You are not logged in. Please log in to the Wiki to vote in polls, change skin preferences, or edit pages. See HERE for details of how to LOG IN.

.worldterrain - M2TW

From TWC Wiki
Revision as of 07:56, 22 December 2019 by Makanyane (talk | contribs)
Jump to navigationJump to search

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. The path and name of the .worldterrain file to be used is recorded inside the .world file.

See this tutorial by wilddog for further information.

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;

Terrain-triangle-grid.jpg


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. The picture below shows the dialog box for editing the path and file names for the masks and textures in IWTE.

Worldterrain-mask-editing.jpg

NOTES:

  • The masks are applied in order from top to bottom, so if you have overlapping areas of masked texture the lower listed textures will appear on top of the earlier ones and completely obscure them where the mask value is 1.0 (white alpha).
  • Although the masks and textures actually have to be .texture files the list in the .worldterrain must call them .tga
  • If you have an incorrect path/name and a mask cannot be found the textures it uses will be applied to the whole .worldterrain area.
  • If you have an incorrect path/anme and a texture cannot be found the area defined by the mask will appear black.
  • The masks are stretched to fit the area covered by the .worldterrain file - if you re-size the .worldterrain you will need to adjust the mask contents to suit.
  • The mask.texture files can be converted to .dds and edited in photoshop etc. The relevant bit to edit is the alpha channel.
  • The mask.textures can also be edited in IWTE's painter process called from the 'Image file editing' button at top left - this allows them to be viewed in conjunction with other .world features.
  • The micro.texture files are normally applied at a smaller scale to represent grass textures etc. on close-up viewing. If you apply the textures over a large area you can end up seeing a distinct grid pattern. If you don't need the detailed effect you can increase the scale used by adjusting the figure in the size column.
YOU can help us improve this Wiki! ~ Look for ways to help and editing advice. ~ If you need further advice, please post here.