ACMX Vulkan Shader Library
GLSL 4.50 shader effects for ACMX's Vulkan renderer
Loading...
Searching...
No Matches
abc.frag
Go to the documentation of this file.
1#version 450
2
3/**
4 * @file abc.frag
5 * @brief Vulkan fragment shader: abc.
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 amp ext.u1.y
18#define iMouse ext.mouse
19#define iResolution ext.u0.zw
20#define time_f ext.u2.y
21#define uamp ext.u1.y
22
23layout(location = 0) out vec4 color;
24layout(location = 0) in vec2 tc;
25layout(set = 0, binding = 0) uniform sampler2D samp;
26
27
28
29
30
31
32/**
33 * @brief Executes the fragment shader entry point.
34 */
35void main(void) {
36 vec2 mousePos = iMouse.xy / iResolution.xy;
37 float dist = distance(tc, mousePos);
38 float glitchStrength = exp(-dist * 10.0) * (uamp) * 4.0;
39 vec2 glitchOffset = vec2(
40 sin(time_f * 10.0 + tc.y * 20.0) * glitchStrength,
41 cos(time_f * 15.0 + tc.x * 25.0) * glitchStrength
42 );
43
44 vec2 distortedTc = tc + glitchOffset;
45 color = texture(samp, distortedTc);
46 vec4 originalColor = texture(samp, tc);
47 float blendFactor = smoothstep(0.0, 0.1, glitchStrength);
48 color = mix(originalColor, color, blendFactor);
49 color = vec4(sin(color.rgb * time_f), 1.0);
50}
layout(set=0, binding=1, std140) uniform SpriteExtended
Definition 3high.frag:7
#define iMouse
Definition 3high.frag:17
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 uamp
Definition abc.frag:21
vec2 glitchOffset(vec2 uv, vec2 seed)
Evaluates glitchOffset for this shader effect.
Definition glitch1.frag:44