ACMX Vulkan Shader Library
GLSL 4.50 shader effects for ACMX's Vulkan renderer
Loading...
Searching...
No Matches
codex_neon_topography.frag
Go to the documentation of this file.
1#version 450
2
3/**
4 * @file codex_neon_topography.frag
5 * @brief Vulkan fragment shader: codex neon topography.
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 iMouse ext.mouse
18#define iResolution ext.u0.zw
19#define time_f ext.u2.y
20
21layout(location = 0) in vec2 tc;
22layout(location = 0) out vec4 color;
23layout(set = 0, binding = 0) uniform sampler2D samp;
24
25
26
27
28/**
29 * @brief Evaluates luminance for this shader effect.
30 * @param c Input value for the calculation.
31 * @return Computed float value.
32 */
33float luminance(vec3 c) {
34 return dot(c, vec3(0.299, 0.587, 0.114));
35}
36
37/**
38 * @brief Executes the fragment shader entry point.
39 */
40void main(void) {
41 float t = time_f * 0.8;
42 vec2 px = 1.0 / max(iResolution, vec2(1.0));
43 vec2 mouseUV = (iMouse.z > 0.0) ? (iMouse.xy / max(iResolution, vec2(1.0))) : vec2(0.5);
44 vec3 src = texture(samp, tc).rgb;
45 float mouseEdge = smoothstep(1.0, 0.0, distance(tc, mouseUV));
46 float l = luminance(src);
47 float gx = luminance(texture(samp, tc + vec2(px.x, 0.0)).rgb) - luminance(texture(samp, tc - vec2(px.x, 0.0)).rgb);
48 float gy = luminance(texture(samp, tc + vec2(0.0, px.y)).rgb) - luminance(texture(samp, tc - vec2(0.0, px.y)).rgb);
49 float edge = smoothstep(0.04, 0.28, length(vec2(gx, gy)));
50 float bands = smoothstep(0.88, 1.0, sin((l + tc.y * 0.7) * 55.0 - t * 3.0) * 0.5 + 0.5);
51 vec3 neon = 0.55 + 0.45 * cos(vec3(0.0, 2.2, 4.4) + l * 8.0 + t);
52 vec3 c = src * 0.42 + neon * (bands * 0.55 + edge * 0.85);
53 c += mouseEdge * vec3(0.1, 0.04, 0.14);
54 color = vec4(c, 1.0);
55}
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
vec3 neon(float t)
Evaluates neon for this shader effect.
float luminance(vec3 c)
Evaluates luminance for this shader effect.