144vec2
dynamic_trail_transform(vec2 uv, vec2 center,
int index,
int total_layers,
float bass,
float treble,
float time,
float peak) {
145 float progress = float(index) / float(max(total_layers - 1, 1));
148 float strip_y = floor(uv.y * (20.0 + bass * 30.0) + time * 2.0);
149 float tear_offset = (
hash_12(vec2(strip_y, time)) - 0.5) * 2.0;
152 float tear_amount = step(0.65, peak) * progress * (treble * 0.15);
153 vec2 point = uv - center;
154 point.x += tear_offset * tear_amount;
157 float max_zoom = 1.0 + (bass * 1.5) + (
hash_12(uv * 0.1 + time) * 0.1 * progress);
158 float current_scale = mix(1.0, max_zoom, progress);
161 float raw_angle = progress * (treble *
PI) * sin(time * 0.5);
162 float quantize_steps = mix(40.0, 4.0, bass);
163 float stutter_angle = floor(raw_angle * quantize_steps) / quantize_steps;
166 point =
rot * (point / current_scale);
176 float aspect = resolution.x / resolution.y;
177 vec2 mouse_uv =
iMouse.xy / resolution;
178 vec2 center =
iMouse.z > 0.0 ? mouse_uv : vec2(0.5);
181 float bass = texture(spectrum0, 0.03).r;
182 float mid = texture(spectrum0, 0.22).r;
183 float treble = texture(spectrum0, 0.58).r;
185 vec3 live = texture(samp, tc).rgb;
186 vec3 accumulated = live;
187 float total_weight = 1.0;
189 for (
int index = 0; index <
SIZE; ++index) {
195 float progress = float(index) / float(max(
SIZE - 1, 1));
198 float ca_spread = old_treble * progress * 0.04;
209 vec3 cached = vec3(r, g, b);
212 float crush_steps = mix(64.0, 4.0, progress * old_mid);
213 cached = floor(cached * crush_steps) / crush_steps;
215 float weight = exp(-progress * 3.5);
217 vec3 trail_tint = mix(vec3(1.0),
palette(
time_f * 0.2 + progress + old_bass), progress * 0.8);
219 accumulated += (cached * trail_tint) * weight;
220 total_weight += weight;
223 vec3 result = accumulated / total_weight;
226 result = (result - 0.5) * (1.1 +
amp_smooth * 0.2) + 0.5;
229 result = mix(result, vec3(1.0) - result, smoothstep(0.85, 1.0,
amp_peak));
231 color = vec4(clamp(result, 0.0, 1.0), texture(samp, tc).a);
vec2 dynamic_trail_transform(vec2 uv, vec2 center, int index, int total_layers, float bass, float treble, float time)
Evaluates dynamic trail transform for this shader effect.