ACMX Vulkan Shader Library
GLSL 4.50 shader effects for ACMX's Vulkan renderer
Loading...
Searching...
No Matches
twist-code-singularity-maelstrom.frag
Go to the documentation of this file.
1#version 450
2
3/**
4 * @file twist-code-singularity-maelstrom.frag
5 * @brief Vulkan fragment shader: twist-code-singularity-maelstrom.
6 */
7layout(set = 0, binding = 1, std140) uniform SpriteExtended {
8 vec4 mouse;
9 vec4 u0;
10 vec4 u1;
11 vec4 u2;
12 vec4 u3;
13 vec4 custom_uniforms[16];
14 vec4 audio_bands;
15 vec4 audio_history;
17#define iResolution ext.u0.zw
18#define time_f ext.u2.y
19
20layout(location = 0) in vec2 tc;
21layout(location = 0) out vec4 color;
22layout(set = 0, binding = 0) uniform sampler2D samp;
23
24
25
26const float TAU = 6.28318530718;
27
28/**
29 * @brief Evaluates spin for this shader effect.
30 * @param p Input value for the calculation.
31 * @param a Input value for the calculation.
32 * @return Computed vec2 value.
33 */
34vec2 spin(vec2 p, float a) {
35 float c = cos(a), s = sin(a);
36 return mat2(c, -s, s, c) * p;
37}
38
39/**
40 * @brief Executes the fragment shader entry point.
41 */
42void main(void) {
43 float aspect = max(iResolution.x, 1.0) / max(iResolution.y, 1.0);
44 vec2 scale = vec2(aspect, 1.0);
45 vec2 p = (tc - 0.5) * scale;
46 float r = length(p);
47 float a = atan(p.y, p.x);
48
49 float rings = sin(r * 54.0 - time_f * 9.0 + sin(a * 6.0) * 2.5);
50 float abyss = 1.0 / (r + 0.045);
51 a += time_f * 1.15 + abyss * 1.35 + rings * 0.24;
52 float rr = r + rings * 0.055 + sin(a * 11.0 - time_f * 5.0) * 0.025;
53 vec2 q = spin(vec2(cos(a), sin(a)) * rr, -time_f * 0.3);
54 vec2 uv = fract(q / scale * (1.0 + abyss * 0.055) + 0.5);
55
56 vec2 tangent = vec2(-sin(a), cos(a)) / scale;
57 float split = 0.003 + 0.009 * (1.0 - smoothstep(0.05, 0.75, r));
58 vec3 col = vec3(texture(samp, fract(uv + tangent * split)).r,
59 texture(samp, uv).g,
60 texture(samp, fract(uv - tangent * split)).b);
61 float pulse = 0.78 + 0.32 * sin(r * 72.0 - time_f * 12.0);
62 color = vec4(col * pulse, texture(samp, uv).a);
63}
layout(set=0, binding=1, std140) uniform SpriteExtended
Definition 3high.frag:7
ext
Definition 3high.frag:16
void main(void)
Executes the fragment shader entry point.
Definition 3high.frag:47
#define iResolution
Definition 3high.frag:18
#define time_f
Definition 3high.frag:19
#define TAU
vec2 spin(vec2 p, float a)
Evaluates spin for this shader effect.