Files
net-gunner/visuals/shaders/maptile.gdshader

29 lines
898 B
Plaintext

shader_type spatial;
render_mode blend_mix, depth_prepass_alpha, cull_disabled;
uniform sampler2D albedo_texture : filter_nearest;
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);
float alpha = texture(albedo_texture, UV).a;
ALBEDO = color.rgb;
ALPHA = alpha;
// 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.
//}