Forums > MaxMSP

pixel replacement shader

November 11, 2013 | 7:33 am

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 ?

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

– Pasted Max Patch, click to expand. –

</code>

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

if someone could help ….
thanks
Matthieu


November 11, 2013 | 12:00 pm

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

here’s a basic patch to get you started:

<code>

– Pasted Max Patch, click to expand. –

</code>


November 11, 2013 | 12:19 pm

hi Rob ,
one more time , thanks !

that does the trick 100% .

great great great

Matthieu


Viewing 3 posts - 1 through 3 (of 3 total)