cooler auroras

This commit is contained in:
yuni 2024-10-30 06:38:39 +01:00
parent c87a68b778
commit 87aa3f1024

View file

@ -8,7 +8,7 @@ const tau = 6.283185307179586;
@fragment @fragment
fn fragment(in: VertexOutput) -> @location(0) vec4<f32> { fn fragment(in: VertexOutput) -> @location(0) vec4<f32> {
let color = vec3<f32>(2.0, 6.0, 20.0); let color = vec3<f32>(2.0, 11.0, 20.0);
var alpha = 0.0; var alpha = 0.0;
let lat = 180.0 * abs(in.uv[1] - 0.5); let lat = 180.0 * abs(in.uv[1] - 0.5);
@ -16,9 +16,12 @@ fn fragment(in: VertexOutput) -> @location(0) vec4<f32> {
if (lat > latitude_cutoff) { if (lat > latitude_cutoff) {
let y = (lat - latitude_cutoff) / (90.0 - latitude_cutoff); let y = (lat - latitude_cutoff) / (90.0 - latitude_cutoff);
//alpha = sin(phase * 5.0) + sin(5.0 * y); //alpha = sin(phase * 5.0) + sin(5.0 * y);
alpha = 0.1 * clamp(-4.0 * cos(tau * sqrt(y + 0.01 * sin(phase * 20.0) + 0.1 * sin(phase))) - 3.0, 0.0, 1.0); 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.3 * clamp(-1000.0 * cos(tau * sqrt(y + 0.01 * sin(phase * 30.0) + 0.1 * sin(phase + 0.3))) - 992.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.2 * clamp(-1000.0 * cos(tau * sqrt(-0.13 + y + 0.01 * sin(phase * 20.0) + 0.2 * sin(phase + 0.4))) - 992.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<f32>(color, clamp(alpha, 0.0, 1.0)); return vec4<f32>(color, clamp(alpha, 0.0, 1.0));