#define pi acos(-1.)
#define tau (2.*pi)
vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);
uv -= 0.5;
uv /= vec2(v2Resolution.y / v2Resolution.x, 1);
uv *= 1. + dot(uv,uv)*4.; // increase '4' for wider fov
This is done right before setting the output colour, corrects gamma for standard CRT screens (all screens use the same messed-up gamma so this is the right thing to do everywhere).
// first method
col = pow(col, vec3(1/2.2));
// second method
col = pow(col, vec3(0.454545454545));
float bpm = 140.;
float bpmod = -.01; // -1 to +1, how much to offset the beat by for fine-tuning
float beat = mod((bpm/60.)*(time-(bpm/60.)*bpmod), 4); // 1,2,3,4->
col = mix(vec3(0.), vec3(.1), 1-mod(beat,2.)); // example use, beats 1 and 3 flash
This produces a really interesting 'stepping' effect when the time is given as t
.
float kick(float t, float amt) {return floor(t) + pow(fract(t), amt);}