50 vec2 size = vec2(textureSize(samp, 0));
51 float aspect = size.x / max(size.y, 1.0);
52 vec2 p = (tc - 0.5) * vec2(aspect, 1.0);
53 float radius = length(p) + 0.002;
54 float depth = fract(-log(radius) * 0.48 +
time_f * 0.16);
56 float tunnelRadius = mix(0.06, 0.72, depth);
57 vec2 direction = p / radius;
58 vec2 tunnelPoint =
rotation(
twist) * direction * tunnelRadius;
59 vec2 uv =
mirrorUV(0.5 + tunnelPoint / vec2(aspect, 1.0));
61 vec2 tangent = normalize(vec2(-p.y, p.x) + vec2(0.0001)) / vec2(aspect, 1.0);
62 float split = 0.006 + depth * 0.004;
64 result.r = texture(samp,
mirrorUV(uv + tangent * split)).r;
65 result.g = texture(samp, uv).g;
66 result.b = texture(samp,
mirrorUV(uv - tangent * split)).b;
67 float ring = pow(0.5 + 0.5 * sin(depth *
TAU * 7.0), 16.0);
68 result += vec3(0.14, 0.20, 0.26) * ring * (1.0 - radius) * 0.30;
69 color = vec4(result, texture(samp, tc).a);
vec2 twist(vec2 coord, float twistAmount, float time, float direction)
Evaluates twist for this shader effect.