Examples Depth Blur (p5.strands)

Depth Blur (p5.strands)

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 and applies the blur shader, which is written in p5.strands.

Creative Commons BY-NC-SA license badge

Depth Blur (p5.strands): Created by Dave Pagurek. Revised by Caleb Foss. Remixed by Dave Pagurek. From 2026 onwards, edited and maintained by p5.js Contributors and Processing Foundation. Licensed under CC BY-NC-SA 4.0.

You can find the code history of these examples here: pre-2023 example, 2023 code, 2026 p5.strands translation. You can suggest improvements by contributing to the current website!