From b3acda860fee7b5f895f2d9ca9f080e00f939dde Mon Sep 17 00:00:00 2001 From: min Date: Thu, 11 Sep 2025 16:05:50 -0400 Subject: [PATCH] nicer vignette --- shader/bg.frag | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/shader/bg.frag b/shader/bg.frag index 7042bd7..375b97e 100644 --- a/shader/bg.frag +++ b/shader/bg.frag @@ -69,31 +69,34 @@ void main() { float slowtime = u_time / 1.3; float timing = sin(slowtime) + 1.0; // map 0-1 timing value into a slight offset - float vig = distf + mix(-0.18, -0.1, timing); + // (lower = farther out) + float vig = distf + mix(-0.13, -0.1, timing); // get coords relative to center, and then get angle vec2 herer2c = herescaled - center; float angle = atan(herer2c.y, herer2c.x); - // determine our cutoff based on this + // determine our offset based on this // so it looks wavy - float cut = 0.2 + (0.02 * sin(20.0 * angle)); + float slowtime2 = u_time / 1.2; + float slowtime3 = u_time / 1.5; + float off = 0.2 + (0.02 * sin(20.0 * angle + slowtime2)) * (1.4 * sin(10.0 * angle + slowtime3)); // apply cutoff if we are too close to center - float vigc = vig * step(0.2, vig); + float vigc = (vig * step(off / 3.0, vig)) - off; // randomize noise pattern every second ish float fasttime = u_time * 1.1; float second = floor(fasttime); float noise = snoise(vec2(gl_FragCoord.x * gl_FragCoord.y, second)); - // blend noise and gradient - float final = (1.0 - vigc); // - (noise * 0.9); - // quantize - float finalq = final; - // float finalq = floor(final); + // quantize vignette colors + float vigq = floor((1.0 - vigc) * 13.0) / 13.0; - gl_FragColor = mix(darker, lighter, finalq); + // blend noise + float final = vigq; + + gl_FragColor = mix(darker, lighter, final); // vec2 c = gl_FragCoord.xy - center; // gl_FragColor = vec4(vec3(smoothstep(-PI, PI, atan(c.y, c.x))), 1.0); }