Cheap blur? Performance trouble with blurring (in Max7)

mmake's icon

Hi,

Is blur really so expensive, that no matter what blur i try (examples, jit.gen...) i always get around 45% CPU? I understand this machine is not a powerhouse, but i'm still sort of surprised, that even jit.gl.pix can't provide basic blurring under 40% CPU?

I am no pro in shaders. I'd like to achieve a "fast blur", a cheap blur as a piece in a live system. Does not need to look anything like real life :D Any tips on achieving this is welcome!

Max7 --> 2015 13' MBP Retina, integrated Intel Iris Graphics 6100 1536 MB

Andro's icon

Blur isnt that heavy. Gaussian blur is pretty lightweight. I think other factors like resolution and fos matter more.
Running a patch at 1920 x 1080 with 60 fps uses double the gpu than 30fps. Also having too many actuve gui objects like float can have a big impact on system performance.
Try keeping everything on the gpu. Going to the cpu with standard jit objects and then back to the gpu can create a big bottleneck in a patch

mmake's icon

I've been testing patches with only blur, mostly on the GPU. For example this GEN -patch, found on this forum, takes about 56% CPU according to Activity Monitor on my laptop. Using a videoplane shouldn't have a huge performance hit if i feed a texture to it right?

Max Patch
Copy patch and select New From Clipboard in Max.

EDIT: I might be reading the Activity Monitor wrong too, because it also says i have 80% idle, even though the % Max is using is 56. Uh?

mmake's icon

Eh, i contacted support because of the high CPU usage, thinking it was a bug. Turns out it's totally normal for these patches to use more CPU, because the jit.gl.videoplane i'm using is processed on the CPU. Same thing optimizing stuff in Touchdesigner. I guess i should've known... Thanks Andro for helping too!

Rob Ramirez's icon

gaussian blurring is usually performed in multiple passes, with each pass blurring the width, followed by the height, and then doubling the width amount. the more stages you add, the better quality the blur at the expense of performance.

check out jit.gl.slab.gauss6x-example.maxpat for an example of this in action, which demonstrates a 12 pass gauss blur. if you want more performance, decrease the number of passes.