A fast blur effect that uses a random hash to compute the sample offset. This gives a snowy/grainy feel to the blur. When requiring, you must specify a
sample function and the
vec3# blur = require('glsl-hash-blur', sample=tex, iterations=20)vec3void
See demo.frag for an example implementation of a vignette blur.
The effect was originally inspired by David Hoskins' ShaderToy.
blur = require('glsl-hash-blur', sample=S, iterations=I)
Requires the module with your desired sampling function
S and iteration count
I. The sample function has the following signature:
vec3 blur(vec2 uv, float radius[, float aspect[, float offset]])
Using the sample function provided above, this will create a blur using the specified UV coordinates and
radius strength. The radius is typically multiplied by texel size, e.g.
1.0 / resolution.x.
aspect (defaults to 1.0) is recommended to produce a more accurate blur; e.g.
resolution.x / resolution.y.
offset is optional (defaults to 0.0). It offsets the uvs during randomization, which can produce a "jitter" effect like moving film noise.
MIT, see LICENSE.md for details.