Latest Posts

Changes in HelpTerrains

Revision Differences of Revision 6

Terrains are some of the base graphics in widelands. THhis page describes how they are implemented and should help with creating new terrains. ¶

#
TProperties of the terrain patterns ¶

The patterns for terrains have some restrictions: ¶

1. Width/height: 64 pixel ¶
2. They must be color indexed ¶
3. They couldn't get transparent areas ¶

# Implementing ¶

The surface of the widelands terrain consists of a lot of triangles. See [geometry](https://wl.widelands.org/docs/wl/geometry/) on more about this issue. The squared terrain patterns are therefore splitted into tri
nangles too. Look at tThis terrain pattern. It shows how the splitting is made: ¶

![test.png](/wlmedia//wlimages/test.png) ¶

The pattern is splitted into 4 triangles, which are represented with the different colors. While rendering only one of those triangles are displayed for each field: ¶

![terrain_split_2.jpg](/wlmedia//wlimages/terrain_split_2.jpg) ¶

Note that the red and white triangles of the original pattern are assembled from two patterns to get one big red and one big white triangle. In the above picture the patterns are knowingly spread, to help distuinguish the single patterns. If all patterns are close together, it looks like this: ¶

![terrain_split_1.jpg](/wlmedia//wlimages/terrain_split_3.jpg) ¶

The patterns do have allways the same area where they adjoin: ¶

Testpattern 2 | Result ¶
---------- | ---------- ¶
![test_2.png](/wlmedia//wlimages/test_2.png) | ![terrain_split_4.jpg](/wlmedia//wlimages/terrain_split_4.jpg) ¶

This is importand if you want to create terrains patterns which do not have visible edges if the patter
ns of the sname type adjoin. ¶

# Dithering ¶

Different types of terrains do not have hard edges if they adjoin. This is made with dithering, a technique which blur the edges from one terrain type to another.