81 vec2 cosineFold = 0.5 - 0.5 * cos(3.14159265359 * uv);
82 vec2 edgeDistance = min(mirrored, 1.0 - mirrored);
83 vec2 feather = 1.0 - smoothstep(vec2(0.015), vec2(0.08), edgeDistance);
84 return mix(mirrored, cosineFold, feather);
117 const mat3 toYIQ = mat3(0.299, 0.587, 0.114, 0.596, -0.274, -0.322, 0.211, -0.523, 0.312);
118 const mat3
toRGB = mat3(1.0, 0.956, 0.621, 1.0, -0.272, -0.647, 1.0, -1.106, 1.703);
119 vec3 yiq = toYIQ * c;
120 float hue = atan(yiq.z, yiq.y) + angle;
121 float chroma = length(yiq.yz);
122 return clamp(
toRGB * vec3(yiq.x, chroma * cos(
hue), chroma * sin(
hue)), 0.0, 1.0);
159vec2
trailUV(vec2 uv,
float age,
float bass,
float mid,
float treble) {
161 vec2 p = uv - center;
166 }
else if (
MODE == 1) {
167 p =
rotate2D(age * (0.035 + treble * 0.12)) * p;
168 p *= pow(max(0.985 - bass * 0.045, 0.5), age);
169 }
else if (
MODE == 2) {
171 p.y += cos(p.x * 11.0 +
time_f * 1.4 - age) *
strength * 0.6 * age;
172 }
else if (
MODE == 3) {
174 p *= 1.0 - age * 0.012;
175 }
else if (
MODE == 4) {
176 p *= pow(max(0.955 - bass * 0.07, 0.35), age);
178 }
else if (
MODE == 5) {
179 vec2 direction = normalize(vec2(cos(
time_f * 0.35), sin(
time_f * 0.27)));
180 p -= direction * age *
strength * (1.5 + bass * 2.0);
181 p += vec2(-direction.y, direction.x) * sin(age +
time_f) *
strength;
182 }
else if (
MODE == 6) {
183 float cells = 10.0 + floor(treble * 12.0);
185 vec2 local = uv -
cell;
187 }
else if (
MODE == 7) {
190 }
else if (
MODE == 8) {
191 float radius = length(p) + 0.001;
192 p =
rotate2D(log(radius + 0.08) * 0.06 * age + treble * 0.08 * age) * p;
193 p *= pow(max(0.965 - bass * 0.06, 0.4), age);
196 p.y *= 1.0 + age * (0.008 + mid * 0.02);
211vec3
rgbStrobeCore(
float bass,
float mid,
float treble, out vec3 ageDifference) {
213 vec2 uv1 =
trailUV(tc, 2.0, bass, mid, treble);
214 vec2 uv4 =
trailUV(tc, 5.0, bass, mid, treble);
215 vec2 uv7 =
trailUV(tc, 8.0, bass, mid, treble);
220 float strobeRate = 7.0 + float(
MODE % 4) * 1.75 +
amp_peak * 5.0;
221 bool strobe = mod(floor(
time_f * strobeRate), 2.0) > 0.5;
224 vec3 forwardRoute = vec3(frame1.r, frame4.g, frame7.b);
225 vec3 reverseRoute = vec3(frame7.r, frame4.g, frame1.b);
226 ageDifference = abs(frame1 - frame7);
227 return strobe ? forwardRoute : reverseRoute;
234 float bass = texture(spectrum0, 0.03).r;
235 float mid = texture(spectrum0, 0.22).r;
236 float treble = texture(spectrum0, 0.58).r;
237 float air = texture(spectrum0, 0.80).r;
240 vec3 routed =
rgbStrobeCore(bass, mid, treble, ageDifference);
241 vec3 live = texture(samp,
seamlessUV(tc)).rgb;
244 vec3 persistence = vec3(0.0);
245 float persistenceWeight = 0.0;
246 for (
int i = 0; i < 8; ++i) {
247 float age = float(i + 1);
248 float weight = pow(0.69 +
float(
MODE % 3) * 0.025, age);
250 persistence += echo *
rainbow(age * 0.075 +
time_f * 0.04) * weight;
251 persistenceWeight += weight;
253 persistence /= max(persistenceWeight, 0.001);
255 float motion = dot(ageDifference, vec3(0.333));
256 vec3 result = mix(live, routed, 0.68 + motion * 0.25);
257 result = mix(result, persistence * 1.45, 0.24 +
amp_smooth * 0.2);
259 float huePhase =
time_f * (0.22 + treble * 0.2) + motion * 2.0 +
float(
MODE) * 0.17;
261 result +=
rainbow(huePhase * 0.16 + length(tc - 0.5)) * motion * (0.45 + air * 1.8);
264 float invertClock = mod(floor(
time_f * (3.5 +
float(
MODE % 5))), 2.0);
265 float invertMix = mix(0.12, 0.82, invertClock);
266 result = mix(result, vec3(1.0) - result, invertMix);
267 result = mix(result, vec3(1.0) - result, smoothstep(0.88, 1.0,
amp_peak));
268 result = (result - 0.5) * (1.32 +
amp_smooth * 0.28) + 0.5;
270 color = vec4(clamp(result, 0.0, 1.0), 1.0);
vec2 seamlessUV(vec2 uv)
Evaluates seamlessUV for this shader effect.
vec2 trailUV(vec2 uv, float age, float bass, float mid, float treble)
Evaluates trailUV for this shader effect.