I'm working on a tile based game, where grass is spreading from tile to tile, so soon lots of grass appear on the board.
Instancing is on, so the FPS is kind of good, even with 300k triangles (1 grass leaf consists of 90 triangles).
BUT: Tiles can be wet and dry on floating scale, which makes the grass leaves turn from green to yellow.
Currently I implemented this simply as such:
var r = originalColor.r + 0.27f * (1f - (ground.Status / 100));
renderer.material.color = new Color(r, originalColor.g, originalColor.b);
Which creates a new material for every grass...
Obviously I can't change the sharedMaterial's color, because that would change all other grass' colors as well.
So how could I efficiently render grass on a big spectrum from yellow to green?
One thing I came up with is that I create only like 100 materials, with 1 percent steps.
- = first material is 100% yellow, and the last one is 100% green.
And when a grass turns a bit more green, it doesn't have to create a whole new material with 3.47% green, but instead can use the already created 3% green material.
Any better ideas?
Thanks!