ACMX Vulkan Shader Library
GLSL 4.50 shader effects for ACMX's Vulkan renderer
Loading...
Searching...
No Matches
chue.frag
Go to the documentation of this file.
1#version 450
2
3/**
4 * @file chue.frag
5 * @brief Vulkan fragment shader: chue.
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
26/**
27 * @brief Evaluates adjustHue for this shader effect.
28 * @param color Input value for the calculation.
29 * @param angle Input value for the calculation.
30 * @return Computed vec4 value.
31 */
32vec4 adjustHue(vec4 color, float angle) {
33 float U = cos(angle);
34 float W = sin(angle);
35 mat3 rotationMatrix = mat3(
36 0.299, 0.587, 0.114,
37 0.299, 0.587, 0.114,
38 0.299, 0.587, 0.114
39 ) + mat3(
40 0.701, -0.587, -0.114,
41 -0.299, 0.413, -0.114,
42 -0.3, -0.588, 0.886
43 ) * U + mat3(
44 0.168, 0.330, -0.497,
45 -0.328, 0.035, 0.292,
46 1.25, -1.05, -0.203
47 ) * W;
48 return vec4(rotationMatrix * color.rgb, color.a);
49}
50
51/**
52 * @brief Executes the fragment shader entry point.
53 */
54void main() {
55 vec2 uv = tc;
56 vec4 sampledColor = texture(samp, uv);
57 float hueShift = sin(uv.x * 10.0 + uv.y * 10.0 + time_f);
58 vec4 adjustedColor = adjustHue(sampledColor, hueShift);
59 color = adjustedColor;
60}
61
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
vec4 adjustHue(vec4 color, float angle)
Evaluates adjustHue for this shader effect.
Definition chue.frag:32
float W(vec2 p)
Evaluates W for this shader effect.
vec3 hueShift(vec3 col, float hue)
Evaluates hueShift for this shader effect.