1.0.1 • Published 11 years ago
glsl-ascii-filter v1.0.1
glsl-ascii-filter

A simple ASCII post-processing effect in GLSL, original here by @movAX13h.
#pragma glslify: asciiFilter = require('glsl-ascii-filter')
void main() {
  vec4 color = texture2D(u_sampler, uv);
  //aspect-corrected screen UVs
  vec2 st = uv;
  st.x *= iResolution.x / iResolution.y;
  
  //apply filter
  gl_FragColor.rgb = color.rgb * asciiFilter(color.rgb, uv);
  gl_FragColor.a = color.a;
}Best rendered with retina scaling for crisp edges.
Usage
float asciiFilter(vec3 color, vec2 uv[, float pixelSize])
Applies an ASCII-like filter to the given pixel color based on the current screen uv texcoords. The pixelSize (defaults to 0.04) can be used to scale the characters. 
License
MIT, see LICENSE.md for details.
