Pass 1 renders eight plasma sheets into an atlas with linear depth in alpha; pass 2 marches the refracted ray to each sheet and absorbs it by real path length, so near and far layers separate under pointer parallax. Plasma cycle repeats exactly every 30 s; - / = change speed.
18 lines
600 B
GLSL
18 lines
600 B
GLSL
precision highp float;
|
|
uniform vec2 u_res; uniform float u_time; uniform vec2 u_mouse;
|
|
void main(){
|
|
vec2 p=(gl_FragCoord.xy-0.5*u_res)/u_res.y;
|
|
float t=u_time*0.6;
|
|
float a=atan(p.y,p.x);
|
|
float r=length(p)+0.001;
|
|
float z=1.0/r+t;
|
|
float rings=fract(z*2.0+a*0.6+sin(a*3.0+t)*0.3);
|
|
vec3 base=mix(vec3(1.0,0.15,0.55),vec3(0.15,0.9,1.0),smoothstep(0.0,1.0,rings));
|
|
float glow=pow(1.0-r,2.0);
|
|
float band=smoothstep(0.45,0.5,rings)*smoothstep(0.6,0.5,rings);
|
|
vec3 col=base*band*glow*2.2;
|
|
col+=vec3(0.9,0.5,1.0)*pow(glow,8.0)*1.5;
|
|
col+=0.02*vec3(0.3,0.1,0.5)/(r*r);
|
|
gl_FragColor=vec4(col,1.0);
|
|
}
|