CRT

Recreates the effects of an old CRT television with visible scanlines, spherical warping, and vignette.

Parameters

texture Texture: The input texture to be filtered. Default: The entire canvas
texOffset Vec2: The offset used for sampling neighboring pixels. Default: (1.0 / width, 1.0 / height)
thresholdLow Float: Threshold to highlight edges. Pixels with intensity gradients below this threshold are considered non-edges. Default: 0.1
thresholdHigh Float: Threshold to perform hysteresis and link edges. Pixels with intensity gradients above this threshold are fully considered as edges. Default: 0.3
scanlineWeight Float: Weight of the scanlines effect. Default: 0.1
brightness Float: Adjusts the overall brightness of the image. Default: 2.5
distortion Float: Controls the amount of spherical warping. Default: 0.02

Example

import fip.*;

PShader crt;
PImage ireland;

void setup() {
  size(1000, 1000, P3D);

  crt = loadShader(FIP.crt);

  ireland = loadImage("ireland.jpg");

  crt.set("thresholdLow", 0.1);
  crt.set("thresholdHigh", 0.3);
  crt.set("scanlineWeight", 0.1);
  crt.set("brightness", 2.5);
  crt.set("distortion", 0.02);
}

void draw() {
  image(ireland, 0, 0, width, height);

  filter(crt);
}