ACMX Vulkan Shader Library
GLSL 4.50 shader effects for ACMX's Vulkan renderer
Loading...
Searching...
No Matches
tremor1.frag
Go to the documentation of this file.
1#version 450
2
3/**
4 * @file tremor1.frag
5 * @brief Vulkan fragment shader: tremor1.
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 rand for this shader effect.
28 * @param co Input value for the calculation.
29 * @return Computed float value.
30 */
31float rand(vec2 co) {
32 return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
33}
34
35/**
36 * @brief Evaluates tremorEffect for this shader effect.
37 * @param uv Input value for the calculation.
38 * @param frequency Input value for the calculation.
39 * @param amplitude Input value for the calculation.
40 * @return Computed vec2 value.
41 */
42vec2 tremorEffect(vec2 uv, float frequency, float amplitude) {
43 float tremorX = sin(uv.y * frequency + time_f * 5.0) * amplitude;
44 float tremorY = cos(uv.x * frequency + time_f * 5.0) * amplitude;
45 return uv + vec2(tremorX, tremorY);
46}
47
48/**
49 * @brief Executes the fragment shader entry point.
50 */
51void main() {
52 vec2 uv = tc;
53 float frequency = 20.0;
54 float amplitude = 0.01 + 0.01 * sin(time_f * 3.0);
55 uv = tremorEffect(uv, frequency, amplitude);
56 vec4 texColor = texture(samp, fract(uv));
57 color = texColor;
58}
59
float rand(vec2 co)
Evaluates rand for this shader effect.
Definition 3high.frag:40
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 time_f
Definition 3high.frag:19
#define frequency
Definition ol.frag:13
vec2 tremorEffect(vec2 uv, float frequency, float amplitude)
Evaluates tremorEffect for this shader effect.
Definition tremor1.frag:42