nicer vignette
This commit is contained in:
parent
031247c76f
commit
b3acda860f
|
@ -69,31 +69,34 @@ void main() {
|
||||||
float slowtime = u_time / 1.3;
|
float slowtime = u_time / 1.3;
|
||||||
float timing = sin(slowtime) + 1.0;
|
float timing = sin(slowtime) + 1.0;
|
||||||
// map 0-1 timing value into a slight offset
|
// 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
|
// get coords relative to center, and then get angle
|
||||||
vec2 herer2c = herescaled - center;
|
vec2 herer2c = herescaled - center;
|
||||||
float angle = atan(herer2c.y, herer2c.x);
|
float angle = atan(herer2c.y, herer2c.x);
|
||||||
|
|
||||||
// determine our cutoff based on this
|
// determine our offset based on this
|
||||||
// so it looks wavy
|
// 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
|
// 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
|
// randomize noise pattern every second ish
|
||||||
float fasttime = u_time * 1.1;
|
float fasttime = u_time * 1.1;
|
||||||
float second = floor(fasttime);
|
float second = floor(fasttime);
|
||||||
float noise = snoise(vec2(gl_FragCoord.x * gl_FragCoord.y, second));
|
float noise = snoise(vec2(gl_FragCoord.x * gl_FragCoord.y, second));
|
||||||
|
|
||||||
// blend noise and gradient
|
// quantize vignette colors
|
||||||
float final = (1.0 - vigc); // - (noise * 0.9);
|
float vigq = floor((1.0 - vigc) * 13.0) / 13.0;
|
||||||
// quantize
|
|
||||||
float finalq = final;
|
|
||||||
// float finalq = floor(final);
|
|
||||||
|
|
||||||
gl_FragColor = mix(darker, lighter, finalq);
|
// blend noise
|
||||||
|
float final = vigq;
|
||||||
|
|
||||||
|
gl_FragColor = mix(darker, lighter, final);
|
||||||
// vec2 c = gl_FragCoord.xy - center;
|
// vec2 c = gl_FragCoord.xy - center;
|
||||||
// gl_FragColor = vec4(vec3(smoothstep(-PI, PI, atan(c.y, c.x))), 1.0);
|
// gl_FragColor = vec4(vec3(smoothstep(-PI, PI, atan(c.y, c.x))), 1.0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue