Runtime mesh - Randomizing colour

I want to have a runtime mesh with different colors based on the height of a vertex. It would turn darker and then greyer the higher the vertex is. Like this: http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/voronoi-map-goal-16000-shaded.png but in 3d. How could I accomplish this without creating a texture with all the possible colors in it? (If nothings working, I’m gonna just create a gradient line)

ok, what you are looking for is the Gradient object.

You build your keys, then evaluate them at a time. So black at 0 and white at 1, means that at 0.5 you get gray… or in your case, dark at 0 and gray at 1 and you eval to 0.5 you get the middle, or you can even build keys based on things like water level, whats below water level and so on.

Maybe you could use vertex colors, it’s really simple to set them up when youre creating mesh procedurally. If I remmember you can access them with mesh.colors