compositing matrices per pixel

Jul 26, 2007 at 9:46pm

compositing matrices per pixel

Hello all,

I have several matrices, and would like to composite them per pixel.

I.E. Say I have 10 matricies, and one control matrix of values 1-10.
If the value of a control pixel is 1, it pulls that pixel from source
matrix #1.

Is there an easy way to do this via standard jitter, would the best
way be javascript, or is the easiest way to mask all of the 10 source
matrices and then composite them, or some shit I haven’t thought of?

Thanks,

b

Barry Threw
Media Art and Technology

San Francisco, CA Work: 857-544-3967
Email: bthrew@gmail.com
IM: captogreadmore (AIM)
http:/www.barrythrew.com

#33049
Jul 26, 2007 at 11:56pm

Hi Barry,
I hacked together the following example as one way of doing it. I had
another thing worked out using a series of jit.peek~ and jit.poke~
referencing a 3D matrix, but I figured this would make more sense.

Welcome to the vortex…

Best,
Andrew B.

#109553
Jul 27, 2007 at 12:00am

Oh crap, forgot to attach…

#P toggle 38 31 15 0;
#P outlet 285 359 15 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 285 334 64 196617 jit.op @op +;
#P newex 459 271 64 196617 jit.op @op +;
#P newex 127 271 64 196617 jit.op @op +;
#P newex 38 53 51 196617 qmetro 5;
#P newex 604 157 64 196617 r ctrl_mask;
#P newex 604 186 107 196617 jit.op @op == @val 3.;
#P newex 549 223 65 196617 jit.op @op *;
#P newex 549 107 115 196617 jit.matrix 1 float32 10;
#P newex 431 159 64 196617 r ctrl_mask;
#P newex 431 188 107 196617 jit.op @op == @val 2.;
#P newex 376 225 65 196617 jit.op @op *;
#P newex 376 109 115 196617 jit.matrix 1 float32 10;
#P newex 259 161 64 196617 r ctrl_mask;
#P newex 259 190 107 196617 jit.op @op == @val 1.;
#P newex 204 227 65 196617 jit.op @op *;
#P newex 204 111 115 196617 jit.matrix 1 float32 10;
#P button 670 28 15 0;
#P newex 93 162 64 196617 r ctrl_mask;
#P newex 670 107 79 196617 send ctrl_mask;
#P newex 93 191 107 196617 jit.op @op == @val 0.;
#P newex 670 88 82 196617 jit.op @op trunc;
#P newex 670 68 102 196617 jit.op @op * @val 4.;
#P newex 670 48 107 196617 jit.noise 1 float32 10;
#P newex 38 228 65 196617 jit.op @op *;
#P newex 38 112 115 196617 jit.matrix 1 float32 10;
#P connect 26 0 21 0;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 24 0 25 0;
#P connect 23 0 24 1;
#P connect 22 0 24 0;
#P connect 18 0 23 1;
#P connect 14 0 23 0;
#P connect 10 0 22 1;
#P connect 1 0 22 0;
#P connect 21 0 0 0;
#P fasten 21 0 9 0 43 99 209 99;
#P fasten 21 0 13 0 43 99 381 99;
#P fasten 21 0 17 0 43 99 554 99;
#P connect 19 0 18 1;
#P connect 20 0 19 0;
#P connect 16 0 15 0;
#P connect 15 0 14 1;
#P connect 17 0 18 0;
#P connect 13 0 14 0;
#P connect 12 0 11 0;
#P connect 11 0 10 1;
#P connect 9 0 10 0;
#P connect 8 0 2 0;
#P connect 7 0 5 0;
#P connect 5 0 1 1;
#P connect 4 0 6 0;
#P connect 0 0 1 0;
#P window clipboard copycount 27;

#109554
Jul 27, 2007 at 12:01am

ah heck, here’s the really geeky version too…

#P window setfont “Sans Serif” 9.;
#P flonum 243 30 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 415 111 41 196617 *~ 0.1;
#P newex 243 113 43 196617 %~ 10.;
#P newex 243 48 64 196617 phasor~ 30.;
#P newex 337 209 41 196617 *~ 10.;
#P newex 243 307 152 196617 jit.poke~ output 2 0;
#P newex 243 82 47 196617 *~ 100.;
#P newex 243 235 104 196617 jit.peek~ bank 3 0;
#P newex 337 185 88 196617 jit.peek~ ctrl 2 0;
#P button 18 136 15 0;
#P newex 18 156 137 196617 jit.noise 1 float32 10 10 10;
#P button 20 51 15 0;
#P newex 20 70 122 196617 jit.noise 1 float32 10 10;
#P user ezdac~ 196 307 240 340 0;
#P toggle 19 199 15 0;
#P newex 19 225 51 196617 qmetro 5;
#P user jit.pwindow 18 270 82 62 0 1 0 0 1 0;
#P newex 19 249 161 196617 jit.matrix output 1 float32 10 10;
#P newex 18 176 168 196617 jit.matrix bank 1 float32 10 10 10;
#P newex 20 91 150 196617 jit.matrix ctrl 1 float32 10 10;
#P fasten 18 0 12 1 420 172 295 172;
#P fasten 18 0 14 2 420 172 431 172 431 290 390 290;
#P connect 18 0 11 1;
#P connect 17 0 12 0;
#P fasten 17 0 14 1 248 161 319 161;
#P fasten 17 0 11 0 248 155 342 155;
#P connect 13 0 17 0;
#P fasten 13 0 18 0 248 106 420 106;
#P connect 19 0 16 0;
#P connect 16 0 13 0;
#P connect 12 0 14 0;
#P connect 11 0 15 0;
#P connect 15 0 12 2;
#P connect 10 0 9 0;
#P connect 9 0 1 0;
#P connect 8 0 7 0;
#P connect 7 0 0 0;
#P connect 5 0 4 0;
#P connect 4 0 2 0;
#P connect 2 0 3 0;
#P window clipboard copycount 20;

#109555
Jul 27, 2007 at 5:38am

I used to do it this way, but then jkc showed me the light: glue
matrices in one wide matrix and use jit.repos.
I have an old example of this, but won’t be able to post it until
later tonight.

> #P newex 604 186 107 196617 jit.op @op == @val 3.;
> #P newex 549 223 65 196617 jit.op @op *;

#109556
Jul 28, 2007 at 10:52am

And here’s the example, the main stuff is in ‘parts’ subpatch.
The ‘control’ matrix comes into right inlet of jit.repos. The
‘control’ matrix is created in main patch, by simplifying input from
qt.movie.
Each color (red,green,blue,yellow) represents one layer. Instead of
color matrices, 4 jit.qt.movies can be used as layers, creating a
sort of collage…

-nesa

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P hidden newex 14 212 38 196617 gate 1;
#P comment 122 313 79 196617 layer contnent:;
#P user umenu 205 311 58 196647 1 64 327 1;
#X add color;
#X add movie;
#P message 544 67 85 196617 64 128 192 255;
#P newex 544 89 82 196617 jit.fill posterize;
#P hidden message 463 68 76 196617 read bball.mov;
#N vpatcher 76 70 606 510;
#P window setfont “Sans Serif” 9.;
#P message 199 181 21 196617 13.;
#P message 161 180 16 196617 5.;
#P newex 207 117 44 196617 loadbang;
#P newex 112 315 140 196617 jit.scanslide @dimmode 1;
#B color 5;
#P number 396 208 35 9 0 1 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 396 229 62 196617 dimmode $1;
#P number 338 208 35 9 0 2 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 338 229 45 196617 mode $1;
#P number 276 208 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 276 229 50 196617 offset $1;
#P flonum 196 207 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 196 229 73 196617 slide_down $1;
#P flonum 133 207 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 133 229 60 196617 slide_up $1;
#P newex 96 291 140 196617 jit.scanslide @dimmode 0;
#B color 5;
#P newex 22 339 191 196617 jit.matrix 4 char 320 240 @interp 1;
#P outlet 18 388 15 0;
#P inlet 16 205 15 0;
#P connect 2 0 1 0;
#P connect 14 0 2 0;
#P fasten 8 0 3 0 281 272 101 272;
#P fasten 4 0 3 0 138 272 101 272;
#P connect 0 0 3 0;
#P fasten 12 0 3 0 401 272 101 272;
#P fasten 10 0 3 0 343 272 101 272;
#P fasten 6 0 3 0 201 272 101 272;
#P connect 8 0 14 0;
#P connect 6 0 14 0;
#P connect 4 0 14 0;
#P connect 3 0 14 0;
#P connect 16 0 5 0;
#P connect 5 0 4 0;
#P connect 15 0 16 0;
#P connect 17 0 7 0;
#P connect 7 0 6 0;
#P connect 15 0 17 0;
#P connect 9 0 8 0;
#P connect 11 0 10 0;
#P connect 13 0 12 0;
#P pop;
#P newobj 370 173 50 196617 p smooth;
#N vpatcher 163 131 609 562;
#P inlet 28 40 15 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#N vpatcher 54 74 654 474;
#P window setfont “Sans Serif” 9.;
#P newex 50 108 58 196617 switch 2 1;
#N vpatcher 54 74 654 474;
#P window setfont “Sans Serif” 9.;
#P window linecount 0;
#P newex 114 50 48 196617 loadbang;
#P message 114 74 83 196617 setall 0. 1. 1. 0.;
#P newex 50 93 129 196617 jit.matrix 4 char 320 240;
#P window linecount 1;
#P newex 50 50 56 196617 r mainmet;
#P outlet 50 115 15 0;
#P connect 3 0 2 0;
#P connect 1 0 2 0;
#P connect 2 0 0 0;
#P connect 4 0 3 0;
#P pop;
#P newobj 74 50 48 196617 p yellow;
#N vpatcher 54 74 654 474;
#P window setfont “Sans Serif” 9.;
#P newex 51 42 58 196617 r alllayers;
#P flonum 251 54 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 251 74 44 196617 rate $1;
#P number 211 53 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 211 74 43 196617 loop $1;
#P number 165 55 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 165 74 52 196617 frame $1;
#P message 132 75 33 196617 start;
#P message 102 74 29 196617 stop;
#P message 71 74 30 196617 read;
#P newex 50 119 142 196617 jit.qt.movie 320 240 @vol 0.;
#P outlet 50 153 15 0;
#P connect 4 0 1 0;
#P connect 3 0 1 0;
#P connect 2 0 1 0;
#P connect 9 0 1 0;
#P connect 7 0 1 0;
#P connect 5 0 1 0;
#P connect 11 0 1 0;
#P connect 1 0 0 0;
#P connect 6 0 5 0;
#P connect 8 0 7 0;
#P connect 10 0 9 0;
#P pop;
#P newobj 98 79 54 196617 p qtmovie;
#P inlet 50 88 15 0;
#P outlet 50 130 15 0;
#P connect 1 0 4 0;
#P connect 4 0 0 0;
#P connect 3 0 4 1;
#P connect 2 0 4 2;
#P pop;
#P newobj 283 115 39 196617 p src4;
#N vpatcher 54 74 654 474;
#P window setfont “Sans Serif” 9.;
#P newex 50 108 58 196617 switch 2 1;
#N vpatcher 54 74 654 474;
#P window setfont “Sans Serif” 9.;
#P window linecount 0;
#P newex 114 50 48 196617 loadbang;
#P message 114 74 83 196617 setall 0. 0. 0. 1.;
#P newex 50 93 129 196617 jit.matrix 4 char 320 240;
#P window linecount 1;
#P newex 50 50 56 196617 r mainmet;
#P outlet 50 115 15 0;
#P connect 3 0 2 0;
#P connect 1 0 2 0;
#P connect 2 0 0 0;
#P connect 4 0 3 0;
#P pop;
#P newobj 74 50 36 196617 p blue;
#N vpatcher 54 74 654 474;
#P window setfont “Sans Serif” 9.;
#P newex 51 42 58 196617 r alllayers;
#P flonum 251 54 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 251 74 44 196617 rate $1;
#P number 211 53 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 211 74 43 196617 loop $1;
#P number 165 55 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 165 74 52 196617 frame $1;
#P message 132 75 33 196617 start;
#P message 102 74 29 196617 stop;
#P message 71 74 30 196617 read;
#P newex 50 119 142 196617 jit.qt.movie 320 240 @vol 0.;
#P outlet 50 153 15 0;
#P connect 11 0 1 0;
#P connect 5 0 1 0;
#P connect 7 0 1 0;
#P connect 9 0 1 0;
#P connect 2 0 1 0;
#P connect 3 0 1 0;
#P connect 4 0 1 0;
#P connect 1 0 0 0;
#P connect 6 0 5 0;
#P connect 8 0 7 0;
#P connect 10 0 9 0;
#P pop;
#P newobj 98 79 54 196617 p qtmovie;
#P inlet 50 88 15 0;
#P outlet 50 130 15 0;
#P connect 1 0 4 0;
#P connect 4 0 0 0;
#P connect 3 0 4 1;
#P connect 2 0 4 2;
#P pop;
#P newobj 198 115 39 196617 p src3;
#N vpatcher 54 74 654 474;
#P window setfont “Sans Serif” 9.;
#P newex 50 108 58 196617 switch 2 1;
#N vpatcher 54 74 654 474;
#P window setfont “Sans Serif” 9.;
#P window linecount 0;
#P newex 114 50 48 196617 loadbang;
#P message 114 74 83 196617 setall 0. 0. 1. 0.;
#P newex 50 93 129 196617 jit.matrix 4 char 320 240;
#P window linecount 1;
#P newex 50 50 56 196617 r mainmet;
#P outlet 50 115 15 0;
#P connect 3 0 2 0;
#P connect 1 0 2 0;
#P connect 2 0 0 0;
#P connect 4 0 3 0;
#P pop;
#P newobj 74 50 43 196617 p green;
#N vpatcher 54 74 654 474;
#P window setfont “Sans Serif” 9.;
#P newex 51 42 58 196617 r alllayers;
#P flonum 251 54 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 251 74 44 196617 rate $1;
#P number 211 53 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 211 74 43 196617 loop $1;
#P number 165 55 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 165 74 52 196617 frame $1;
#P message 132 75 33 196617 start;
#P message 102 74 29 196617 stop;
#P message 71 74 30 196617 read;
#P newex 50 119 142 196617 jit.qt.movie 320 240 @vol 0.;
#P outlet 50 153 15 0;
#P connect 4 0 1 0;
#P connect 3 0 1 0;
#P connect 2 0 1 0;
#P connect 9 0 1 0;
#P connect 7 0 1 0;
#P connect 5 0 1 0;
#P connect 11 0 1 0;
#P connect 1 0 0 0;
#P connect 6 0 5 0;
#P connect 8 0 7 0;
#P connect 10 0 9 0;
#P pop;
#P newobj 98 79 54 196617 p qtmovie;
#P inlet 50 88 15 0;
#P outlet 50 130 15 0;
#P connect 1 0 4 0;
#P connect 4 0 0 0;
#P connect 3 0 4 1;
#P connect 2 0 4 2;
#P pop;
#P newobj 113 115 39 196617 p src2;
#P window linecount 0;
#N vpatcher 54 74 654 474;
#P window setfont “Sans Serif” 9.;
#P newex 50 108 58 196617 switch 2 1;
#N vpatcher 54 74 654 474;
#P window setfont “Sans Serif” 9.;
#P window linecount 0;
#P newex 114 50 48 196617 loadbang;
#P message 114 74 83 196617 setall 0. 1. 0. 0.;
#P newex 50 93 129 196617 jit.matrix 4 char 320 240;
#P window linecount 1;
#P newex 50 50 56 196617 r mainmet;
#P outlet 50 115 15 0;
#P connect 3 0 2 0;
#P connect 1 0 2 0;
#P connect 2 0 0 0;
#P connect 4 0 3 0;
#P pop;
#P newobj 74 50 33 196617 p red;
#N vpatcher 54 74 654 474;
#P window setfont “Sans Serif” 9.;
#P newex 51 42 58 196617 r alllayers;
#P flonum 251 54 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 251 74 44 196617 rate $1;
#P number 211 53 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 211 74 43 196617 loop $1;
#P number 165 55 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 165 74 52 196617 frame $1;
#P message 132 75 33 196617 start;
#P message 102 74 29 196617 stop;
#P message 71 74 30 196617 read;
#P newex 50 119 142 196617 jit.qt.movie 320 240 @vol 0.;
#P outlet 50 153 15 0;
#P connect 11 0 1 0;
#P connect 5 0 1 0;
#P connect 7 0 1 0;
#P connect 9 0 1 0;
#P connect 2 0 1 0;
#P connect 3 0 1 0;
#P connect 4 0 1 0;
#P connect 1 0 0 0;
#P connect 6 0 5 0;
#P connect 8 0 7 0;
#P connect 10 0 9 0;
#P pop;
#P newobj 98 79 54 196617 p qtmovie;
#P inlet 50 88 15 0;
#P outlet 50 130 15 0;
#P connect 1 0 4 0;
#P connect 4 0 0 0;
#P connect 3 0 4 1;
#P connect 2 0 4 2;
#P pop;
#P newobj 28 115 39 196617 p src1;
#P newex 28 61 27 196617 + 1;
#P newex 184 281 116 196617 jit.pack 2 long 320 240;
#P newex 184 224 127 196617 jit.matrix 1 long 320 240;
#P newex 184 254 102 196617 jit.op @op * @val 4.;
#P newex 184 192 39 196617 r luma;
#P newex 28 307 166 196617 jit.repos 4 char 320 240 @mode 1;
#P newex 28 150 265 196617 jit.glue @columns 4 @rows 1;
#P outlet 28 352 15 0;
#P connect 12 0 7 0;
#P connect 7 0 8 0;
#P connect 8 0 1 0;
#P connect 1 0 2 0;
#P connect 2 0 0 0;
#P fasten 7 0 9 0 33 96 118 96;
#P connect 9 0 1 1;
#P connect 3 0 5 0;
#P connect 5 0 4 0;
#P connect 4 0 6 0;
#P connect 6 0 2 1;
#P fasten 7 0 10 0 33 96 203 96;
#P connect 10 0 1 2;
#P fasten 7 0 11 0 33 96 288 96;
#P connect 11 0 1 3;
#P pop;
#P newobj 205 339 76 196617 p parts;
#P user jit.fpsgui 205 408 60 196617 0;
#P message 303 363 68 196617 fullscreen $1;
#P toggle 286 363 15 0;
#P newex 328 338 35 196617 sel 27;
#P newex 286 338 40 196617 key;
#P newex 303 389 242 196617 jit.window 320 250 @interp 1 @floating 1
@sync 0;
#P newex 72 123 51 196617 s mainmat;
#P newex 370 252 34 196617 s luma;
#P newex 14 180 56 196617 r mainmet;
#P newex 76 53 51 196617 s mainmet;
#P flonum 248 160 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 2;
#P message 248 180 34 196617 rate $1;
#P number 208 159 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 208 180 34 196617 loop $1;
#P number 162 161 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 162 180 44 196617 frame $1;
#P message 129 181 27 196617 start;
#P window linecount 1;
#P message 97 188 26 196617 stop;
#P message 78 166 26 196617 read;
#P newex 67 257 58 196617 s alllayers;
#P newex 370 120 94 196617 jit.rgb2luma;
#P number 302 32 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 302 53 43 196617 loop $1;
#P newex 544 42 44 196617 loadbang;
#P user jit.pwindow 485 146 83 21 1 0 0 0 1 0;
#P button 486 93 15 0;
#P newex 486 120 141 196617 jit.matrix posterize 1 char 4;
#P newex 370 147 99 196617 jit.charmap;
#P number 235 34 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 235 53 52 196617 frame $1;
#P message 199 53 33 196617 start;
#P message 169 53 26 196617 stop;
#P message 138 53 26 196617 read;
#P number 46 21 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 12 21 15 0;
#P newex 12 42 57 196617 qmetro 40;
#P newex 12 79 100 196617 jit.qt.movie @vol 0.;
#P comment 234 267 60 196617 all 4 movies;
#P user panel 5 150 295 134;
#X brgb 203 208 226;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P hidden connect 44 0 46 0;
#P lcolor 1;
#P connect 44 0 39 0;
#P hidden connect 46 0 19 0;
#P hidden connect 30 0 46 1;
#P connect 39 0 38 0;
#P fasten 39 0 33 0 210 384 308 384;
#P connect 43 0 42 0;
#P hidden connect 15 0 41 0;
#P connect 15 0 43 0;
#P fasten 12 0 11 1 491 142 464 142;
#P connect 12 0 14 0;
#P connect 42 0 12 0;
#P connect 13 0 12 0;
#P connect 40 0 31 0;
#P connect 11 0 40 0;
#P connect 18 0 11 0;
#P fasten 2 0 32 0 17 109 77 109;
#P fasten 2 0 18 0 17 104 375 104;
#P fasten 34 0 35 0 327 355 327 340;
#P connect 37 0 33 0;
#P fasten 36 0 37 0 302 378 302 363;
#P connect 17 0 16 0;
#P fasten 35 0 36 0 333 360 291 360;
#P connect 28 0 27 0;
#P connect 10 0 9 0;
#P connect 26 0 25 0;
#P connect 24 0 23 0;
#P connect 3 0 2 0;
#P fasten 3 0 29 0 17 65 71 65 71 48 81 48;
#P connect 27 0 19 0;
#P connect 25 0 19 0;
#P connect 23 0 19 0;
#P connect 22 0 19 0;
#P connect 21 0 19 0;
#P connect 20 0 19 0;
#P connect 5 0 3 1;
#P fasten 9 0 2 0 240 73 17 73;
#P fasten 8 0 2 0 204 73 17 73;
#P fasten 7 0 2 0 174 73 17 73;
#P fasten 6 0 2 0 143 73 17 73;
#P fasten 16 0 2 0 307 73 17 73;
#P hidden connect 41 0 2 0;
#P connect 4 0 3 0;
#P window clipboard copycount 47;

#109557

You must be logged in to reply to this topic.