shader_type canvas_item;
render_mode blend_add;

uniform float ray_count : hint_range(5.0, 40.0) = 20.0;
uniform float speed : hint_range(0.1, 2.0) = 0.4;
uniform float intensity : hint_range(0.0, 2.0) = 0.5;
uniform vec3 ray_color : source_color = vec3(0.5, 0.8, 1.0);

void fragment() {
	vec2 uv = UV;

	float vertical_fade = pow(1.0 - uv.y, 2.0);

	float ray_pattern = fract(uv.x * ray_count + sin(TIME * speed + uv.y * 5.0) * 0.3);
	float ray = smoothstep(0.0, 0.15, ray_pattern) * smoothstep(0.4, 0.15, ray_pattern);

	float brightness = ray * vertical_fade * intensity;

	COLOR = vec4(ray_color * brightness, brightness * 0.6);
}
