RGB offset in Jit.gl.pix

mmake's icon

Hello,

I have a no0bish Gen question. How can i make an RGB-offset setup? I've been noodling around with Norm, Swiz, Sample and Vec and i'm not getting the results i hope for. I tried looking at the Luma Displace patch, hoping for answers but still no luck…I wish to offset R G B channels in a feedback setup…somehow.

Thank you : Marko

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

To spatially offset each color channel differently, you'll need one sample operator per channel and a different parameter per channel to control the amount of offset. Here's an example:

mmake's icon

Thank you Wesley!

giolivio's icon

Hi!
I'm trying to make a filter which would create a shift in the red channel to "fake" an anaglyph image, based on the luminance of the pixel, with a 50% grey pixel having no shift. So basically what's darker will be backward and what's brighter than 50% grey will be in progressively front, total white (100%) having largest shift (red on right, cyan on left) as well as black (0%) having largest shift but inversed (red on left, cyan on right).
I tried to merge the patch found here with Gen script lumadisplace, but can't get farther than that.. help! :)
Thanks,
Gio

Anaglyph-Brightness-Displacement-Test.maxpat
Max Patch
metamax's icon

Like this? The trick with texture displacement is to think of each pixel as 1/dimth in size.
ex. out = sample(in1, norm+shift_xy*(1/dim)); Hope that helps. Cheers.

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

giolivio's icon

Hi Metamax,
thanks a lot for the quick reply, it's unfortunate I couldn't answer earlier, waiting for an email notifications that never got through.. well anyway.. about the gl.pix.. yes, almost..

I join an image hoping to give you a clearer idea. Trying to explain it differently..
100% white pixel = max Red shift rightside AND max Cyan shift leftside
75% white pixel = halfway Red shift rightside AND halfway Cyan shift leftside
75% white pixel = no Red/Cyan shift
25% white pixel = halfway Red shift leftside AND halfway Cyan shift rightside (inverted)
0% white pixel = max Red shift leftside AND max Cyan shift rightside
Keep the "ghost white pixel" centered..

I'd try to get it by myself, but I'm not comfortable reading and writing the code inside gl.pix, sorry

Thanks a lot,
Gio

Luma-RedCyan-Shift.png
png
metamax's icon

Gio, I will take a closer look when I have a few minutes. Been super busy. The pic is helpful.

giolivio's icon

Thanks a lot! The gig is tomorrow.. if you could that'd be great!

giolivio's icon

Hi,
I came up with this "no gl" solution, which is almost what I looked for except for the 50% gray as "focal point" and for keeping the white pixel centered, which I have no logical idea how to obtain..
The gig was good but the project goes on, so any help is still much appreciated :)
Cheers,
Giorgio

Anaglyph-Luma-Displacement-Test.maxpat
Max Patch
metamax's icon

Glad you worked it out. I was going to suggest a glow stick and kazoo. Maybe you can composite the original circles with the processed anaglyph to retain the original gray %.