scripts reorganize

This commit is contained in:
2026-10-06 22:34:05 +02:00
parent a2a056a68d
commit 0734bee219
60 changed files with 824 additions and 5 deletions

View File

@@ -0,0 +1,66 @@
//modified version of [this shader](https://github.com/wessles/GLSL-CRT/blob/master/shader.frag)
#version 300 es
precision mediump float;
in vec2 v_texcoord;
uniform sampler2D tex;
out vec4 FragColor;
const vec3 VIB_RGB_BALANCE = vec3(1.0, 1.0, 1.0);
const float VIB_VIBRANCE = 0.40;
const vec3 VIB_coeffVibrance = VIB_RGB_BALANCE * -VIB_VIBRANCE;
void main() {
vec2 tc = vec2(v_texcoord.x, v_texcoord.y);
// Distance from the center
float dx = abs(0.5-tc.x);
float dy = abs(0.5-tc.y);
// Square it to smooth the edges
dx *= dx;
dy *= dy;
tc.x -= 0.5;
tc.x *= 1.0 + (dy * 0.05);
tc.x += 0.5;
tc.y -= 0.5;
tc.y *= 1.0 + (dx * 0.18);
tc.y += 0.5;
// Get texel, and add in scanline if need be
vec4 cta = texture(tex, vec2(tc.x, tc.y));
cta.rgb += sin(tc.y * 1250.0) * 0.02;
// Cutoff
if(tc.y > 1.0 || tc.x < 0.0 || tc.x > 1.0 || tc.y < 0.0)
cta = vec4(0.0);
// RGB
vec3 color = vec3(cta[0], cta[1], cta[2]);
// vec3 VIB_coefLuma = vec3(0.333333, 0.333334, 0.333333); // was for `if VIB_LUMA == 1`
vec3 VIB_coefLuma = vec3(0.212656, 0.715158, 0.072186); // try both and see which one looks nicer.
float luma = dot(VIB_coefLuma, color);
float max_color = max(color[0], max(color[1], color[2]));
float min_color = min(color[0], min(color[1], color[2]));
float color_saturation = max_color - min_color;
vec3 p_col = vec3(vec3(vec3(vec3(sign(VIB_coeffVibrance) * color_saturation) - 1.0) * VIB_coeffVibrance) + 1.0);
cta[0] = mix(luma, color[0], p_col[0]);
cta[1] = mix(luma, color[1], p_col[1]);
cta[2] = mix(luma, color[2], p_col[2]);
// Apply
FragColor = cta;
}

View File

@@ -0,0 +1,22 @@
// blue light filter shader
// values from https://reshade.me/forum/shader-discussion/3673-blue-light-filter-similar-to-f-lux
#version 300 es
precision mediump float;
in vec2 v_texcoord;
uniform sampler2D tex;
out vec4 FragColor;
void main() {
vec4 pixColor = texture(tex, v_texcoord);
// red
pixColor[0] *= 0.7;
// green
pixColor[1] *= 0.6;
// blue
pixColor[2] *= 0.5;
FragColor = pixColor;
}

View File

@@ -0,0 +1,18 @@
#version 300 es
precision mediump float;
in vec2 v_texcoord;
uniform sampler2D tex;
out vec4 FragColor;
// Values obtained from: http://en.wikipedia.org/wiki/Grayscale#Luma_coding_in_video_systems
vec3 LumaFactors = vec3(0.299, 0.587, 0.114);
void main() {
vec4 c = texture(tex, v_texcoord);
// Desaturate to luma only
float luma = dot(vec3(c.r, c.g, c.b), LumaFactors);
FragColor = vec4(luma, luma, luma, c.a);
}

View File

@@ -0,0 +1,31 @@
#version 300 es
precision mediump float;
in vec2 v_texcoord;
uniform sampler2D tex;
out vec4 FragColor;
uniform mediump float time;
const float display_framerate = 60.0;
const vec2 display_resolution = vec2(2520.0, 1680.0);
const float gamma = 1.0;
float rand(vec2 uv, float t) {
return fract(sin(dot(uv, vec2(1225.6548, 321.8942))) * 4251.4865 + t);
}
float Sigmoid(float x) { return 1.0 / (1.0 + (exp(-(x - 0.5) * 14.0))); }
void main() {
vec4 color = texture(tex, v_texcoord);
color = vec4(Sigmoid(color.r), Sigmoid(color.g), Sigmoid(color.b), 1.0);
color = pow(color, vec4(gamma));
color.a = 1.0;
FragColor = color;
}

View File

@@ -0,0 +1,11 @@
#version 300 es
precision mediump float;
in vec2 v_texcoord;
uniform sampler2D tex;
out vec4 FragColor;
void main() {
vec4 pixColor = texture(tex, v_texcoord);
pixColor.rgb = 1.0 - pixColor.rgb;
FragColor = pixColor;
}

View File

@@ -0,0 +1,23 @@
#version 300 es
precision mediump float;
in vec2 v_texcoord;
uniform sampler2D tex;
out vec4 FragColor;
// Values obtained from: http://en.wikipedia.org/wiki/Grayscale#Luma_coding_in_video_systems
vec3 LumaFactors = vec3(0.299, 0.587, 0.114);
void main() {
vec4 c = texture(tex, v_texcoord);
// average brightness
float luma = dot(vec3(c.r, c.g, c.b), LumaFactors);
if (c.r < c.g) {
FragColor = vec4(luma, c.g, luma, c.a);
} else {
FragColor = vec4(c.r, luma, luma, c.a);
}
// FragColor = vec4(c.r, c.g, luma, c.a);
}

View File

@@ -0,0 +1,23 @@
#version 300 es
precision mediump float;
in vec2 v_texcoord;
uniform sampler2D tex;
out vec4 FragColor;
// Values obtained from: http://en.wikipedia.org/wiki/Grayscale#Luma_coding_in_video_systems
vec3 LumaFactors = vec3(0.299, 0.587, 0.114);
void main() {
vec4 c = texture(tex, v_texcoord);
// average brightness
float luma = dot(vec3(c.r, c.g, c.b), LumaFactors);
if (c.r < c.b) {
FragColor = vec4(luma, luma, c.b, c.a);
} else {
FragColor = vec4(c.r, luma, luma, c.a);
}
// FragColor = vec4(c.r, luma, c.b, c.a);
}

View File

@@ -0,0 +1,23 @@
#version 300 es
precision mediump float;
in vec2 v_texcoord;
uniform sampler2D tex;
out vec4 FragColor;
// Values obtained from: http://en.wikipedia.org/wiki/Grayscale#Luma_coding_in_video_systems
vec3 LumaFactors = vec3(0.299, 0.587, 0.114);
void main() {
vec4 c = texture(tex, v_texcoord);
// average brightness
float luma = dot(vec3(c.r, c.g, c.b), LumaFactors);
if (c.g < c.b) {
FragColor = vec4(luma, luma, c.b, c.a);
} else {
FragColor = vec4(luma, c.g, luma, c.a);
}
// FragColor = vec4(luma, c.g, c.b, c.a);
}

View File

@@ -0,0 +1,19 @@
//modified version of [this shader](https://github.com/wessles/GLSL-CRT/blob/master/shader.frag)
#version 300 es
precision mediump float;
in vec2 v_texcoord;
uniform sampler2D tex;
out vec4 FragColor;
const float scaleFactor = 0.7;
// [0,1]
void main() {
vec4 cta = texture(tex, v_texcoord);
// cta += vec4(cos(v_texcoord.x)/4., sin(v_texcoord.y)/4., 0., 1.);
cta += vec4(cos(v_texcoord.x)/4., cos(v_texcoord.y)/8., sin(v_texcoord.y)/4., 1.);
FragColor = vec4(clamp(cta.x, 0., 1.), clamp(cta.y, 0., 1.), clamp(cta.z, 0., 1.), clamp(cta.w, 0., 1.));
}

View File

@@ -0,0 +1,14 @@
//modified version of [this shader](https://github.com/wessles/GLSL-CRT/blob/master/shader.frag)
#version 300 es
precision mediump float;
in vec2 v_texcoord;
uniform sampler2D tex;
out vec4 FragColor;
// [0,1]
void main() {
vec4 cta = texture(tex, v_texcoord);
FragColor = vec4(cta.z, cta.y, cta.x, cta.a);
}