120vec2
flower_map(vec2 point,
float bass,
float middle,
float treble,
float age) {
121 float radius = length(point) + 0.0001;
122 float angle = atan(point.y, point.x);
123 float petals = 7.0 + floor(treble * 6.0);
124 float envelope = 1.0 + cos(angle * petals -
time_f * 1.2 - age * 8.0) *
125 (0.18 + middle * 0.16);
127 angle += sin(radius * (11.0 + bass * 7.0) -
time_f * 2.0) *
128 (0.15 + treble * 0.22);
129 return vec2(cos(angle), sin(angle)) * radius;
137 float aspect = resolution.x / resolution.y;
138 vec2 center =
iMouse.z > 0.0 ?
iMouse.xy / resolution : vec2(0.5);
139 vec2 point = (tc - center) * vec2(aspect, 1.0);
140 float bass = max(texture(spectrum0, 0.028).r,
amp_low);
141 float middle = max(texture(spectrum0, 0.27).r,
amp_mid);
142 float treble = max(texture(spectrum0, 0.71).r,
amp_high);
143 vec2 flower =
flower_map(point, bass, middle, treble, 0.0);
144 float radius = length(flower) + 0.0001;
145 float angle = atan(flower.y, flower.x);
146 float plasma = sin(flower.x * (18.0 + treble * 9.0) +
time_f * 2.4) +
147 cos(flower.y * (21.0 + middle * 8.0) -
time_f * 1.9) +
148 sin(radius * (32.0 + bass * 20.0) -
time_f * 6.0);
149 vec2 live_uv = flower / vec2(aspect, 1.0) + center;
151 (0.004 + bass * 0.012);
154 float glow = pow(clamp(
plasma / 3.0, 0.0, 1.0), 5.0);
155 live +=
palette(angle /
TAU + radius) * glow * (0.14 + treble * 0.32);
157 vec3 accumulated = live * 1.2;
158 float total_weight = 1.2;
159 for (
int index = 0; index <
SIZE; ++index) {
160 float age = float(index + 1) / float(max(
SIZE, 1));
164 vec2 old_flower =
flower_map(point, old_bass, old_middle,
166 old_flower =
rotate_2d(age * (0.25 + old_middle * 0.6)) * old_flower;
167 old_flower *= 1.0 - age * (0.1 + old_bass * 0.07);
168 vec2 cache_uv = old_flower / vec2(aspect, 1.0) + center;
170 memory = mix(memory, abs(memory - live), old_treble * 0.3);
171 memory *= 0.66 +
palette(age + length(old_flower)) * 0.59;
172 float weight = exp(-age * 2.2) * (0.7 + old_bass * 0.52);
173 accumulated += memory * weight;
174 total_weight += weight;
177 vec3 result = accumulated / total_weight;
179 result = (result - 0.5) * (1.1 +
amp_smooth * 0.32) + 0.5;
180 color = vec4(clamp(result, 0.0, 1.0), texture(samp, tc).a);
vec2 flower_map(vec2 point, float bass, float middle, float treble, float age)
Evaluates flower map for this shader effect.