shader_type spatial; render_mode blend_add, specular_disabled, ambient_light_disabled; /* noise1 = universe_noise.rg noise2 = universe_noise.ba */ uniform sampler2D universe_noise; /* stars = other_noise.r star_noise = other_noise.g gradient = other_noise.b */ uniform vec2 displace_gradient = vec2(0.0); uniform vec2 displace_stars = vec2(0.0); uniform float star_scale = 0.5; uniform sampler2D other_noise; uniform vec4 fog_color:hint_color = vec4(0.0, 0.0, 1.0, 1.0); uniform vec4 star_color:hint_color = vec4(1.0); uniform float strengh_noise1 = 3.0; uniform float strengh_noise2 = 3.0; uniform float strengh_star_noise = 0.5; uniform float time_scale_noise1 = 0.05; uniform float time_scale_noise2 = 0.05; uniform float time_scale_stars = 0.05; uniform float time_scale_star_noise = 0.2; // https://gist.github.com/ayamflow/c06bc0c8a64f985dd431bd0ac5b557cd vec2 rotateUV(vec2 uv, vec2 mid, float rotation) { return vec2( cos(rotation) * (uv.x - mid.x) + sin(rotation) * (uv.y - mid.y) + mid.x, cos(rotation) * (uv.y - mid.y) - sin(rotation) * (uv.x - mid.x) + mid.y ); } void fragment() { ALBEDO = vec3(0.0); ALBEDO = fog_color.rgb * texture(other_noise, displace_gradient + UV + ( texture(universe_noise, rotateUV(UV, vec2(0.0, 0.0), TIME * time_scale_noise1)).rg - vec2(.5) ) * strengh_noise1 + ( texture(universe_noise, rotateUV(UV, vec2(1.0, 1.0), TIME * time_scale_noise2)).ba - vec2(.5) ) * strengh_noise2 ).b + (star_color.rgb * (texture(other_noise, rotateUV(UV, vec2(0.0, 0.0), TIME * time_scale_noise2) ).r * max(0.0, sin( TIME * time_scale_star_noise * texture(other_noise, UV).g )))); }