From 99059172ee9af179455fec8e7f383f1578db24a1 Mon Sep 17 00:00:00 2001 From: bhabishnu <156663652+bhabishnu@users.noreply.github.com> Date: Wed, 14 Oct 2026 07:27:46 +0530 Subject: [PATCH] Fix Framebuffer Blur example for p5.js 2.x --- src/content/examples/en/11_3D/06_Framebuffer_Blur/code.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/content/examples/en/11_3D/06_Framebuffer_Blur/code.js b/src/content/examples/en/11_3D/06_Framebuffer_Blur/code.js index 271bfe352a..724249f2a1 100644 --- a/src/content/examples/en/11_3D/06_Framebuffer_Blur/code.js +++ b/src/content/examples/en/11_3D/06_Framebuffer_Blur/code.js @@ -27,8 +27,8 @@ uniform sampler2D img; uniform sampler2D depth; float getBlurriness(float d) { // Blur more the farther away we go from the - // focal point at depth=0.9 - return abs(d - 0.9) * 40.; + // focal point at depth=0.909 + return min(abs(d - 0.909) * 200., 4.); } float maxBlurDistance(float blurriness) { return blurriness * 0.01; @@ -103,7 +103,7 @@ function draw() { for (let x = -width / 2; x <= width / 2; x += sphereDistance) { push(); translate(x, 0, 0); - sphere(); + sphere(width / 16); pop(); } @@ -116,6 +116,8 @@ function draw() { blur.setUniform('depth', layer.depth); // Render the scene captured by framebuffer with depth of field blur + push(); shader(blur); plane(width, height); + pop(); }