Box Blur

Blurs using a simple box blur algorithm.

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)
blurRadius Int: The radius of the box blur. Controls the extent of blurring. Default: 3

Example

import fip.*;

PShader boxBlur;
PImage ireland;

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

  boxBlur = loadShader(FIP.boxBlur);

  ireland = loadImage("ireland.jpg");

  boxBlur.set("blurRadius", 5);
}

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

  filter(boxBlur);
}