glsl-ascii-filter

faux ASCII post-processing effect in GLSL


Keywords
glsl, glslify, glslbin, ascii, filter, post, process, post-process, postprocess, processing, bitmap
License
MIT
Install
npm install glsl-ascii-filter@1.0.1

Documentation

glsl-ascii-filter

stable

ascii

(glslbin demo)

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

NPM

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.