mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-09-27 20:48:53 +02:00
wlbg: swap shader
This commit is contained in:
parent
f2e10a974b
commit
ac28a775b8
1 changed files with 58 additions and 32 deletions
|
@ -1,43 +1,69 @@
|
||||||
#version 300 es
|
#version 300 es
|
||||||
|
|
||||||
precision mediump float;
|
precision highp float;
|
||||||
|
|
||||||
uniform float time;
|
uniform float time;
|
||||||
uniform vec2 offset;
|
uniform vec2 offset;
|
||||||
|
|
||||||
in vec2 fragCoord;
|
in vec2 fragCoord;
|
||||||
|
|
||||||
/* "Quasar" by @kishimisu (2023) - https://www.shadertoy.com/view/msGyzc
|
// shader: https://www.shadertoy.com/view/tsXBzS
|
||||||
449 => 443 chars thanks to @Xor
|
|
||||||
|
|
||||||
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
|
vec3 palette(float d){
|
||||||
*/
|
return mix(vec3(0.2,0.0,0.0),vec3(.5,0.,0.),d);
|
||||||
|
|
||||||
#define r(a) mat2(cos(a + asin(vec4(0,1,-1,0)))),
|
|
||||||
#define X(p) p *= r(round(atan(p.x, p.y) * 4.) / 4.)
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
vec2 F = fragCoord - offset + .5;
|
|
||||||
vec3 p, R = vec3(1.);
|
|
||||||
float i, t, d, a, b, T = time * .5 + .5;
|
|
||||||
|
|
||||||
vec4 O = vec4(0.);
|
|
||||||
|
|
||||||
for(O *= i; i++ < 44.;
|
|
||||||
O += .04 * (1. + cos(a + t*.3 - T*.8 + vec4(0,1,2,0)))
|
|
||||||
/ (1. + abs(d)*30.) )
|
|
||||||
|
|
||||||
p = t * normalize(vec3(F+F-R.xy, R.y)),
|
|
||||||
p.z -= 4.,
|
|
||||||
p.xz *= r(T/4.)
|
|
||||||
p.yz *= r(sin(T/4.)*.5)
|
|
||||||
X(p.zx) a = p.x,
|
|
||||||
X(p.yx)
|
|
||||||
p.x = mod(b = p.x - T, .5) - .25,
|
|
||||||
|
|
||||||
t += d = length(p) - (2. - a - smoothstep(b+2., b, T)*30.)
|
|
||||||
* (cos(T/6.+1.)+1.) / 2e2;
|
|
||||||
|
|
||||||
gl_FragColor = O;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vec2 rotate(vec2 p,float a){
|
||||||
|
float c = cos(a);
|
||||||
|
float s = sin(a);
|
||||||
|
return p*mat2(c,s,-s,c);
|
||||||
|
}
|
||||||
|
|
||||||
|
float map(vec3 p){
|
||||||
|
for( int i = 0; i<8; ++i){
|
||||||
|
float t = time*0.2;
|
||||||
|
p.xz =rotate(p.xz,t);
|
||||||
|
p.xy =rotate(p.xy,t*1.89);
|
||||||
|
p.xz = abs(p.xz);
|
||||||
|
p.xz-=.5;
|
||||||
|
}
|
||||||
|
return dot(sign(p),p)/5.;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 rm (vec3 ro, vec3 rd){
|
||||||
|
float t = 0.;
|
||||||
|
vec3 col = vec3(0.);
|
||||||
|
float d;
|
||||||
|
for(float i =0.; i<64.; i++){
|
||||||
|
vec3 p = ro + rd*t;
|
||||||
|
d = map(p)*.5;
|
||||||
|
if(d<0.02){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(d>100.){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//col+=vec3(0.6,0.8,0.8)/(400.*(d));
|
||||||
|
col+=palette(length(p)*.1)/(400.*(d));
|
||||||
|
t+=d;
|
||||||
|
}
|
||||||
|
return vec4(col,1./(d*100.));
|
||||||
|
}
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec2 uv = fragCoord / 5.0;
|
||||||
|
vec3 ro = vec3(0.,0.,-50.);
|
||||||
|
ro.xz = rotate(ro.xz,time);
|
||||||
|
vec3 cf = normalize(-ro);
|
||||||
|
vec3 cs = normalize(cross(cf,vec3(0.,1.,0.)));
|
||||||
|
vec3 cu = normalize(cross(cf,cs));
|
||||||
|
|
||||||
|
vec3 uuv = ro+cf*3. + uv.x*cs + uv.y*cu;
|
||||||
|
|
||||||
|
vec3 rd = normalize(uuv-ro);
|
||||||
|
|
||||||
|
vec4 col = rm(ro,rd);
|
||||||
|
|
||||||
|
|
||||||
|
gl_FragColor = col;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue