7layout(set = 0, binding = 1, std140) uniform SpriteExtended {
13 vec4 custom_uniforms[16];
17#define amp_high ext.audio_bands.z
18#define amp_low ext.audio_bands.x
19#define amp_mid ext.audio_bands.y
20#define amp_peak ext.u2.w
21#define amp_rms ext.u3.z
22#define amp_smooth ext.u3.w
23#define iMouse ext.mouse
24#define iResolution ext.u0.zw
26#define time_f ext.u2.y
29layout(location = 0) in vec2 tc;
30layout(set = 0, binding = 0) uniform sampler2D samp;
42const
float PI = 3.1415926535897932384626433832795;
49float hash1(vec2 p){
return fract(sin(dot(p, vec2(127.1,311.7))) * 43758.5453); }
55vec2
hash2(vec2 p){
return fract(sin(vec2(dot(p, vec2(127.1,311.7)), dot(p, vec2(269.5,183.3)))) * 43758.5453); }
62float pingPong(
float x,
float l){
float m=mod(x,l*2.0);
return m<=l?m:l*2.0-m; }
70 vec4 K=vec4(1.0,2.0/3.0,1.0/3.0,3.0);
71 vec3 p=abs(fract(c.xxx+K.xyz)*6.0-K.www);
72 return c.z*mix(K.xxx,clamp(p-K.xxx,0.0,1.0),c.y);
80 vec3 a=vec3(1.0,0.15,0.75), b=vec3(0.10,0.55,1.0), c=vec3(0.10,1.0,0.45);
81 float ph=fract(t*0.08);
82 vec3 k1=mix(a,b,smoothstep(0.00,0.33,ph));
83 vec3 k2=mix(b,c,smoothstep(0.33,0.66,ph));
84 vec3 k3=mix(c,a,smoothstep(0.66,1.00,ph));
85 float A=step(ph,0.33), B=step(0.33,ph)*step(ph,0.66),
C=step(0.66,ph);
86 return normalize(A*k1+B*k2+
C*k3)*1.05;
98 vec3 s00=textureGrad(img, uv+ts*vec2(-1,-1), dFdx(uv), dFdy(uv)).rgb;
99 vec3 s10=textureGrad(img, uv+ts*vec2( 0,-1), dFdx(uv), dFdy(uv)).rgb;
100 vec3 s20=textureGrad(img, uv+ts*vec2( 1,-1), dFdx(uv), dFdy(uv)).rgb;
101 vec3 s01=textureGrad(img, uv+ts*vec2(-1, 0), dFdx(uv), dFdy(uv)).rgb;
102 vec3 s11=textureGrad(img, uv, dFdx(uv), dFdy(uv)).rgb;
103 vec3 s21=textureGrad(img, uv+ts*vec2( 1, 0), dFdx(uv), dFdy(uv)).rgb;
104 vec3 s02=textureGrad(img, uv+ts*vec2(-1, 1), dFdx(uv), dFdy(uv)).rgb;
105 vec3 s12=textureGrad(img, uv+ts*vec2( 0, 1), dFdx(uv), dFdy(uv)).rgb;
106 vec3 s22=textureGrad(img, uv+ts*vec2( 1, 1), dFdx(uv), dFdy(uv)).rgb;
107 return (s00+2.0*s10+s20+2.0*s01+4.0*s11+2.0*s21+s02+2.0*s12+s22)/16.0;
115 c=pow(max(c,0.0), vec3(0.95));
116 float l=dot(c, vec3(0.299,0.587,0.114));
117 c=mix(vec3(l), c, 0.9);
118 return clamp(c,0.0,1.0);
128 vec2 j=(
hash2(
id)*2.0-1.0)*(0.33+0.10*sin(
time_f*0.37+6.2831*
hash1(
id+3.71)));
129 return (
id+0.5+j)/grid;
140 float ang=atan(d.y,d.x);
142 float mod=1.0+
amp*cos(
n*ang);
143 return r/max(0.001,mod);
151 float aspect=res.x/res.y;
155 float zoom=mix(0.7,2.6,t);
156 vec2 uvZ=(tc-focus)*zoom+focus;
158 float grid=mix(18.0,28.0,0.5+0.5*sin(
time_f*0.11));
161 vec2 gid0=floor(gtc);
163 float best1=1e9,best2=1e9;
164 vec2 bestId=vec2(0.0), bestSite=vec2(0.0);
165 float bestN=7.0, bestA=0.3;
167 for(
int j=-1;j<=1;j++){
168 for(
int i=-1;i<=1;i++){
169 vec2 nid=gid0+vec2(i,j);
171 vec2 d=uvZ-s; d.x*=aspect;
172 float nPts=floor(7.0+5.0*
hash1(nid+7.7));
182 }
else if(dist<best2){
188 float edge=0.5*(best2-best1);
189 float px=1.0/min(res.x,res.y);
190 float border=1.0-smoothstep(px*0.75, px*0.75+fwidth(edge), edge);
192 vec2 rel=uvZ-bestSite; rel.x*=aspect;
195 float cs=cos(
rot), sn=sin(
rot);
196 vec2 rrel=mat2(cs,-sn,sn,cs)*rel;
198 vec2 pieceUV=rrel; pieceUV.x/=aspect; pieceUV+=bestSite;
200 vec4 texCol=texture(samp,pieceUV);
202 float ang=atan(rrel.y,rrel.x);
203 float flare=pow(0.5+0.5*cos(bestN*ang+
time_f*0.7+6.2831*
hash1(bestId+3.4)),3.0);
206 vec3 tint=mix(
neon,glow,0.45)*(0.55+0.45*flare);
207 float rad=length(rrel);
208 float vign=smoothstep(0.9,0.2,rad/(0.55+0.05*sin(
time_f*0.5+
hash1(bestId+5.5))));
209 vec3 pieceCol=mix(texCol.rgb, texCol.rgb*tint, 0.25*vign);
212 vec3 inside=mix(pre, pieceCol, 0.85);
215 vec3 outRGB=mix(inside, sin(borderCol * (
time_f *
PI)), border);
220 float _ab = clamp(
amp_peak, 0.0, 1.0);
221 float _abass = clamp(
amp_low, 0.0, 1.0);
222 outRGB *= 1.0 + _ab * 0.6;
223 outRGB = mix(outRGB, outRGB * vec3(1.0 + _abass * 0.3, 1.0 - _abass * 0.15, 1.0 + clamp(
amp_high, 0.0, 1.0) * 0.25), _ab);
226 color=vec4(outRGB, texCol.a);
layout(set=0, binding=1, std140) uniform SpriteExtended
void main(void)
Executes the fragment shader entry point.
float pingPong(float x, float length)
Evaluates pingPong for this shader effect.
vec2 rot(vec2 v, float a)
Evaluates rot for this shader effect.
vec3 neon(float t)
Evaluates neon for this shader effect.
vec3 tentBlur3(sampler2D img, vec2 uv, vec2 res)
Evaluates tentBlur3 for this shader effect.
vec3 neonPalette(float t)
Evaluates neonPalette for this shader effect.
vec3 softTone(vec3 c)
Evaluates softTone for this shader effect.
vec3 hsv2rgb(vec3 c)
Evaluates hsv2rgb for this shader effect.
float n(vec2 p)
Evaluates n for this shader effect.
vec4 C(int i, vec2 u)
Evaluates C for this shader effect.
float hash1(float n)
Evaluates hash1 for this shader effect.
vec2 sitePos(vec2 id, float grid)
Evaluates sitePos for this shader effect.
float starMetric(vec2 d, float n, float amp)
Evaluates starMetric for this shader effect.