jit.lcd as mask / mapping, how to get transparency

gammon's icon

Hi

Hope to get some help from you.

I would like to draw a mask with jit.lcd and use it with gl objects. One video should be the background on top of it i would like to have a mask with another video. I found a patch on the forum which i was helpful to start and adapt. But how can the "Background" of LCD used for the second video ?

Any help would be great

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

Thanks you, Gammon

phiol's icon

Hi GAMMON,

First this first, if you go in the edit dropdown menu you'll find copy compressed.
After you've selected all of your patch objects , go to copy/compressed some magic will happen when you post in the forums :-) !

here are 2 version.

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

the 1st is a mod on the patch you posted.

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

the 2nd is a 100% GPU version :-) with much better response on the pictslider

Hope you learn from these

gammon's icon

Hi Phiol

Thank you so much. (i knew this is not the correct way to post a patch, but i forgot how to do. thanks ;-)

The gpu example is great, but i am not shure how to continue with this. Can i ad functions for more complex masks other than the circle.
Meanwhile i found another example and worked with it. It shows what i would like to achieve. But what i miss is the possibility to combine "poly" with number boxes and drawing with the mouse.

I add two patches which functions i would like to combine.

Am i on the right way or should i proceed with your patch ?

Thank you, Gammon

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

PS: jit.gl.movie -> no such object in MAX 7.0.4 ???

phiol's icon

Hi GAMMON ,

sorry about the jit.gl.movie

As for for your patch, is this what you want
use your mouse and draw directly in the jit.window.
I much , much prefer jit.gl.path's versatility and control over jit.gl.sketch for random line drawing :-)

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

let me know how it turns out

gammon's icon

Hi Phiol

Thanks for carry on.

> As for for your patch, is this what you want
> use your mouse and draw directly in the jit.window.

Hmmm … i´m not shure about the final solution.
The idea is to cut out irregular parts (mask) of the background video and fill it with another video. For a Workshop project with kids. I would then connect the number boxes for the "poly" with a midiontroller or iPad (x and y) for a easier interaction. i guess this can only work for a rough cut out. To create a more accurate mask its probably necessary to draw by hand to make the poly mask irregular.
The chicken video is just a easy example with its door, but think of any other picture with more complex stuff to cut out … e.g. a tree or a cloud ;-)

Any idea what i am after ?

all the best, and thank you
gammon

phiol's icon

Hi Gammon,

Maybe I'm not getting you.
But in the end, there is no problem using a cloud tree motorcycle as the computer sees them as pixel with values.

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

here is the patch again but with a cloud example:

here is the cloud image I tool off line.
http://labs.sogeti.com/wp-content/uploads/2014/03/cloud.jpg

now if you use the patch where I used the jit.gl.node ,( the jit.gl.node make is a 2D texture )
you can make that cloud dynamic and movevable. connect the ipad the the @position of the jit.gl.videoplane ot jit.gl.gridshape that will contain the cloud
, move that around .and voilà .

you get a cloud as mask.

now make your ipad select between a list of pre-load image using jit.gl.texture @file cloud.jpg .
now they can choose the image and where to place it.
mix with their custom drawing that are automatically saved to a folder when the press a button
and there you have it a mix of images and custom image they move around :-) !!!!

I'm I way off topic here ??

phiol

gammon's icon

Hi phiol

Wow … you taking me of for a trip ;-) Cool!

I thought a little bit the other way around. Hope i don't make you crazy. The kids should not select out of images. They should come up, collect, film their own images and cut out what they do not like ;-) Lets say a ugly house and replace with a garden. (just to make it complex)
How can they easily draw the mask they what?
Just in my limited way of working with max i tried to combine a poly with drawing, but maybe i´m wrong.

Does this help?

about your patch: its great. but i can not get the hit.node to work
Is it possible to create one mask in different ways?

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

Here is what i tried but failed:

Thank you
gammon

btw: within the paches you send me i learn a lot. Thank you very much.

phiol's icon

The reason the patch is not working is that you did not hook it up correctly.

If you connect a jit.pwindow out of the cloud jit.movie player . you'll see.
What the the jit.gl.pix does is a rgb to luma (black and white) then inside you have [> 0.8] making it binary.
in other words you creates masks with binary color . in this case black white.

The confusion:
jit.gl.node 's job is to make a 3D scene into a 2D texture.
Because textures replace matrices and make it a sorta matrix on GPU :-) !!

so again the jit.gl.node is a 3D scene to 2D converter.
So what I did in the original patch was take a sphere in a 3D scene and turned it into a 2D texture as if it was a 2D video or jpg.
from there you take only the red plane
This becomes your gate with holes
You do this by doing a multiply rgb by the r

With this explination, do you think you can fix it? Let me know if not

---
so, as I mentioned for your project: "kids draw content and then place their content later on "
-the kids could draw color or not
-then when they press send
- either use poly~ OR have a maximum amount of videoplane&texture combo (say 5to8)
- eventually they place their pictures where they want
- and finally they press a final big snapshot ( which is either printed or sent to them to keep)

:-)

gammon's icon

Hi Phiol

Hey Wow … This is a big lesson for me and it will take some time to get through.
(… also we leave the town and internet for a few days because of the heat …)

I will keep up with all the input you gave me and i will be back next week.

All the best, thank you so much
Gammon

phiol's icon

My pleasure GAMMON , good luck with everything :-)

gammon's icon

Hi Phiol

After a short rest in the woods and cooling down in a ice-cold river …

I found a simple solution with jit.lcd that works fine for me. (admittedly with some help of a friend)
It is just the drawing function for now, but it will be easy to add shapes. Also the save and recall function is simple but useful.

… and still some of your input in the patch. ;-)

Thank you so much for your help
best regards
gammon

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

PS: the patch to share ...

phiol's icon

hi gammon ,

I'm glad you worked out a solution :-)
I'm glad I could be of some help.

I would love to have some of your cooling down in the woods .
It's a piping 39C average here in montreal right now. It's hard to Jitter with focus ;-)

good luck with futur jitter patches