Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

quickshell/nuguland/shaders/aurora.frag

Raw
#version 440
layout(location = 0) in vec2 qt_TexCoord0;
layout(location = 0) out vec4 fragColor;
layout(std140, binding = 0) uniform buf { mat4 qt_Matrix; float qt_Opacity; float iTime; vec2 iResolution; vec2 iMouse; float iFirestormMix; } ubuf;
float hash(vec2 p){return fract(sin(dot(p,vec2(127.1,311.7)))*43758.5453);} 
float noise(vec2 p){vec2 i=floor(p),f=fract(p),u=f*f*(3.0-2.0*f);return mix(mix(hash(i),hash(i+vec2(1,0)),u.x),mix(hash(i+vec2(0,1)),hash(i+vec2(1,1)),u.x),u.y);} 
void main(){
 vec2 uv=qt_TexCoord0;
 vec2 aspect=vec2(ubuf.iResolution.x/max(ubuf.iResolution.y,1.0),1.0);
 vec2 p=(uv-0.5)*aspect;
 vec2 m=(ubuf.iMouse-0.5)*aspect;
 float t=ubuf.iTime*0.035;
 float d=length(p-m*0.55);
 float n=noise(vec2(p.x*1.8+t+m.x*0.7,p.y*2.6-t+m.y*0.7));
 float wave=sin((p.x+n*0.70+m.x*0.35)*4.2+t*5.0)*0.5+0.5;
 float veil=smoothstep(1.05,0.05,abs(p.y+0.02+(n-0.5)*0.55-m.y*0.22));
 float halo=smoothstep(0.85,0.0,d)*0.55;
 float glow=(smoothstep(0.25,0.95,wave)*veil + halo) * 0.52;
 vec3 nugu=vec3(0.847,0.427,0.847);
 vec3 cold=vec3(0.33,0.42,0.68);
 vec3 col=mix(cold,nugu,wave)*glow;
 float ember=noise(vec2(p.x*7.0+t*9.0,p.y*5.5-t*15.0));
 float plume=smoothstep(0.95,-0.35,p.y+n*0.45+ember*0.22);
 float lick=smoothstep(0.35,1.0,sin((p.x+n*1.2)*18.0-t*42.0)*0.5+0.5);
 float heat=clamp(plume*(0.45+lick*0.65)+halo*0.35,0.0,1.0);
 vec3 firestorm=mix(vec3(0.45,0.05,0.015),vec3(1.0,0.32,0.04),heat);
 firestorm=mix(firestorm,vec3(1.0,0.78,0.20),pow(max(heat,0.0),3.0));
 float mixv=smoothstep(0.0,1.0,ubuf.iFirestormMix);
 col=mix(col, firestorm*max(glow,heat)*0.72, mixv);
 float alpha=clamp(mix(glow*0.42, max(glow,heat)*0.55, mixv),0.02,0.42);
 fragColor=vec4(col,alpha)*ubuf.qt_Opacity;
}