I'm trying to achieve a smooth transitioning effect on adjacent tiles, and I can't find a solution to this problem. How can I make it so they blend together? This asset accomplishes it well, but I want to create it myself, and I don't know how. Any help would be greatly appreciated.
What I've tried so far:
Over-engineered brute force method: I have around 14 different tiles (mud, grass, sand, etc.) sorted by their surface level (e.g., grass covers mud, mud covers water). Each tile can be adjacent to three types of tiles: the same tile as the center tile, a higher surface level tile than the center, and a lower surface level than the center. This leads to approximately ~200 possible combinations for one tile. Here's an image showing only 63 variants of the grass tile: variants . And here's an image showing how it should look like with only two tiles (grass and mud): result
Each tile has an integer variable representing its surface level (e.g., 14 for the highest surface, mountain level, and 1 for the lowest, water level). Although I'm uncertain about how to store the data, I believe it's possible using scriptable objects.
In the script, every tile's eight neighboring tiles are checked for their surface level integer. If their level is lower than the center tile's, the center tile should cover a part of that neighboring tile to create the blending effect.
For a 256x256 tilemap, this approach involves checking 65,636 tiles, multiplied by 8 due to neighboring tiles. In total, we need to loop through 524,288 tiles. I'm concerned about performance and efficiency so I don't think this is the best way.