#version 300 es
precision highp float;
uniform vec2 uResolution;
uniform float uTime;
out vec4 outColor;
const uint UINT_MAX = 0xffffffffu;
uvec3 k = uvec3(0x456789abu, 0x6789ab45u, 0x89ab4567u);
uvec3 u = uvec3(1, 2, 3);
uvec2 uhash22(uvec2 n){
n ^= (n.yx << u.xy);
n ^= (n.yx >> u.xy);
n *= k.xy;
n ^= (n.yx << u.xy);
return n * k.xy;
}
float hash21(vec2 b) {
uvec2 n = floatBitsToUint(b);
return float(uhash22(n).x) / float(UINT_MAX);
}
float vnoise21(vec2 pos) {
vec2 origin = floor(pos);
float corner00 = hash21(origin);
float corner01 = hash21(origin + vec2(0.0, 1.0));
float corner10 = hash21(origin + vec2(1.0, 0.0));
float corner11 = hash21(origin + vec2(1.0));
vec2 f = smoothstep(0.0, 1.0, fract(pos));
return mix(mix(corner00, corner10, f.x), mix(corner01, corner11, f.x), f.y);
}
void main() {
vec2 pos = gl_FragCoord.xy / min(uResolution.x, uResolution.y);
pos *= 10.0;
pos += uTime;
outColor.rgb = vec3(vnoise21(pos));
outColor.a = 1.0;
}