Planet-Miner/godot/Shaders/Planet/PlanetShading.gdshader

19 lines
378 B
Plaintext

shader_type spatial;
uniform float min_elevation;
uniform float max_elevation;
uniform sampler2D elevation_color;
varying float height;
void vertex() {
height = length(VERTEX);
}
void fragment() {
float t = height/(max_elevation-min_elevation)- (min_elevation / (max_elevation-min_elevation));
vec3 color = texture(elevation_color, vec2(t, 0.0)).rgb;
ALBEDO = color;
}