Hello! I’m making a procedural map using Perlin Noise. Each value of the perlin noise map is replaced by a Rule Tile.
I tried changing the color of the Rule Tile a bit to add depth to the map, but this happens:

Color applying only on the bottom of the tilemap
I don’t know why this is happening, maybe the tilemap is too large? It’s not a glitch on the editor, as if I move the camera this weird effect happens on the tiles (random tiles are darkened)

Noticeable change on color in the tilemap
As a workaround, I made a chunk system and it seems to work correctly, but the problem is that I’m using Rule Tiles and the rules don’t apply between different tilemaps. Here’s a image of that effect:

Rule tile is broken at the end of the tilemap
With the chunk system the color is correctly applied, but I have the rule tile problem. Here’s the code for the tile placement and color correction part of the map generation:
private void GenerateTileMap(bool useChunks = false) {
float[,] noiseMap = Noise.GenerateNoiseMap(mapWidth, mapHeight, seed, noiseScale, octaves, persistance, lacunarity, offset);
int neededChunks = (mapWidth / tilesPerChunk) * (mapHeight / tilesPerChunk);
if(neededChunks == 0 || !useChunks) {
neededChunks = 1;
}
Tilemap[] tilemapChunks = new Tilemap[neededChunks];
for(int i = 0;i < neededChunks; i++) {
GameObject newChunk = Instantiate(tileMapPrefab, this.transform);
newChunk.transform.position = transform.position/* + (new Vector3(1f, 1f, 0f) * tilesPerChunk * i)*/;
tilemapChunks[i] = newChunk.GetComponentInChildren<Tilemap>();
}
for (int y = 0; y < mapHeight; y++) {
for (int x = 0; x < mapWidth; x++) {
float currentHeight = noiseMap[x, y];
int currentChunkX = 0;
if(useChunks)
currentChunkX = Mathf.FloorToInt(x / tilesPerChunk);
int currentChunkY = 0;
if(useChunks)
currentChunkY = Mathf.FloorToInt(y / tilesPerChunk) * (mapHeight / tilesPerChunk);
int currentChunk = currentChunkX + currentChunkY;
for (int i = 0; i < regions.Length; i++) {
if (currentHeight <= regions[i].height) {
Vector3Int pos = new Vector3Int(x, y, Mathf.RoundToInt(transform.position.z));
tilemapChunks[currentChunk].SetTileFlags(pos, TileFlags.None);
tilemapChunks[currentChunk].SetTile(pos,regions[i].tile);
float heightColor = Mathf.InverseLerp(0f, 1f, currentHeight) + 0.4f;
tilemapChunks[currentChunk].SetColor(pos, new Color(heightColor , heightColor, heightColor));
break;
}
}
}
}
}
Have you ever found a problem like this? I was thinking about modifying the Rule Tile to search neighbour tiles in other tilemaps, but I didn’t managed to find a way to do it. The chunk system is nice to have, but it doesn’t seem to have a great impact in the performance of the game.




