initial commit
This commit is contained in:
24
shaders/wave/1.frag
Normal file
24
shaders/wave/1.frag
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
layout(pixel_center_integer) in vec4 gl_FragCoord;
|
||||
|
||||
#request uniform "screen" screen
|
||||
uniform ivec2 screen; /* screen dimensions */
|
||||
|
||||
#request uniform "audio_l" audio_l
|
||||
#request transform audio_l "window"
|
||||
#request transform audio_l "wrange"
|
||||
uniform sampler1D audio_l;
|
||||
|
||||
out vec4 fragment;
|
||||
|
||||
#include "settings.glsl"
|
||||
|
||||
void main() {
|
||||
float os = ((texture(audio_l, gl_FragCoord.x / screen.x).r - 0.5) * AMPLIFY) + 0.5f;
|
||||
float s = (os + (screen.y * 0.5f) - 0.5f); /* center to screen coords */
|
||||
if (abs(s - gl_FragCoord.y) < clamp(abs(s - (screen.y * 0.5)) * 6, MIN_THICKNESS, MAX_THICKNESS)) {
|
||||
fragment = BASE_COLOR + (abs((screen.y * 0.5f) - s) * 0.02);
|
||||
} else {
|
||||
fragment = vec4(0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
26
shaders/wave/2.frag
Normal file
26
shaders/wave/2.frag
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
layout(pixel_center_integer) in vec4 gl_FragCoord;
|
||||
|
||||
#request uniform "prev" tex
|
||||
uniform sampler2D tex; /* screen texture */
|
||||
#request uniform "screen" screen
|
||||
uniform ivec2 screen; /* screen dimensions */
|
||||
|
||||
out vec4 fragment; /* output */
|
||||
|
||||
void main() {
|
||||
fragment = texture(tex, vec2(gl_FragCoord.x / screen.x, gl_FragCoord.y / screen.y));
|
||||
|
||||
float a0 = texture(tex, vec2((gl_FragCoord.x + 1) / screen.x, (gl_FragCoord.y + 0) / screen.y)).a;
|
||||
float a1 = texture(tex, vec2((gl_FragCoord.x + 1) / screen.x, (gl_FragCoord.y + 1) / screen.y)).a;
|
||||
float a2 = texture(tex, vec2((gl_FragCoord.x + 0) / screen.x, (gl_FragCoord.y + 1) / screen.y)).a;
|
||||
float a3 = texture(tex, vec2((gl_FragCoord.x + 1) / screen.x, (gl_FragCoord.y + 0) / screen.y)).a;
|
||||
|
||||
float a4 = texture(tex, vec2((gl_FragCoord.x - 1) / screen.x, (gl_FragCoord.y - 0) / screen.y)).a;
|
||||
float a5 = texture(tex, vec2((gl_FragCoord.x - 1) / screen.x, (gl_FragCoord.y - 1) / screen.y)).a;
|
||||
float a6 = texture(tex, vec2((gl_FragCoord.x - 0) / screen.x, (gl_FragCoord.y - 1) / screen.y)).a;
|
||||
float a7 = texture(tex, vec2((gl_FragCoord.x - 1) / screen.x, (gl_FragCoord.y - 0) / screen.y)).a;
|
||||
|
||||
float avg = (a0 + a1 + a2 + a3 + a4 + a5 + a6 + a7) / 8.0;
|
||||
fragment *= avg;
|
||||
}
|
||||
4
shaders/wave/settings.glsl
Normal file
4
shaders/wave/settings.glsl
Normal file
@@ -0,0 +1,4 @@
|
||||
#define MIN_THICKNESS 1
|
||||
#define MAX_THICKNESS 10
|
||||
#define BASE_COLOR vec4(0.7, 0.2, 0.45, 1)
|
||||
#define AMPLIFY 500
|
||||
Reference in New Issue
Block a user