ACMX Vulkan Shader Library
GLSL 4.50 shader effects for ACMX's Vulkan renderer
Loading...
Searching...
No Matches
grad_color.frag
Go to the documentation of this file.
1#version 450
2
3/**
4 * @file grad_color.frag
5 * @brief Vulkan fragment shader: grad color.
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 color palette for this shader effect.
30 * @param t Input value for the calculation.
31 * @return Computed vec3 value.
32 */
33vec3 color_palette(float t) {
34 vec3 a = vec3(0.5, 0.45, 0.5);
35 vec3 b = vec3(0.6, 0.72, 0.95);
36 vec3 c = vec3(0.85, 0.2, 0.25);
37 vec3 d = vec3(0.3, 0.15, 0.2);
38 return a + b * cos(TAU * (c * t + d)) - vec3(0.08) * sin(time_f * 0.3) +
39 (t > 0.8 ? vec3(0.1) : vec3(0));
40}
41
42/**
43 * @brief Executes the fragment shader entry point.
44 */
45void main(void) {
46 vec4 col = texture(samp, tc);
47 color = vec4(col.rgb * color_palette(time_f), col.a);
48}
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 TAU
vec3 color_palette(float t)
Evaluates color palette for this shader effect.