nicer vignette

This commit is contained in:
minish 2025-09-11 16:05:50 -04:00
parent 031247c76f
commit b3acda860f
Signed by: min
SSH Key Fingerprint: SHA256:mf+pUTmK92Y57BuCjlkBdd82LqztTfDCQIUp0fCKABc
1 changed files with 13 additions and 10 deletions

View File

@ -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);
}