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
|
||||
74
shaders/rc.glsl
Normal file
74
shaders/rc.glsl
Normal file
@@ -0,0 +1,74 @@
|
||||
|
||||
/* The module to use. A module is a set of shaders used to produce
|
||||
the visualizer. The structure for a module is the following:
|
||||
|
||||
module_name [directory]
|
||||
1.frag [file: fragment shader],
|
||||
2.frag [file: fragment shader],
|
||||
...
|
||||
|
||||
Shaders are loaded in numerical order, starting at '1.frag',
|
||||
continuing indefinitely. The results of each shader (except
|
||||
for the final pass) is given to the next shader in the list
|
||||
as a 2D sampler.
|
||||
|
||||
See documentation for more details. */
|
||||
#request mod graph
|
||||
|
||||
/* GLFW window hints */
|
||||
#request setfloating true
|
||||
#request setdecorated true
|
||||
#request setfocused true
|
||||
#request setmaximized false
|
||||
|
||||
/* GLFW window title */
|
||||
#request settitle "GLava"
|
||||
|
||||
/* GLFW buffer swap interval (vsync), set to '0' to prevent
|
||||
waiting for refresh, '1' (or more) to wait for the specified
|
||||
amount of frames. */
|
||||
#request setswap 1
|
||||
|
||||
/* Frame limiter, set to the frames per second (FPS) desired or
|
||||
simple set to zero (or lower) to disable the frame limiter. */
|
||||
#request setframerate 0
|
||||
|
||||
/* Enable/disable printing framerate every second */
|
||||
#request setprintframes true
|
||||
|
||||
/* Audio buffer size to be used for processing and shaders.
|
||||
Increasing this value can have the effect of adding 'gravity'
|
||||
to FFT output, as the audio signal will remain in the buffer
|
||||
longer.
|
||||
|
||||
This value has a _massive_ effect on FFT performance and
|
||||
quality for some modules. */
|
||||
#request setbufsize 4096
|
||||
|
||||
/* Scale down the audio buffer before any operations are
|
||||
performed on the data. Higher values are faster.
|
||||
|
||||
This value can affect the output of various transformations,
|
||||
since it applies (crude) averaging to the data when shrinking
|
||||
the buffer. It is reccommended to use `setsamplerate` and
|
||||
`setsamplesize` to improve performance or accuracy instead. */
|
||||
#request setbufscale 1
|
||||
|
||||
/* PulseAudio sample rate. Lower values can add 'gravity' to
|
||||
FFT output, but can also reduce accuracy (especially for
|
||||
higher frequencies). Most hardware samples at 44100Hz.
|
||||
|
||||
Lower sample rates also can make output more choppy, when
|
||||
not using smoothing algorithms. */
|
||||
#request setsamplerate 22000
|
||||
|
||||
/* PulseAudio sample buffer size. Lower values result in more
|
||||
frequent audio updates (also depends on sampling rate), but
|
||||
will also require all transformations to be applied much
|
||||
more frequently (slower) */
|
||||
#request setsamplesize 1024
|
||||
|
||||
/* OpenGL context and GLSL shader versions, do not change unless
|
||||
you _absolutely_ know what you are doing. */
|
||||
#request setversion 3 3
|
||||
#request setshaderversion 330
|
||||
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