7layout(set = 0, binding = 1, std140) uniform SpriteExtended {
13 vec4 custom_uniforms[16];
17#define iMouse ext.mouse
18#define iResolution ext.u0.zw
19#define time_f ext.u2.y
21layout(set = 0, binding = 0) uniform sampler2D samp;
26layout(location = 0) in vec2 tc;
61 float gray = dot(col, vec3(0.299, 0.587, 0.114));
62 return mix(vec3(gray), col, s);
71 float U = cos(angle);
float W = sin(angle);
73 0.299+0.701*U+0.168*
W, 0.587-0.587*U+0.330*
W, 0.114-0.114*U-0.497*
W,
74 0.299-0.299*U-0.328*
W, 0.587+0.413*U+0.035*
W, 0.114-0.114*U+0.292*
W,
75 0.299-0.300*U+1.250*
W, 0.587-0.588*U-1.050*
W, 0.114+0.886*U-0.203*
W
77 return clamp(
R * col, 0.0, 1.0);
89 return clamp(col, 0.0, 1.0);
101 vec2 p = uv - center;
103 p = mat2(c, -s, s, c) * p;
104 float z = max(abs(
iZoom), 0.001);
115 return 1.0 - abs(1.0 - 2.0 * fract(tc * 0.5));
125 vec2 ts = vec2(textureSize(tex, 0));
128 vec2 sampleUV = clamp(uv, eps, 1.0 - eps);
130 vec2 deriv = fwidth(tc);
131 if (deriv.x > 0.0 || deriv.y > 0.0) lod = log2(max(max(deriv.x, deriv.y) * max(ts.x, ts.y), 1.0));
132 return textureLod(tex, sampleUV, lod);
143 return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);
154 vec2 u = f * f * (3.0 - 2.0 * f);
155 float a =
hash(i + vec2(0.0, 0.0));
156 float b =
hash(i + vec2(1.0, 0.0));
157 float c =
hash(i + vec2(0.0, 1.0));
158 float d =
hash(i + vec2(1.0, 1.0));
159 return mix(mix(a, b, u.x), mix(c, d, u.x), u.y);
170 for (
int i = 0; i < 4; i++) {
187 float c = cos(a);
float s = sin(a);
188 return mat2(c, -s, s, c) * p;
198 float pi = 3.14159265359;
200 float a = atan(p.y, p.x);
201 float sector = pi * 2.0 / slices;
203 a = abs(a - sector * 0.5);
204 return vec2(cos(a), sin(a)) * r;
218 float aspect = res.x / res.y;
220 float ampControl = clamp(
iAmplitude, 0.0, 2.0);
221 float freqControl = clamp(
iFrequency, 0.0, 2.0);
223 vec2 p = (uv - center) * vec2(aspect, 1.0);
228 float n1 =
fbm(p * 3.0 + t * 0.4);
229 float n2 =
fbm(p * 2.0 - t * 0.3);
231 vec2 flow = vec2(cos(n1 * 6.0), sin(
n2 * 6.0));
235 p += flow * (0.05 + 0.1 *
strength);
240 float slices = 6.0 + floor(ampControl * 4.0);
244 int iterations = 4 + int(ampControl * 2.0);
245 float scale = 1.2 + (freqControl * 0.5);
247 float angle = t * 0.1;
249 for(
int i = 0; i < iterations; i++) {
253 p =
rotate2D(p, angle +
float(i)*0.5 + n1*0.2);
258 vec2 finalUV = p * 0.5 + center + (flow * 0.02);
261 float chroma = 0.005 *
strength * (1.0 + n1);
263 float r =
mxTexture(samp, finalUV + vec2(chroma, 0.0)).r;
265 float b =
mxTexture(samp, finalUV - vec2(chroma, 0.0)).b;
267 return vec3(r, g, b);
278 float ampControl = clamp(
iAmplitude, 0.0, 2.0);
281 float t =
time_f * tSpeed;
282 float strength = 0.5 + (ampControl * 0.5);
284 vec2 center = vec2(0.5);
layout(set=0, binding=1, std140) uniform SpriteExtended
void main(void)
Executes the fragment shader entry point.
vec4 mxTexture(sampler2D tex, vec2 tc)
Evaluates mxTexture for this shader effect.
vec3 adjustBrightness(vec3 col, float b)
Evaluates adjustBrightness for this shader effect.
vec3 applyColorAdjustments(vec3 col)
Evaluates applyColorAdjustments for this shader effect.
vec2 wrapUV(vec2 tc)
Evaluates wrapUV for this shader effect.
vec3 adjustSaturation(vec3 col, float s)
Evaluates adjustSaturation for this shader effect.
vec3 adjustContrast(vec3 col, float c)
Evaluates adjustContrast for this shader effect.
vec3 rotateHue(vec3 col, float angle)
Evaluates rotateHue for this shader effect.
float fbm(vec2 point)
Evaluates fbm for this shader effect.
float hash(vec2 p)
Evaluates hash for this shader effect.
float noise(vec2 p)
Evaluates noise for this shader effect.
vec2 kaleido(vec2 p, float seg)
Evaluates kaleido for this shader effect.
mat2 R(float a)
Evaluates R for this shader effect.
float W(vec2 p)
Evaluates W for this shader effect.
mat2 rotate2D(float a)
Evaluates rotate2D for this shader effect.
float n2(vec2 p)
Evaluates n2 for this shader effect.
vec2 applyZoomRotation(vec2 uv, vec2 center)
Evaluates applyZoomRotation for this shader effect.
vec3 sampleLiquidFractal(vec2 uv, float t, float strength, vec2 center, vec2 res)
Evaluates sampleLiquidFractal for this shader effect.