46 float bass = texture(
spectrum, 0.04).r;
47 float mid = texture(
spectrum, 0.22).r;
48 float hiMid = texture(
spectrum, 0.40).r;
49 float treble = texture(
spectrum, 0.58).r;
50 float air = texture(
spectrum, 0.80).r;
52 vec2 uv = tc * 2.0 - 1.0;
56 float angle = atan(uv.y, uv.x);
59 float twist = 8.0 + bass * 6.0;
60 float speed =
time_f * 3.0;
62 float strand1 = sin(uv.y *
twist - speed) * (0.15 + mid * 0.1);
63 float strand2 = sin(uv.y *
twist - speed + 3.14159) * (0.15 + mid * 0.1);
66 float d1 = abs(uv.x - strand1);
67 float d2 = abs(uv.x - strand2);
69 float width = 0.04 + treble * 0.03;
70 float glow1 = exp(-d1 * d1 / (width * width));
71 float glow2 = exp(-d2 * d2 / (width * width));
74 float rungPhase = uv.y *
twist - speed;
75 float rungInterval = mod(rungPhase, 3.14159);
76 float isRung = smoothstep(0.1, 0.0, abs(rungInterval - 1.57));
77 float rungX = mix(strand1, strand2, (uv.x - strand1) / max(strand2 - strand1, 0.001));
78 float onRung = isRung * step(min(strand1, strand2), uv.x) * step(uv.x, max(strand1, strand2));
79 float rungGlow = onRung * 0.5;
82 float helixWarp = (glow1 + glow2) * 0.03;
83 vec2 sampUV = tc + vec2(helixWarp, 0.0);
86 float chroma = 0.008 + air * 0.02;
88 baseTex.r = texture(samp, sampUV + vec2(chroma, 0.0)).r;
89 baseTex.g = texture(samp, sampUV).g;
90 baseTex.b = texture(samp, sampUV - vec2(chroma, 0.0)).b;
97 vec3 helixColor = color1 * glow1 + color2 * glow2 + rungColor * rungGlow;
98 helixColor *= 1.5 + hiMid * 2.0;
100 vec3 finalColor = baseTex + helixColor;
103 float center = exp(-r * (5.0 -
amp_smooth * 3.0));
104 finalColor += vec3(1.0, 0.97, 0.92) * center * (1.3 +
amp_peak * 1.8);
107 float ripple = sin(r * 15.0 -
time_f * 2.0) * 0.5 + 0.5;
110 color = vec4(finalColor, 1.0);
vec2 twist(vec2 coord, float twistAmount, float time, float direction)
Evaluates twist for this shader effect.