initial commit
This commit is contained in:
82
shaders/graph/1.frag
Normal file
82
shaders/graph/1.frag
Normal file
@@ -0,0 +1,82 @@
|
||||
|
||||
layout(pixel_center_integer) in vec4 gl_FragCoord;
|
||||
|
||||
#request uniform "screen" screen
|
||||
uniform ivec2 screen; /* screen dimensions */
|
||||
|
||||
#request uniform "audio_sz" audio_sz
|
||||
uniform int audio_sz;
|
||||
|
||||
#request setavgframes 4
|
||||
#request setavgwindow true
|
||||
// #request interpolate true
|
||||
|
||||
#request uniform "audio_l" audio_l
|
||||
#request transform audio_l "window"
|
||||
#request transform audio_l "fft"
|
||||
#request transform audio_l "avg"
|
||||
uniform sampler1D audio_l;
|
||||
|
||||
#request uniform "audio_r" audio_r
|
||||
#request transform audio_r "window"
|
||||
#request transform audio_r "fft"
|
||||
#request transform audio_r "avg"
|
||||
uniform sampler1D audio_r;
|
||||
|
||||
out vec4 fragment;
|
||||
|
||||
#include "settings.glsl"
|
||||
|
||||
#define CUT 0.5
|
||||
#define SAMPLE_RANGE 0.2
|
||||
#define SAMPLE_AMT 22
|
||||
|
||||
#define WSCALE 11
|
||||
#define VSCALE 6000
|
||||
|
||||
#define DIRECTION 1
|
||||
|
||||
#define RCOL_OFF (gl_FragCoord.x / 3000)
|
||||
#define LCOL_OFF ((screen.x - gl_FragCoord.x) / 3000)
|
||||
#define COLOR vec4(vec3(0.3 + RCOL_OFF, 0.3, 0.3 + LCOL_OFF) + (gl_FragCoord.y / 170), 1)
|
||||
|
||||
#if DIRECTION < 0
|
||||
#define LEFT_IDX (gl_FragCoord.x)
|
||||
#define RIGHT_IDX (-gl_FragCoord.x + screen.x)
|
||||
#else
|
||||
#define LEFT_IDX (half_w - gl_FragCoord.x)
|
||||
#define RIGHT_IDX (gl_FragCoord.x - half_w)
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
float half_w = (screen.x / 2);
|
||||
if (gl_FragCoord.x < half_w) {
|
||||
float s = 0, r;
|
||||
int t;
|
||||
for (t = -SAMPLE_AMT; t <= SAMPLE_AMT; ++t) {
|
||||
s += (texture(audio_l, log((LEFT_IDX + (t * SAMPLE_RANGE)) / (half_w)) / WSCALE).r);
|
||||
}
|
||||
s /= float(SAMPLE_AMT * 2) + 1;
|
||||
s *= VSCALE;
|
||||
|
||||
if (gl_FragCoord.y + 1.5 <= s) {
|
||||
fragment = COLOR;
|
||||
} else {
|
||||
fragment = vec4(0, 0, 0, 0);
|
||||
}
|
||||
} else {
|
||||
float s = 0, r;
|
||||
int t;
|
||||
for (t = -SAMPLE_AMT; t <= SAMPLE_AMT; ++t) {
|
||||
s += (texture(audio_r, log((RIGHT_IDX + (t * SAMPLE_RANGE)) / (half_w)) / WSCALE).r);
|
||||
}
|
||||
s /= float(SAMPLE_AMT * 2) + 1;
|
||||
s *= VSCALE;
|
||||
|
||||
if (gl_FragCoord.y + 1.5 <= s) {
|
||||
fragment = COLOR;
|
||||
} else {
|
||||
fragment = vec4(0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
28
shaders/graph/2.frag
Normal file
28
shaders/graph/2.frag
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
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;
|
||||
if (gl_FragCoord.y > 1) {
|
||||
fragment *= avg;
|
||||
}
|
||||
}
|
||||
28
shaders/graph/3.frag.old
Normal file
28
shaders/graph/3.frag.old
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
layout(pixel_center_integer) in vec4 gl_FragCoord;
|
||||
|
||||
#request uniform "screen" screen
|
||||
#request uniform "prev" tex
|
||||
|
||||
uniform sampler2D tex; /* screen texture */
|
||||
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;
|
||||
|
||||
if (gl_FragCoord.y > 1) fragment *= avg;
|
||||
}
|
||||
4
shaders/graph/settings.glsl
Normal file
4
shaders/graph/settings.glsl
Normal file
@@ -0,0 +1,4 @@
|
||||
#define MIN_THICKNESS 1
|
||||
#define MAX_THICKNESS 12
|
||||
#define BASE_COLOR vec4(0.7, 0.2, 0.45, 1)
|
||||
#define AMPLIFY 500
|
||||
Reference in New Issue
Block a user