|
Author
|
||||
|
More in Development
|
||||
DIFFERENT BLEND SCHEMES
The blending approach above is very powerful: to get a different way of combining tiles, we only need to change the blend mask. The basic rule is:
Here are a few ideas for different blend images:
To solve this problem, you might need to modify our algorithm to use different masks for tiles with corners. Classify tiles by the following scheme:
Each of these classes are treated differently, using specific blend masks. The exact format of your algorithm will depend on how you design the masks. In general each set of tiles will be generated with a separate algorithm. Here, for example, is what you would use to generate the cross tiles:
foreach (tile1 in tile_set)
foreach (tile2 in tile_set)
{
new_tile = blend (tile1, tile2, blend_mask_cross)
lookup_table[i, j, j, i] = new_tile
}
A very attractive (but more complicated) method of solving the transition problem can be found in the GameDev.net article Tile/Map-Based Game Techniques: Handling Terrain Transitions.
NOTES ON REGION BLENDING FOR HEXAGONAL AND TRIANGULAR TILES
The first important point of applying the algorithms above to hexagonal and triangular tiles is that your logical and tile grids will have different shapes: if your tiles are triangular, the grid will be hexagonal, and vice versa. It also has the effect that hexagonal tiles look triangular, and vice versa.
The blending algorithm depends on how your tiles are orientated. In my (square) image processing code, i use a data structure that will give me an index iterator that I can use to iterate over all indices of a grid. This allows me to not ever have to worry about boundaries. With triangular and hexagonal tiles, this is even more useful. It will allow you to write code for blending like this:
foreach (index in tile1.index_iter())
{
new_tile[index] = mix_color(tile1[index], tile2[index], blend_mask[index])
}
Using this approach also allows you to pack your tiles more efficiently without complicating higher level algorithms (such as blending) if that is a concern. (Packing a regular triangle in a rectangle wastes 50% space. This can be totally eliminated).
|
Words from the readers
|
||||
|
No comments posted for this article yet. Have something to say? Make yourself heard below.
Have your say:
|
||||