We are about to switch to a new forum software. Until then we have removed the registration on this forum.
So,
I've been looking at the SepBlur example provided with Processing and I'm curious about making it so that I could, for this example, have two ellipses, with their own unique/individual blur amount. Right now I'm running into a problem in my programming where it's either an all or nothing and I'm not quite sure how to proceed with it. Any insight would be great!
`PShader blur; PShader blur2; PGraphics src; PGraphics src1; PGraphics pass1, pass2; PGraphics pass3, pass4;
void setup() { size(640, 640, P2D);
blur = loadShader("blur.glsl");
blur2 = loadShader("blur.glsl");
blur.set("blurSize", 9);
blur.set("sigma", 5.0f);
blur2.set("blurSize", 9);
blur2.set("sigma", 5.0f);
src = createGraphics(width, height, P2D); src1 = createGraphics(width, height, P2D);
pass1 = createGraphics(width, height, P2D);
pass1.noSmooth();
pass2 = createGraphics(width, height, P2D);
pass2.noSmooth();
pass3 = createGraphics(width, height, P2D);
pass3.noSmooth();
pass4 = createGraphics(width, height, P2D);
pass4.noSmooth();
}
void draw() {{ src.beginDraw(); src.background(0); src.fill(255); src.ellipse(width/2, height/2, 100, 100); src.endDraw();
// Applying the blur shader along the vertical direction
blur.set("horizontalPass", 0);
blur.set("blurSize", 9);
blur.set("sigma", 5.0);
pass1.beginDraw();
pass1.shader(blur);
pass1.image(src, 0, 0);
pass1.endDraw();
// Applying the blur shader along the horizontal direction
blur.set("horizontalPass", 1);
blur.set("blurSize", 9);
blur.set("sigma", 5.0);
pass2.beginDraw();
pass2.shader(blur);
pass2.image(pass1, 0, 0);
pass2.endDraw();
image(pass2, 0, 0);
}
{ src1.beginDraw(); src1.ellipse(width/3, height/3, 100, 100); src1.endDraw();
// Applying the blur shader along the vertical direction
blur2.set("horizontalPass", 0);
blur2.set("blurSize", 4);
blur2.set("sigma", 5.0);
pass3.beginDraw();
pass3.shader(blur2);
pass3.image(src1, 0, 0);
pass3.endDraw();
// Applying the blur shader along the horizontal direction
blur2.set("horizontalPass", 1);
blur2.set("blurSize", 4);
blur2.set("sigma", 5.0);
pass4.beginDraw();
pass4.shader(blur2);
pass4.image(pass3, 0, 0);
pass4.endDraw();
image(pass4, 0, 0);
}
}`