Page 1 of 1

Tile tint variations

Posted: Thu Apr 30, 2020 4:02 pm
by darkfrei
Hi devs!

You know that some of trees have the same prototype, but different colors. Same by optimized-particles.

Is it possible to make the same for tiles? So just small recoloring has no limit by 255, for example the sand tile can be a little bit darker or lighter by the same prototype.

Re: Tile tint variations

Posted: Sun May 03, 2020 3:21 pm
by posila
I can see this happening, given the tint variation would not be stored on a tile but would be recalculated runtime (from hash of the tile position, maybe map seed and maybe hash of the tile name). Tinting tiles on their own would make them not tile with each other, which would have looked fine in a game with flat shaded art style, but would look out of place or like a bug in Factorio. So, instead of a tile having one tint, each corner of a tile would have to be blended result of the tiles that share that corner. This creates two potential issues though - one minor, and could be just ignored, when quad composed of 2 triangles has diferent colored vertices, the result depends on where the diagonal is. The larger issue would be different sized tiles - gradient on larger tiles would not be same as gradients on their smaller neighbours and visible seam would emerge again. This could be solved though by either rendering large tiles as multiple 1x1 quads (not great ... tile vertex data would become roughly three times bigger :/), or possibly it could be resolved in pixel shader, but I have not thought about how that would work with tile transitions. Maybe I could sequeeze in tile ID onto tile vertices and use it to lookup the 4 tints that need to be blended in 256x256 texture - 255 tiles each with maximum of 256 color variations. That could work, I don't think tints of other tile types are relevant even on transitions.

This ended up more of thought stream than I expected. Anyway, I don't know if that's exactly what you are requesting, but it sounds possible. However, I don't want to touch tile renderer for some time now, unless it is necessery to fix some bug. So sometime later, perhaps.

Re: Tile tint variations

Posted: Mon May 04, 2020 6:44 am
by darkfrei
Thanks!

I totally forgot about the tile transitions. Now I see two ways how to do it without tile transitions, that can be combined together.

1. Tint the whole patch only. On map was generated, the random chooses the tile tint. While they are connected they have the same tint without transitions.

2. Tint runtime with texture, something like data\core\graphics\clouds.png. Here again two ways (combinable):
2a. Rescaled texture, one pixel - one tile. Near tiles have just small difference, that is not easy to see the difference.
2b. Not rescaled texture, that one tile will be tinted the same way as now the cloud makes.