shader_type canvas_item;

uniform sampler2D noise_texture: repeat_enable, filter_nearest;
uniform float density: hint_range(0.0, 1.0) = 0.25;
uniform vec2 speed = vec2(0.02, 0.01);

void fragment() {
	vec2 uv1 = UV + speed * TIME;
	vec2 uv2 = UV + speed * TIME * 0.3;

	float n1 = texture(noise_texture, uv1).r;
	float n2 = texture(noise_texture, uv2).r;

	float noise = mix(n1, n2, sin(TIME * 0.1) * 0.5 + 0.5);

	float fog = clamp(noise * 2.0 - 1.0, 0.0, 1.0);
	COLOR.a *= fog * density;
}

