swap alpha channels with jit.unpack jit.pack

Aug 14, 2006 at 8:59pm

On Aug 14, 2006, at 8:09 PM, Timothy Devine wrote:

>
> I am stumped… it’s frustrating when you see a problem as going to
> be easy to solve and it turns out to be real challenge.
>
> All I want to do is use a difference key as a revealing mask on
> another video and then composit that over another video… i have
> spent two days on this… I have no idea why it is not working!
>
> here is an example of what i want to do, and how i think it sould
> work, it works ok but am sure there is an easier way.

You need to explain better what exactly you want to do and what apect
of your patch is not working for you. Your patch seems to work as
expected by your patch design as far as I can tell. I’m not sure why
you’re subtracting the red difference key from the chilis.jpg, but I
assume you have a reason for that. I’m also not sure why you’re
alphablending with colorwheel and then trying to do a luminance key
to it. However, perhaps this is just for illustration and there would
otherwise be a fourth stream for the luminance key. Hard to say.

Otherwise your patch seems simple and an appropriate way to achieve
what I believe you’re describing. I’ve attached a version of a
difference keying example I use when teaching at bottom. It only
makes a binary mask, but is otherwise similar to what you are doing
prior to the luminance key.

You could speed things up a bit if you use 1 plane matrices for your
lowpass filter, and the absdiff operator, replacing jit.brcosa with
jit.charmap or jit.map. Alternately, you could make much faster using
the GPU, but that will be more involved. Once you get it working on
the CPU, you might then look at porting your algorithm to a single
shader for the GPU.

-Joshua

#P window setfont “Sans Serif” 9.;
#P flonum 697 161 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P message 697 182 42 196617 rate $1;
#P message 666 182 28 196617 read;
#P flonum 637 161 35 9 0.5 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 603 161 15 0;
#P newex 603 181 44 196617 metro 2;
#P newex 603 221 104 196617 jit.qt.movie 320 240;
#P newex 415 268 69 196617 jit.alphablend;
#P user jit.pwindow 414 292 322 242 0 1 0 0 1 0;
#P newex 415 216 131 196617 jit.pack @out_name charlie;
#P newex 438 143 88 196617 jit.matrix charlie;
#P window linecount 6;
#P comment 181 549 140 196617 this mask could be improved using erode/
dilate morphological operations. see jit.convolve-morphop.pat example
or Jean marc Pelletier’s cv.jit externals;
#P window linecount 2;
#P comment 100 405 153 196617 average color components and work with
greyscale difference;
#P window linecount 1;
#P newex 16 434 235 196617 jit.rgb2luma @rscale 0.3 @gscale 0.3
@bscale 0.3;
#P user jit.fpsgui 16 678 60 196617 0;
#P message 179 65 45 196617 settings;
#P message 137 65 32 196617 close;
#P comment 182 523 100 196617 mask;
#P comment 154 457 100 196617 threshold;
#P user jit.pwindow 15 512 162 122 0 0 0 0 1 0;
#P flonum 111 457 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 16 480 111 196617 jit.op @op > @val 0.15;
#P window linecount 2;
#P comment 226 164 162 196617 background averaging coefficient
(larger values smoother);
#P flonum 183 168 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P message 183 193 133 196617 slide_up $1 , slide_down $1;
#P newex 94 214 171 196617 jit.slide @slide_up 2 @slide_down 2;
#P toggle 94 144 15 0;
#P newex 94 164 27 196617 gate;
#P newex 16 239 88 196617 jit.op @op absdiff;
#P message 94 65 29 196617 open;
#P flonum 50 45 35 9 0.5 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 16 45 15 0;
#P newex 16 65 44 196617 metro 2;
#P newex 16 103 146 196617 jit.qt.grab 320 240 @unique 1;
#P user jit.pwindow 15 268 162 122 0 0 0 0 1 0;
#P comment 184 279 100 196617 difference;
#P window setfont “Sans Serif” 18.;
#P comment 146 27 496 196626 crude example of background elimination.;
#P window setfont “Sans Serif” 9.;
#P window linecount 2;
#P comment 125 132 176 196617 to set background , open gate for some
period of time and then close gate;
#P comment 458 107 195 196617 using named matrix charlie to
efficiently merge alpha channel in jit.pack below;
#P connect 7 0 6 0;
#P fasten 23 0 5 0 184 91 21 91;
#P fasten 22 0 5 0 142 91 21 91;
#P fasten 9 0 5 0 99 91 21 91;
#P fasten 6 0 5 0 21 96 21 96;
#P connect 5 0 10 0;
#P connect 10 0 4 0;
#P connect 4 0 25 0;
#P connect 25 0 17 0;
#P connect 17 0 19 0;
#P connect 19 0 24 0;
#P connect 8 0 6 1;
#P connect 12 0 11 0;
#P fasten 14 0 13 0 188 211 99 211;
#P connect 11 0 13 0;
#P connect 13 0 10 1;
#P fasten 5 0 11 1 21 128 116 128;
#P connect 18 0 17 1;
#P connect 15 0 14 0;
#P fasten 19 0 29 0 21 646 384 646 384 205 420 205;
#P connect 29 0 31 0;
#P connect 31 0 30 0;
#P fasten 5 0 28 0 21 123 443 123;
#P fasten 32 0 31 1 608 253 479 253;
#P connect 34 0 33 0;
#P connect 37 0 32 0;
#P connect 36 0 32 0;
#P connect 33 0 32 0;
#P connect 35 0 33 1;
#P connect 38 0 37 0;
#P window clipboard copycount 39;

#81947
Aug 15, 2006 at 3:09am

swap alpha channels with jit.unpack jit.pack

I am stumped… it’s frustrating when you see a problem as going to be easy to solve and it turns out to be real challenge.

All I want to do is use a difference key as a revealing mask on another video and then composit that over another video… i have spent two days on this… I have no idea why it is not working!

here is an example of what i want to do, and how i think it sould work, it works ok but am sure there is an easier way.

thanks,

tim

max v2;
#N vpatcher 10 59 1363 892;
#P window setfont “Sans Serif” 9.;
#P newex 313 465 61 196617 jit.lumakey;
#B color 5;
#P newex 313 331 64 196617 jit.op @op ~;
#P newex 313 299 63 196617 jit.op @op -;
#P newex 143 139 45 196617 loadbang;
#P message 143 162 17 196617 1.;
#P flonum 189 197 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 44 197 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 121 197 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 189 216 69 196617 saturation $1;
#P message 44 216 70 196617 brightness $1;
#P message 121 216 61 196617 contrast $1;
#P newex 352 245 118 196617 jit.brcosa @contrast 10;
#B color 5;
#P message 672 97 99 196617 read colorwheel.jpg;
#P message 497 98 74 196617 read chilis.jpg;
#P user jit.pwindow 792 199 343 578 0 1 0 0 1 0;
#P newex 313 425 70 196617 jit.alphablend;
#B color 5;
#P newex 476 274 66 196617 jit.unpack;
#B color 5;
#P newex 313 387 53 196617 jit.pack;
#B color 5;
#P newex 352 271 66 196617 jit.unpack;
#B color 5;
#P message 401 92 33 196617 close;
#P window linecount 2;
#P newex 350 149 106 196617 jit.slide @slide_up 30 @slide_down 30;
#B color 5;
#P window linecount 1;
#P newex 271 189 89 196617 jit.op @op absdiff;
#P message 364 93 30 196617 open;
#P newex 350 122 98 196617 jit.qt.grab 341 576;
#P newex 656 120 105 196617 jit.qt.movie 341 576;
#P toggle 454 29 15 0;
#P newex 454 49 57 196617 qmetro 33;
#P newex 476 119 105 196617 jit.qt.movie 341 576;
#P fasten 23 0 21 0 148 187 49 187;
#P connect 21 0 18 0;
#P fasten 23 0 20 0 148 187 126 187;
#P connect 20 0 17 0;
#P connect 24 0 23 0;
#P fasten 23 0 22 0 148 187 194 187;
#P connect 22 0 19 0;
#P connect 4 0 6 0;
#P fasten 11 0 25 0 481 295 318 295;
#P connect 25 0 26 0;
#P connect 26 0 10 0;
#P connect 10 0 12 0;
#P connect 12 0 27 0;
#P connect 11 1 10 1;
#P connect 11 2 10 2;
#P fasten 1 0 4 0 459 88 355 88;
#P fasten 8 0 4 0 406 114 355 114;
#P fasten 5 0 4 0 369 114 355 114;
#P connect 4 0 7 0;
#P connect 7 0 6 1;
#P fasten 19 0 16 0 194 241 357 241;
#P fasten 18 0 16 0 49 241 357 241;
#P fasten 17 0 16 0 126 241 357 241;
#P fasten 6 0 16 0 276 219 357 219;
#P connect 16 0 9 0;
#P connect 11 3 10 3;
#P fasten 3 0 27 1 661 458 369 458;
#P connect 9 1 25 1;
#P fasten 3 0 12 1 661 411 378 411;
#P connect 2 0 1 0;
#P fasten 1 0 0 0 459 88 481 88;
#P connect 14 0 0 0;
#P connect 0 0 11 0;
#P fasten 1 0 3 0 459 88 661 88;
#P connect 15 0 3 0;
#P fasten 27 0 13 0 318 509 721 509 721 182 798 182;
#P pop;

#27160
Aug 15, 2006 at 7:18am

Hi joshua,

Thanks!

here is an updated version that shows you what i want to do. I took your advice with the GPU stuff … i think i get it, it works much faster!

thanks for your help

max v2;
#N vpatcher 111 44 1464 877;
#P origin -28 22;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P comment 684 202 165 196617 movie 2;
#P comment 865 200 165 196617 movie 3;
#P window linecount 4;
#P comment 649 317 165 196617 the idea is that you wave infront of the camera and reveal the alpha image (movie 2) ontop of the image to composite onto (movie3);
#P window linecount 1;
#P comment 906 154 165 196617 an image to composite on to;
#P comment 727 159 113 196617 an image with an alpha;
#P newex 227 440 261 196617 jit.gl.slab foo @file cc.contrast.ip.jxs @param alpha -1.;
#P newex 229 387 226 196617 jit.gl.slab foo @file cf.blur.jxs @param width 8.;
#P newex 234 362 239 196617 jit.gl.slab foo @file cf.dilate.jxs @param width 10.;
#P newex 227 469 256 196617 jit.gl.slab foo @file cc.saturate.ip.jxs @param alpha 0.;
#P newex 367 283 70 196617 jit.gl.slab foo;
#P window linecount 3;
#P newex 367 233 140 196617 jit.gl.slab foo @file tp.slide.jxs @param slide_up 10 @param slide_down 10;
#P window linecount 1;
#P newex 280 554 129 196617 jit.matrix 4 char 341 576;
#P newex 227 416 268 196617 jit.gl.slab foo @file co.subtractive.jxs @param amount 1.;
#P newex 241 325 161 196617 jit.gl.slab foo @file op.absdiff.jxs;
#P newex 19 592 169 196617 jit.gl.videoplane foo @scale 1. 1. 1.;
#P toggle 274 23 15 0;
#P message 274 41 59 196617 floating $1;
#P toggle 201 23 15 0;
#P newex 162 22 35 196617 sel 27;
#P message 201 41 68 196617 fullscreen $1;
#P newex 119 65 145 196617 jit.window foo @depthbuffer 1;
#P newex 117 22 40 196617 key;
#P user jit.fpsgui 99 173 60 196617 0;
#P newex 77 122 55 196617 t b b erase;
#P newex 77 217 80 196617 jit.gl.render foo;
#P user jit.fpsgui 278 705 60 196617 0;
#P hidden newex 645 44 48 196617 loadbong;
#P newex 278 650 61 196617 jit.lumakey;
#B color 5;
#P message 871 158 30 196617 read;
#P message 696 159 30 196617 read;
#P user jit.pwindow 992 324 343 578 0 1 0 0 1 0;
#P newex 278 620 70 196617 jit.alphablend;
#B color 5;
#P newex 675 226 66 196617 jit.unpack;
#B color 5;
#P newex 277 585 53 196617 jit.pack;
#B color 5;
#P message 600 153 33 196617 close;
#P message 563 154 30 196617 open;
#P newex 549 183 98 196617 jit.qt.grab 341 576;
#P newex 855 181 105 196617 jit.qt.movie 341 576;
#P toggle 653 90 15 0;
#P newex 651 108 51 196617 qmetro 1;
#P newex 675 180 105 196617 jit.qt.movie 341 576;
#P window linecount 3;
#P comment 234 516 100 196617 from saturate into the alpha of this image;
#P connect 33 0 27 0;
#P connect 2 0 18 0;
#P fasten 18 2 17 0 126 155 82 155;
#P connect 18 0 17 0;
#P connect 18 1 19 0;
#P fasten 25 0 21 0 279 60 124 60;
#P fasten 22 0 21 0 206 60 124 60;
#P fasten 20 0 23 0 122 41 159 41 159 20 167 20;
#P fasten 23 0 24 0 167 40 198 40 198 20 206 20;
#P connect 24 0 22 0;
#P connect 35 0 29 0;
#P connect 29 0 36 0;
#P connect 36 0 33 0;
#P connect 34 0 35 0;
#P connect 28 0 34 0;
#P connect 5 0 28 0;
#P connect 26 0 25 0;
#P connect 30 0 8 0;
#P connect 8 0 10 0;
#P connect 10 0 14 0;
#P connect 14 0 16 0;
#P connect 9 1 8 1;
#P connect 9 2 8 2;
#P connect 9 3 8 3;
#P fasten 4 0 14 1 860 622 334 622;
#P connect 1 0 10 1;
#P connect 5 0 31 0;
#P connect 31 0 32 0;
#P fasten 32 0 28 1 372 309 397 309;
#P connect 9 0 29 1;
#P fasten 32 0 31 1 372 305 541 305 541 228 502 228;
#P fasten 2 0 5 0 656 149 554 149;
#P fasten 6 0 5 0 568 175 554 175;
#P fasten 7 0 5 0 605 175 554 175;
#P hidden connect 15 0 6 0;
#P connect 3 0 2 0;
#P hidden connect 15 0 3 0;
#P connect 2 0 1 0;
#P connect 12 0 1 0;
#P connect 1 0 9 0;
#P hidden connect 15 0 12 0;
#P connect 2 0 4 0;
#P connect 13 0 4 0;
#P hidden connect 15 0 13 0;
#P fasten 14 0 11 0 283 658 921 658 921 307 998 307;
#P pop;

#81948
Aug 15, 2006 at 7:18am

Hi joshua,

Thanks!

here is an updated version that shows you what i want to do. I took your advice with the GPU stuff … i think i get it, it works much faster!

thanks for your help

max v2;
#N vpatcher 111 44 1464 877;
#P origin -28 22;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P comment 684 202 165 196617 movie 2;
#P comment 865 200 165 196617 movie 3;
#P window linecount 4;
#P comment 649 317 165 196617 the idea is that you wave infront of the camera and reveal the alpha image (movie 2) ontop of the image to composite onto (movie3);
#P window linecount 1;
#P comment 906 154 165 196617 an image to composite on to;
#P comment 727 159 113 196617 an image with an alpha;
#P newex 227 440 261 196617 jit.gl.slab foo @file cc.contrast.ip.jxs @param alpha -1.;
#P newex 229 387 226 196617 jit.gl.slab foo @file cf.blur.jxs @param width 8.;
#P newex 234 362 239 196617 jit.gl.slab foo @file cf.dilate.jxs @param width 10.;
#P newex 227 469 256 196617 jit.gl.slab foo @file cc.saturate.ip.jxs @param alpha 0.;
#P newex 367 283 70 196617 jit.gl.slab foo;
#P window linecount 3;
#P newex 367 233 140 196617 jit.gl.slab foo @file tp.slide.jxs @param slide_up 10 @param slide_down 10;
#P window linecount 1;
#P newex 280 554 129 196617 jit.matrix 4 char 341 576;
#P newex 227 416 268 196617 jit.gl.slab foo @file co.subtractive.jxs @param amount 1.;
#P newex 241 325 161 196617 jit.gl.slab foo @file op.absdiff.jxs;
#P newex 19 592 169 196617 jit.gl.videoplane foo @scale 1. 1. 1.;
#P toggle 274 23 15 0;
#P message 274 41 59 196617 floating $1;
#P toggle 201 23 15 0;
#P newex 162 22 35 196617 sel 27;
#P message 201 41 68 196617 fullscreen $1;
#P newex 119 65 145 196617 jit.window foo @depthbuffer 1;
#P newex 117 22 40 196617 key;
#P user jit.fpsgui 99 173 60 196617 0;
#P newex 77 122 55 196617 t b b erase;
#P newex 77 217 80 196617 jit.gl.render foo;
#P user jit.fpsgui 278 705 60 196617 0;
#P hidden newex 645 44 48 196617 loadbong;
#P newex 278 650 61 196617 jit.lumakey;
#B color 5;
#P message 871 158 30 196617 read;
#P message 696 159 30 196617 read;
#P user jit.pwindow 992 324 343 578 0 1 0 0 1 0;
#P newex 278 620 70 196617 jit.alphablend;
#B color 5;
#P newex 675 226 66 196617 jit.unpack;
#B color 5;
#P newex 277 585 53 196617 jit.pack;
#B color 5;
#P message 600 153 33 196617 close;
#P message 563 154 30 196617 open;
#P newex 549 183 98 196617 jit.qt.grab 341 576;
#P newex 855 181 105 196617 jit.qt.movie 341 576;
#P toggle 653 90 15 0;
#P newex 651 108 51 196617 qmetro 1;
#P newex 675 180 105 196617 jit.qt.movie 341 576;
#P window linecount 3;
#P comment 234 516 100 196617 from saturate into the alpha of this image;
#P connect 33 0 27 0;
#P connect 2 0 18 0;
#P fasten 18 2 17 0 126 155 82 155;
#P connect 18 0 17 0;
#P connect 18 1 19 0;
#P fasten 25 0 21 0 279 60 124 60;
#P fasten 22 0 21 0 206 60 124 60;
#P fasten 20 0 23 0 122 41 159 41 159 20 167 20;
#P fasten 23 0 24 0 167 40 198 40 198 20 206 20;
#P connect 24 0 22 0;
#P connect 35 0 29 0;
#P connect 29 0 36 0;
#P connect 36 0 33 0;
#P connect 34 0 35 0;
#P connect 28 0 34 0;
#P connect 5 0 28 0;
#P connect 26 0 25 0;
#P connect 30 0 8 0;
#P connect 8 0 10 0;
#P connect 10 0 14 0;
#P connect 14 0 16 0;
#P connect 9 1 8 1;
#P connect 9 2 8 2;
#P connect 9 3 8 3;
#P fasten 4 0 14 1 860 622 334 622;
#P connect 1 0 10 1;
#P connect 5 0 31 0;
#P connect 31 0 32 0;
#P fasten 32 0 28 1 372 309 397 309;
#P connect 9 0 29 1;
#P fasten 32 0 31 1 372 305 541 305 541 228 502 228;
#P fasten 2 0 5 0 656 149 554 149;
#P fasten 6 0 5 0 568 175 554 175;
#P fasten 7 0 5 0 605 175 554 175;
#P hidden connect 15 0 6 0;
#P connect 3 0 2 0;
#P hidden connect 15 0 3 0;
#P connect 2 0 1 0;
#P connect 12 0 1 0;
#P connect 1 0 9 0;
#P hidden connect 15 0 12 0;
#P connect 2 0 4 0;
#P connect 13 0 4 0;
#P hidden connect 15 0 13 0;
#P fasten 14 0 11 0 283 658 921 658 921 307 998 307;
#P pop;

#81949
Aug 15, 2006 at 7:50pm

Hi Timothy,
If you are using Jitter 1.6, you should have a look at the
cc.alphaglue.jxs shader with param lum2alpha 1. This will take the
luminance of the second input and use that as the alpha channel for the
left input. You will then need an alphablend shader, which I have so
kindly offered below. Save the following text as co.alphablend.jxs and
throw it in your jitter-shaders/composite folder.

Let me know how you get on with that.

//Andrew Benson



alphablending composite operator




< ![CDATA[

// texcoords
varying vec2 texcoord0;
varying vec2 texcoord1;

// samplers
uniform sampler2DRect tex0;
uniform sampler2DRect tex1;

void main()
{
vec4 a = texture2DRect(tex0, texcoord0);
vec4 b = texture2DRect(tex1, texcoord1);

//do alphablend
vec3 mixr = mix(a.rgb,b.rgb,1.-a.a);
//set output alpha to 1.
gl_FragColor = vec4(mixr,1.);
}

]]>

#81950
Aug 16, 2006 at 12:44am

Thanks Andrew!

It seems like the right way to go. My only problem is the Erase from the trigger object erases my absdiff slab, so I can’t create a mask. also i am not sure if the alphablending composite operator was all that was supposed to be in the text file that i created and copied into my jitter-shaders/composite folder. the shader I created does not detect it.

Thanks again it is much simpler!

I will keep trying with the alphablending composite operator, do not really understand it fully. my patch is below.

tim

max v2;
#N vpatcher 528 44 1440 898;
#P origin 0 -21;
#P window setfont “Sans Serif” 9.;
#P window linecount 3;
#P comment 180 167 64 196617 the erase is negating my absdiff;
#P window linecount 4;
#P comment 250 178 136 196617 not sure if this is what i was supposed to do? it seems right but does not detect the shader file.;
#P window linecount 1;
#P message 706 132 93 196617 getparamtype amp;
#P message 714 151 87 196617 getparamval amp;
#P message 642 151 67 196617 getparamlist;
#P newex 524 203 32 196617 print;
#P newex 316 152 70 196617 prepend dump;
#P user ubumenu 316 126 72 196617 0 1 1 0;
#X add params;
#X add source;
#X add assembly;
#X prefix_set 0 0 0;
#X pattrmode 1;
#P newex 316 95 72 196617 prepend prefer;
#P user ubumenu 316 69 72 196617 0 1 1 0;
#X add auto;
#X add glsl;
#X add cg;
#X add arb;
#X add nv;
#X prefix_set 0 0
0;
#X pattrmode 1;
#P newex 204 95 71 196617 prepend read;
#P user ubumenu 204 69 108 196617 0 1 1 0;
#X add audio;
#X add audio/ap.chorus.jxs;
#X add audio/ap.compress.jxs;
#X add audio/ap.delay.jxs;
#X add audio/ap.highpass.jxs;
#X add audio/ap.lowpass.jxs;
#X add audio/ap.noisegate.jxs;
#X add audio/ap.normalize.jxs;
#X add color;
#X add color/cc.alphaglue.jxs;
#X add color/cc.brightness.ip.jxs;
#X add color/cc.colormap.jxs;
#X add color/cc.contrast.ip.jxs;
#X add color/cc.exrdisplay.jxs;
#X add color/cc.planemap.jxs;
#X add color/cc.rgb2yuv.jxs;
#X add color/cc.saturate.ip.jxs;
#X add color/cc.scalebias.jxs;
#X add composite;
#X add composite/co.additive.jxs;
#X add composite/co.alphablend.jxs.rtf;
#X add composite/co.average.jxs;
#X add composite/co.brightlight.jxs;
#X add composite/co.burn.jxs;
#X add composite/co.chromakey.jxs;
#X add composite/co.darken.jxs;
#X add composite/co.difference.jxs;
#X add composite/co.dodge.jxs;
#X add composite/co.exclude.jxs;
#X add composite/co.freeze.jxs;
#X add composite/co.glow.jxs;
#X add composite/co.hardlight.jxs;
#X add composite/co.heat.jxs;
#X add composite/co.inverse.jxs;
#X add composite/co.lighten.jxs;
#X add composite/co.lumakey.jxs;
#X add composite/co.multiply.jxs;
#X add composite/co.negate.jxs;
#X add composite/co.normal.jxs;
#X add composite/co.overlay.jxs;
#X add composite/co.reflect.jxs;
#X add composite/co.screen.jxs;
#X add composite/co.softlight.jxs;
#X add composite/co.stamp.jxs;
#X add composite/co.subtractive.jxs;
#X add convolution;
#X add convolution/cf.blur.jxs;
#X add convolution/cf.convolve.jxs;
#X add convolution/cf.dilate.jxs;
#X add convolution/cf.edgedetect.jxs;
#X add convolution/cf.emboss.jxs;
#X add convolution/cf.erode.jxs;
#X add convolution/cf.gaussian.2p.jxs;
#X add convolution/cf.laplace.jxs;
#X add convolution/cf.median.2p.jxs;
#X add convolution/cf.radialblur.jxs;
#X add convolution/cf.sharpen.ip.jxs;
#X add convolution/cf.sharpen.jxs;
#X add convolution/cf.sobel.jxs;
#X add generator;
#X add generator/gn.bricks.aa.jxs;
#X add generator/gn.bricks.jxs;
#X add generator/gn.checker.aa.jxs;
#X add generator/gn.checker.jxs;
#X add generator/gn.crosstile.jxs;
#X add generator/gn.gloop.jxs;
#X add generator/gn.gnoise.2d.jxs;
#X add generator/gn.gradperm.png;
#X add generator/gn.spiderweb.jxs;
#X add generator/gn.spirals.jxs;
#X add generator/gn.stripes.aa.jxs;
#X add generator/gn.stripes.jxs;
#X add gpgpu;
#X add gpgpu/gp.binarysearch.jxs;
#X add gpgpu/gp.bitonicsort.jxs;
#X add gpgpu/gp.reduce.jxs;
#X add material;
#X add material/mat.glass.jxs;
#X add material/mat.gooch.jxs;
#X add material/mat.plastic.jxs;
#X add material/mat.polkadots.jxs;
#X add material/mat.shiny.jxs;
#X add material/mat.sinebump.jxs;
#X add material/mat.toon.jxs;
#X add material/mat.xray.jxs;
#X add math;
#X add math/op.abs.jxs;
#X add math/op.absdiff.jxs;
#X add math/op.acos.jxs;
#X add math/op.acosh.jxs;
#X add math/op.add.jxs;
#X add math/op.and.jxs;
#X add math/op.asin.jxs;
#X add math/op.asinh.jxs;
#X add math/op.atan.jxs;
#X add math/op.atan2.jxs;
#X add math/op.atanh.jxs;
#X add math/op.avg.jxs;
#X add math/op.ceil.jxs;
#X add math/op.cos.jxs;
#X add math/op.cosh.jxs;
#X add math/op.div.jxs;
#X add math/op.eq.jxs;
#X add math/op.eqp.jxs;
#X add math/op.exp.jxs;
#X add math/op.exp2.jxs;
#X add math/op.floor.jxs;
#X add math/op.fract.jxs;
#X add math/op.gt.jxs;
#X add math/op.gte.jxs;
#X add math/op.gtep.jxs;
#X add math/op.gtp.jxs;
#X add math/op.hypot.jxs;
#X add math/op.invert.jxs;
#X add math/op.invsqrt.jxs;
#X add math/op.ln.jxs;
#X add math/op.log10.jxs;
#X add math/op.log2.jxs;
#X add math/op.lt.jxs;
#X add math/op.lte.jxs;
#X add math/op.ltep.jxs;
#X add math/op.ltp.jxs;
#X add math/op.max.jxs;
#X add math/op.min.jxs;
#X add math/op.mod.jxs;
#X add math/op.mult.jxs;
#X add math/op.neq.jxs;
#X add math/op.neqp.jxs;
#X add math/op.normcos.jxs;
#X add math/op.normsin.jxs;
#X add math/op.not.jxs;
#X add math/op.or.jxs;
#X add math/op.pow.jxs;
#X add math/op.sign.jxs;
#X add math/op.sin.jxs;
#X add math/op.sinh.jxs;
#X add math/op.sqrt.jxs;
#X add math/op.sub.jxs;
#X add math/op.tan.jxs;
#X add math/op.tanh.jxs;
#X add math/op.xor.jxs;
#X add shared;
#X add shared/arb;
#X add shared/cg;
#X add shared/glsl;
#X add shared/licenses;
#X add specialfx;
#X add specialfx/fx.blobby.jxs;
#X add specialfx/fx.tiles.jxs;
#X add temporal;
#X add temporal/tp.slide.jxs;
#X add texdisplace;
#X add texdisplace/td.cartopol.jxs;
#X add texdisplace/td.fisheye.jxs;
#X add texdisplace/td.kaleido.jxs;
#X add texdisplace/td.lens.jxs;
#X add texdisplace/td.lumadisplace.jxs;
#X add texdisplace/td.mirror.jxs;
#X add texdisplace/td.repos.jxs;
#X add texdisplace/td.resample.jxs;
#X add texdisplace/td.ripples.jxs;
#X add texdisplace/td.rota.jxs;
#X add texdisplace/td.sinefold.jxs;
#X add texdisplace/td.twirl.jxs;
#X add texdisplace/td.wobble.jxs;
#X add transition;
#X add transition/tr.dissolve.jxs;
#X add transition/tr.edgeblend.jxs;
#X add transition/tr.gridwipe.jxs;
#X add transition/tr.shrinkwipe.jxs;
#X add transition/tr.vignettes.jxs;
#X add vertdisplace;
#X add vertdisplace/vd.gnoise.2d.jxs;
#X add vertdisplace/vd.gnoise.3d.jxs;
#X add vertdisplace/vd.twist.jxs;
#X add viz;
#X add viz/vz.normals.mdl.jxs;
#X add viz/vz.normals.view.jxs;
#X add viz/vz.texcoords.jxs;
#X prefix_set 0 1 c74:/jitter-shaders/ 1;
#X pattrmode 1;
#P flonum 641 22 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 641 45 73 196617 param amp $1;
#P flonum 544 130 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 544 152 88 196617 param amp $1 $1;
#P flonum 641 79 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 641 102 65 196617 param tol $1;
#P flonum 544 79 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 544 103 75 196617 param luma $1;
#P flonum 544 21 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 544 45 89 196617 param freq $1 $1;
#P message 404 152 110 196617 read co.alphablend.jxs;
#P newex 390 181 140 196617 jit.gl.shader fa @name shady;
#B color 5;
#P newex 542 361 65 196617 jit.gl.slab fa;
#P window linecount 3;
#P newex 542 311 156 196617 jit.gl.slab fa @file tp.slide.jxs @param slide_up 5 @param slide_down 5;
#P window linecount 1;
#P newex 416 403 156 196617 jit.gl.slab fa @file op.absdiff.jxs;
#P message 510 239 30 196617 open;
#P newex 496 268 98 196617 jit.qt.grab 341 576;
#P comment 122 549 136 196617 fade: threshold fade;
#P window linecount 2;
#P comment 122 523 136 196617 thresh: apply a threshold on the alpha plane;
#P comment 122 496 136 196617 lum2alpha: use the luminance of second texture instead;
#P number 350 459 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 400 458 15 0;
#P flonum 532 459 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 477 459 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P message 477 479 54 196617 thresh $1;
#P message 532 479 44 196617 fade $1;
#P message 350 479 48 196617 plane $1;
#P message 400 479 70 196617 lum2alpha $1;
#P newex 338 501 76 196617 prepend param;
#P newex 518 561 32 196617 print;
#P message 269 503 67 196617 getparamlist;
#P newex 121 444 70 196617 jit.window fa;
#P newex 258 561 259 196617 jit.gl.videoplane fa @scale 1.333 1. 1. @blend_enable 1;
#P newex 121 422 121 196617 jit.gl.render fa @ortho 2;
#P newex 121 170 58 196617 t b b erase;
#P newex 258 531 169 196617 jit.gl.slab fa @file cc.alphaglue.jxs;
#P message 272 393 30 196617 read;
#P flonum 162 128 35 9 0.5 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 121 128 15 0;
#P newex 121 149 51 196617 qmetro 2;
#P newex 258 426 105 196617 jit.qt.movie 320 240;
#P window linecount 2;
#P comment 122 470 136 196617 plane: choose which plane of the second texture to use;
#P connect 3 0 2 0;
#P connect 2 0 7 0;
#P fasten 7 2 8 0 174 416 126 416;
#P connect 7 0 8 0;
#P connect 4 0 2 1;
#P fasten 42 1 43 0 258 90 209 90;
#P fasten 7 1 1 0 150 416 263 416;
#P fasten 5 0 1 0 277 416 263 416;
#P fasten 13 0 6 0 343 522 263 522;
#P fasten 11 0 6 0 274 522 263 522;
#P connect 1 0 6 0;
#P connect 6 0 9 0;
#P fasten 44 1 45 0 352 90 321 90;
#P fasten 46 1 47 0 352 147 321 147;
#P fasten 14 0 13 0 405 497 343 497;
#P fasten 15 0 13 0 355 497 343 497;
#P fasten 16 0 13 0 537 497 343 497;
#P fasten 17 0 13 0 482 497 343 497;
#P connect 21 0 15 0;
#P fasten 51 0 30 0 711 174 395 174;
#P fasten 50 0 30 0 719 174 395 174;
#P fasten 49 0 30 0 647 174 395 174;
#P fasten 40 0 30 0 646 67 395 67;
#P fasten 38 0 30 0 549 174 395 174;
#P fasten 36 0 30 0 646 125 395 125;
#P fasten 34 0 30 0 549 125 395 125;
#P fasten 32 0 30 0 549 67 395 67;
#P fasten 31 0 30 0 409 174 395 174;
#P fasten 43 0 30 0 209 120 395 120;
#P fasten 45 0 30 0 321 120 395 120;
#P fasten 47 0 30 0 321 176 395 176;
#P connect 20 0 14 0;
#P connect 25 0 27 0;
#P connect 27 0 6 1;
#P connect 18 0 17 0;
#P fasten 26 0 25 0 515 260 501 260;
#P fasten 7 1 25 0 150 224 501 224;
#P fasten 6 1 12 0 422 553 523 553;
#P connect 30 1 48 0;
#P connect 19 0 16 0;
#P connect 25 0 28 0;
#P connect 28 0 29 0;
#P connect 33 0 32 0;
#P connect 35 0 34 0;
#P connect 39 0 38 0;
#P fasten 29 0 27 1 547 387 567 387;
#P connect 41 0 40 0;
#P connect 37 0 36 0;
#P fasten 29 0 28 1 547 383 716 383 716 306 693 306;
#P pop;

#81951
Aug 18, 2006 at 1:14am

Hi all,

Is there an alphablending composite operator already in max? I can’t seem to find one. Is there any other way to combine two images, one with an alpha in openGL using a slab, like jit.alphablend?

#81952
Aug 18, 2006 at 1:28am

There are any number of ways to combine 2 images in opengl. You could
use 2 layered jit.gl.videoplanes. Another way would be to use a
compositing slab operation and display the result on a single
jit.gl.videoplane. Look in your jitter-shaders/composite folder, all
of the photoshop layer blend modes are there. Have a look at tutorial
42 for more information.

wes

On 8/17/06, Timothy Devine wrote:
>
> Hi all,
>
> Is there an alphablending composite operator already in max? I can’t seem to find one. Is there any other way to combine two images, one with an alpha in openGL using a slab, like jit.alphablend?
>
>
>
>
>

#81953
Aug 18, 2006 at 1:33am

If i use 2 layered jit.gl.videoplanes will that utilize the alpha channel if it is there? The Photoshop blend modes won’t use the alpha.

tim

#81954
Aug 18, 2006 at 1:42am

On 8/17/06, Timothy Devine wrote:
>
> If i use 2 layered jit.gl.videoplanes will that utilize the alpha channel if it is there?

Yes depending on your blend_mode attribute.

The Photoshop blend modes won’t use the alpha.

True, but you can modify them to use the alpha channel however you
want. It’s quite easy to do. If you don’t know GLSL, there are a
number of tutorials online that can exaplin the basics. Personally, I
would go this route as it’s more flexible than using the OpenGL fixed
function pipeline’s blend_modes.

wes

>
> tim
>

#81955
Aug 18, 2006 at 1:51am

Thanks wes.

I will give GLSL a shot.

tim

#81956
Aug 18, 2006 at 2:30am

FWIW, Andrew Benson just posted an alphablend shader to the list earlier
this week. Check the archives…

-Joshua

——————————————————————–
mail2web – Check your email from the web at
http://mail2web.com/ .

#81957
Aug 18, 2006 at 4:17am

Actually, here is a question ive been meaning to ask, for the OpenGL
blend modes, do any of them have ‘photoshop’ equivalents? for example
6, 1 seems like overlay. The reason I ask, is so I can give the modes
some accurate names in a UI in building, rather than just numbers.

I did a rudementary search, to no avail. Far too much signal to noise.

Thanks!

v a d e //

http://www.vade.info
abstrakt.vade.info

On Aug 17, 2006, at 10:30 PM, jkc@musork.com wrote:

>
> FWIW, Andrew Benson just posted an alphablend shader to the list
> earlier
> this week. Check the archives…
>
> -Joshua
>
> ——————————————————————–
> mail2web – Check your email from the web at
> http://mail2web.com/ .
>
>
>

#81958
Aug 18, 2006 at 6:36am

FWIW, I just emailed the shader directly to Timothy, but putting
together an alphablend shader would make a great first project for
learning GLSL. It’s amazing what you can accomplish with just a couple
lines of code.

Andrew B.

#81959
Aug 18, 2006 at 11:31am

#81960
Aug 18, 2006 at 11:49am

Sorry, I can’t seem to find the shader. Could someone link me to it?

#81961
Nov 20, 2006 at 5:24pm

Could you send me this interesting shader please? (co.alphablend.jxs)
It could be very nice because it misses some parts directly in the post. Can you send it in an attachment to avoid the missing parts?

Thank you very much!

#81962

You must be logged in to reply to this topic.