#import bevy_pbr::{ mesh_view_bindings::globals, forward_io::VertexOutput, } const latitude_cutoff = 50.0; const tau = 6.283185307179586; @fragment fn fragment(in: VertexOutput) -> @location(0) vec4 { let color = vec3(2.0, 11.0, 20.0); var alpha = 0.0; let lat = 180.0 * abs(in.uv[1] - 0.5); let phase = in.uv[0] * 2.0 * 3.14159; if (lat > latitude_cutoff) { let y = (lat - latitude_cutoff) / (90.0 - latitude_cutoff); //alpha = sin(phase * 5.0) + sin(5.0 * y); alpha = 0.1 * clamp(-4.0 * cos(tau * sqrt(y + 0.007 * sin(phase * 20.0) + 0.1 * sin(phase))) - 3.0, 0.0, 1.0); alpha += 0.05 * clamp(-1000.0 * cos(tau * y + 1.2 * sin(phase + 0.5)) - 970.0, 0.0, 1.0); alpha += 0.22 * (1.0 + sin(0.0 + phase * 0.9)) * clamp(-1000.0 * cos(tau * sqrt(0.000 + y + 0.05 * sin(phase * 3.0) * sin(phase * 1.0) + 0.1 * sin(phase + 0.3))) - 999.6, 0.0, 1.0); alpha += 0.09 * (1.0 + sin(0.3 + phase * 0.9)) * clamp(-1000.0 * cos(tau * sqrt(-0.17 + y + 0.02 * sin(phase * 2.0) * sin(phase * 5.0) + 0.2 * sin(phase + 0.3))) - 999.0, 0.0, 1.0); alpha += 0.66 * (1.0 + sin(0.3 + phase * 0.9)) * clamp(-1000.0 * cos(tau * sqrt(-0.23 + y + 0.01 * sin(phase * 3.0) * sin(phase * 6.0) + 0.2 * sin(phase + 0.4))) - 999.0, 0.0, 1.0); alpha *= 0.02; } return vec4(color, clamp(alpha, 0.0, 1.0)); }