ACMX Vulkan Shader Library
GLSL 4.50 shader effects for ACMX's Vulkan renderer
Loading...
Searching...
No Matches
game_ant_metal_opal.frag
Go to the documentation of this file.
1#version 450
2
3/**
4 * @file game_ant_metal_opal.frag
5 * @brief Vulkan fragment shader: game ant metal opal.
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
20// Metal opal — iridescent rainbow shift on bright pixels (oil-slick look).
21layout(location = 0) out vec4 color;
22layout(location = 0) in vec2 tc;
23layout(set = 0, binding = 0) uniform sampler2D samp;
24
25
26
27/**
28 * @brief Executes the fragment shader entry point.
29 */
30void main(void) {
31 vec3 c = texture(samp, tc).rgb;
32 float lum = dot(c, vec3(0.299, 0.587, 0.114));
33 float h = lum + tc.x * 0.2 + tc.y * 0.15 + time_f * 0.05;
34 vec3 opal = 0.5 + 0.5 * cos(6.28318 * (h + vec3(0.0, 0.33, 0.67)));
35 float mask = smoothstep(0.30, 0.85, lum);
36 color = vec4(mix(c, c * (0.5 + 1.1 * opal), mask * 0.75), 1.0);
37}
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
float h(vec2 p)
Evaluates h for this shader effect.
float lum(vec3 c)
Evaluates lum for this shader effect.
float opal(vec2 p)
Evaluates opal for this shader effect.