25 lines
726 B
Plaintext
25 lines
726 B
Plaintext
shader_type spatial;
|
|
|
|
uniform sampler2D height_gradient;
|
|
uniform float vertical_offset;
|
|
uniform float vertical_range : hint_range(1.0, 12.0, 1.0);
|
|
varying vec3 world_position;
|
|
|
|
void vertex() {
|
|
// Called for every vertex the material is visible on.
|
|
world_position = (MODEL_MATRIX * vec4(VERTEX, 1)).xyz;
|
|
}
|
|
|
|
void fragment() {
|
|
float h = (world_position.y - vertical_offset)/vertical_range;
|
|
vec2 uv = vec2(clamp(h, 0.001, 1.0),0.5);
|
|
vec4 color = texture(height_gradient, uv);
|
|
ALBEDO = color.rgb;
|
|
// Called for every pixel the material is visible on.
|
|
}
|
|
|
|
//void light() {
|
|
// // Called for every pixel for every light affecting the material.
|
|
// // Uncomment to replace the default light processing function with this one.
|
|
//}
|