Initial assets, sounds and shader

This commit is contained in:
2026-10-13 07:13:53 +02:00
parent f1ef1075e7
commit 9b9c777515
4 changed files with 48 additions and 0 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
+48
View File
@@ -0,0 +1,48 @@
#version 330
in vec2 fragTexCoord;
in vec4 fragColor;
out vec4 finalColor;
uniform sampler2D texture0;
uniform vec4 colDiffuse;
// Adjust these values to tweak the aesthetic:
const float SCANLINE_INTENSITY = 0.25; // Lower value = softer lines (0.08 to 0.20)
const float BLOOM_AMOUNT = 0.10; // Slight phosphor bleed/glow
const float CRT_CURVATURE = 0.03; // Subtle screen bulge (0.0 = flat)
void main() {
// 1. Subtle screen curvature distortion
vec2 uv = fragTexCoord;
vec2 dc = abs(0.5 - uv);
uv.x += uv.x * (dc.y * dc.y) * CRT_CURVATURE;
uv.y += uv.y * (dc.x * dc.x) * CRT_CURVATURE;
// Discard pixels outside the curved screen bounds
if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {
finalColor = vec4(0.0, 0.0, 0.0, 1.0);
return;
}
// 2. Sample pixel with slight horizontal blur (Phosphor bleed)
vec4 col = texture(texture0, uv);
vec4 col_left = texture(texture0, uv - vec2(0.0008, 0.0));
vec4 col_right = texture(texture0, uv + vec2(0.0008, 0.0));
col.rgb = mix(col.rgb, (col_left.rgb + col_right.rgb) * 0.5, BLOOM_AMOUNT);
// 3. Gaussian scanline profile matching 360 vertical lines
float scanline = sin(uv.y * 360.0 * 3.14159);
// Smooth power curve prevents harsh pitch-black cutoffs
float scanline_factor = pow(0.5 + 0.5 * scanline, 1.8);
// Apply scanlines smoothly
col.rgb *= mix(1.0 - SCANLINE_INTENSITY, 1.0, scanline_factor);
// 4. Subtle corner vignette
float vig = (16.0 * uv.x * uv.y * (1.0 - uv.x) * (1.0 - uv.y));
col.rgb *= pow(vig, 0.05);
finalColor = col * colDiffuse * fragColor;
}