We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I have been using the funtion "filter(BLUR)" for use in images and videos.
Why is it so slow? I am used to Gaussian Blur with Quartz Composer, After Effects, etc. It is usually very fast and simple.
Why is it so slow? I am using a top of the line Mac Book Pro and I am getting 5-6 FPS on a blur operation of a simple ellipse. I would expect it to run much faster than this. However, I feel there is a simple solution or I am missing something basic.
Is there a better way to apply blur? A better library? Any suggestions are appreciated!
// Why is blur so slow?
// Casey Scalf 2015
// www.Sensebellum.com
void setup() {
size(1280, 720);
frameRate(30);
background(0);
}
void draw() {
background(0); // Remove for additive blur
fill(127);
stroke(255);
ellipse(mouseX, mouseY, 50, 50);
filter(BLUR, 2);
println("FPS: " + frameRate);
}
Answers
Hello ! You're right, it's weird.... But you can use the one given in the examples. It's based on a custom shader and it works very well and smoothly
That filter is done on the cpu. Try to find a blur shader that works on the gpu. There should be one with the processing examples.
As said: the base blur is done with looping on the pixels and doing a pixel group operation. Lot of work.
A blur done with a shader is delegated to the GPU, so it should be painless...
http://forum.processing.org/two/discussion/comment/44025/#Comment_44025
That's doing the blurring in setup which is no use for a dynamic sketch.
Love the responses everybody, thank you for the tips. The CPU vs GPU distinction is very good to note. I was sure there was a faster way to do it. I will play around with putting this in my code a little bit later tonight.