glsl-ascii-filter

1.0.1 • Public • Published

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.

Package Sidebar

Install

npm i glsl-ascii-filter

Weekly Downloads

6

Version

1.0.1

License

MIT

Last publish

Collaborators

  • mattdesl