shader_type sky; uniform float speed : hint_range(0, 0.1) = 0.05; uniform float brightness : hint_range(0, 1) = 0.1; uniform sampler2D layers[10]; const vec2 speeds[10] = { vec2(-0.9, 0.8), vec2(-0.4, -0.1), vec2(3.03, 2.0), vec2(2.1, 0.2), vec2(0, 0), vec2(0.1, 0), vec2(-0.1, 0), vec2(0.03, 0), vec2(-0.01, 0), vec2(0, 0) }; vec3 layer(sampler2D layer, vec2 direction, vec2 sky_coords) { vec2 coords = vec2(sky_coords.x + TIME*speed*direction.x, sky_coords.y + TIME*speed*direction.y); vec4 pixel = texture(layer, coords); return pixel.rgb * pixel.a * pixel.a * brightness; } void sky() { COLOR = vec3(0,0,0); for (int i = 0; i < layers.length(); i++) { COLOR += layer(layers[i], speeds[i], SKY_COORDS); } }