pixel replacement shader

joumik's icon

hi everybody ,
i'm looking for a GPU-based way to replace an image with another ,
these images are applied to a videoplane .

the way i need it to work is :

-the current image is displayed
-the next image will totally replace it , pixels after pixels ,
from the bottom right to the top left .
-the new pixels are applied with a (y) axis priority ,
-when the first column is replaced , then it's time for the second column ...
-from right to left
i have had a look on the subtex.3d example patch ,
but can't figure out how to apply my simple need , cleanly !
i'm not sure this shader is the good one .

i have tried a non-GPU manner , involving some getcell and setcell messages given to jit.matrixes , but it's not working "OK" , as soon as i'm working with many videoplanes (and i have to) .

i think the best way would be to use a shader ,
is there a shader , already existing , that could work as i need ?
would you have any clue ?

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

her is a patch that tries to show my needs ,
with white pixels replacing black ones (or black replacing white) .

(there's a loadbang , please click the "setall 255" message if just copy-pasted)

if someone could help ....
thanks
Matthieu

Rob Ramirez's icon

you could probably work this out with jit.gl.pix

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

here's a basic patch to get you started:

joumik's icon

hi Rob ,
one more time , thanks !

that does the trick 100% .

great great great

Matthieu