From 87aa3f102499f4f3abcbf9b47056b5d651d568cf Mon Sep 17 00:00:00 2001 From: yuni Date: Wed, 30 Oct 2024 06:38:39 +0100 Subject: [PATCH] cooler auroras --- assets/shaders/aurora.wgsl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/assets/shaders/aurora.wgsl b/assets/shaders/aurora.wgsl index e3f4bb7..a266e5c 100644 --- a/assets/shaders/aurora.wgsl +++ b/assets/shaders/aurora.wgsl @@ -8,7 +8,7 @@ const tau = 6.283185307179586; @fragment fn fragment(in: VertexOutput) -> @location(0) vec4 { - let color = vec3(2.0, 6.0, 20.0); + let color = vec3(2.0, 11.0, 20.0); var alpha = 0.0; let lat = 180.0 * abs(in.uv[1] - 0.5); @@ -16,9 +16,12 @@ fn fragment(in: VertexOutput) -> @location(0) vec4 { 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.01 * 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.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.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));