ACMX Vulkan Shader Library
GLSL 4.50 shader effects for ACMX's Vulkan renderer
Loading...
Searching...
No Matches
apart.frag
Go to the documentation of this file.
1#version 450
2
3/**
4 * @file apart.frag
5 * @brief Vulkan fragment shader: apart.
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) out vec4 color;
21layout(location = 0) in vec2 tc;
22layout(set = 0, binding = 0) uniform sampler2D samp;
23
24
25
26/**
27 * @brief Evaluates pseudoRandomDirection for this shader effect.
28 * @param time Input value for the calculation.
29 * @return Computed vec2 value.
30 */
31vec2 pseudoRandomDirection(float time) {
32 return normalize(vec2(sin(time * 1.3), cos(time * 1.7)));
33}
34
35/**
36 * @brief Executes the fragment shader entry point.
37 */
38void main(void) {
39 vec2 centeredCoord = (tc * 2.0 - 1.0) * vec2(iResolution.x / iResolution.y, 1.0);
40
41 float dist = length(centeredCoord);
42 vec2 spiralDir = pseudoRandomDirection(time_f + dist * 5.0); float angle = atan(centeredCoord.y, centeredCoord.x) + time_f * 2.0;
43 float radius = dist * (1.0 + 0.1 * sin(time_f * 3.0 + dist * 10.0));
44 vec2 spiralCoord = vec2(cos(angle), sin(angle)) * radius * 0.5 + spiralDir * 0.1 * sin(time_f * 2.0);
45
46 spiralCoord = (spiralCoord / vec2(iResolution.x / iResolution.y, 1.0) + 1.0) / 2.0;
47
48 color = texture(samp, spiralCoord);
49}
50
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
vec2 pseudoRandomDirection(float time)
Evaluates pseudoRandomDirection for this shader effect.
Definition apart.frag:31