Using Wang Tiles¶
Wang tiles are similar in concept to Terrains. This is, however, more focused on filling larger areas without repetition. One defines the edge and corner colors of tiles in a tileset. This information can then be used when filling, or brushing to allow for smooth, non-repetitive transitions between tiles. In most cases this tiling is random, and based on color probability. More info on Wang tiles can be found here.
To demonstrate how to use Wang tiles, I will describe the steps necessary
walkways.tsx example tileset.
Defining Wang Tile Info¶
After making the tileset, from the tileset editor, click the Wang Sets button.
A single tileset can have many Wang sets. Create a new Wang set using the plus button at the bottom of the Wang set view.
You can now edit the properties of the Wang set. Important for us is edge and corner count. This will determine how the set is defined, and how it behaves. This tileset is a 3 edge Wang set.
Now in the complete pattern set will generate in the Patterns tab below the Wang set view. For the set to be complete (though this is unnecessary), each pattern must be used at least once.
Once a pattern is selected, you can paint it directly onto the tileset.
Similar to when using the Stamp Brush,
Shift + Z can be used
to rotate the pattern 90 degrees clockwise and counterclockwise respectively.
Y flip the pattern horizontally, and vertically respectively.
In the other tab, there is the Colors view. This gives you access to edit properties and assign with each individual color of a set.
Using these methods, assign each tile matching all the edges. After this is done, the set is ready to be used with all the Wang methods.
Editing With Wang Methods¶
There are two main ways to use Wang tiles:
Similar to the random mode, the Stamp Brush, and Bucket Fill tools can use Wang methods to fill. With the Wang mode activated, each cell will be randomly chosen from all those in the Wang set which match all adjacent edge/corner colors.
Customizing Wang Colors¶
Each Wang color can be customized to become more recognizable. As well, the probability of each color can be adjusted, such that with the Wang mode it will show up more often in filling or brushing.
The name, image, and of course color can be changed to alter the appearance of a Wang color. This image can be changed be selecting a color, then right clicking on the tile whose image is desired, and selecting Set Wang Color Image.
When choosing a tile with Wang methods, all tiles with a valid Wang pattern are considered. They are given a weight based on their edge/corner colors’ probabilities. Then one is selected at random, while considering this weight. The weight is the product of all the probabilities.
Left shows path with probability 0.1, right shows path with probability 10.