blur using jit.gen

ćwiek's icon

hi!
do you know, how to recreate for example gaussian blur in jit.gen?
what could be my starting point?

Wesley Smith's icon

You could look at the cf.gaussian.2p.jxs shader file in jitter-shaders/convolution and try translating it to gen.

ćwiek's icon

hmm and maybe you know the way for syntax highlighting in glsl code?

matmat's icon

Les Stuck made a very instructive gl.pix blur, see in the "exfoliator" patch

Wesley Smith's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Here's the cf.gaussian.2p.jxs shader/slab ported to gl.pix. I left the GLSL code in a comment inside the genpatcher.

ćwiek's icon
Max Patch
Copy patch and select New From Clipboard in Max.

many thanks for advice matmat and wesley!!
sorry for hassle, but i ve got another question regarding this topic.
i would like to implement those two jit.gl.pix in one instance, but i am getting weird errors, and i dont know what am i doing wrong..
here is my attempt:

Wesley Smith's icon

The errors will be better in 6.0.6, but the crux of the problem is the second call to blur:

"first = blur(input, in2);
second = blur(first, in3);"

The first argument to blur has to be a direct input in1, in2, ... at the patcher level because it's being used as the first argument to a sample function. The first argument to sample always has to be an input from [in 1], etc. It's not possible to combine these two separate gl.pix objects together and get the same effect. That's just the way separable convolution works.