ucg-3d/assets/shaders/barber_shop.gdshader

19 lines
No EOL
553 B
Text

shader_type spatial;
render_mode specular_disabled, vertex_lighting;
uniform vec3 color_a : source_color = vec3(1.0);
uniform vec3 color_b : source_color = vec3(0.0);
uniform float stripe_count = 2.0;
uniform float twist_factor = 1.0;
uniform float speed = 0.5;
void vertex() {
float world_height = (MODEL_MATRIX * vec4(VERTEX, 1.0)).y;
UV.y = world_height - TIME * speed;
}
void fragment() {
float twisted_x = UV.x - (UV.y * twist_factor);
float stripe = step(sin(twisted_x * stripe_count * TAU), 0.0);
ALBEDO = mix(color_a, color_b, stripe);
}