The shader in this example uses depth information from a p5.Framebuffer to apply a blur. On a real camera, objects appear blurred if they are closer or farther than the lens’s focus. This simulates that effect. First, the sketch renders five spheres to the framebuffer. Then, it renders the framebuffer to the canvas using the blur shader.
Framebuffer Blur by p5.js Contributors and the Processing Foundation is licensed under CC BY-NC-SA 4.0.