How to mask then reveal a background video

medinnersready's icon

Hey Guys,
I'm doing a patch where I want to have a video hidden on the window. I then want to draw lines on that window which will reveal the video underneath the lines. I suppose it's a bit like using an eraser on top of the window and the lines will rub out say a mask which is covering the video underneath.
Any ideas how I would go about this? I can't seem to find anything in the tutorials or recipe books which are of benefit.
Any help gr8ly apprec8d.
I will of course post the finished patch if I can get this organised.
Thanks

MIB's icon

I remember several patches a little while ago in a thread... can't remember what it was called, but a quick search should do it ;)

medinnersready's icon

Hi MIB....

I've tried searching - I don't know what object(s) or topics I should be searching for to get the right 'hits'..?

Any suggestions? I don't even know if its a mask I should be using or what would be the best way to achieve this?
If you remember the posts/thread [perhaps you could let me know....

Thank you

MIB's icon
Max Patch
Copy patch and select New From Clipboard in Max.

quick search turned up this patch... might be helpful to you:

Luke Woodbury's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Here's doing it in GL world (sure this isn't all my work if any so sorry if you are not credited!). If you want to draw lines you could use jit.gl.sketch instead of jit.gl.gridshape.

medinnersready's icon

Thanks Guys,
I had actually got that far, I should have explained myself a bit better. What I wanted was for the uncovered pixels/areas to remain uncovered once they were visible...any ideas on that one?

Cheers.

Luke Woodbury's icon

Sorry, I don't mean to come off rude, but did you actually try? In MIB's example all you have to do is send jit.lcd some drawing commands and whatever you draw will stay uncovered, look in the jit.lcd help file. In my example, as I already suggested, replace jit.gl.gridshape with jit.gl.sketch and whatever you draw will act as the mask and it will stay uncovered too.

medinnersready's icon

Hey MIB,

You're not coming off rude, I appreciate the input and time you experienced people take with learners such as I. I have better explained what I am trying to do here https://cycling74.com/forums/how-to-key-out-a-jit-window-background-and-replace-with-a-video-suggestions-2
My question here was an attempt to workaround. Perhaps you could take a look at my link and advise me what you think is the best way to achieve what I'm trying to do.

Thank you

MIB's icon

actually, it was scatalogic and not me ;)

medinnersready's icon

Ooops....sorry MIB..my head's fried trying to sort this out. Apologies.

So.......Hey Scatlogic, you are not coming off rude.....etc as above!

Thanx Guys.

Don't forget and have a look at the patch if you have the time and let me know your much appreciated thoughts..Cheers

Luke Woodbury's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Ok, I'm including two patches here, the first seems to be what you are asking for in this thread and uses exactly the technique I suggested, ie drawing from jit.sketch used as a mask:

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

The second seems to be what you are asking for in the other thread, which is simply how to render geometry over a video background. Note the use of the 'layer' attribute to control what is in front and what is behind just as you would in photoshop or flash or anything similar. I think you are misunderstanding how GL stuff works though, it is not rendering a matrix with a black background and a line on top, it is rendering the line into a shared space where other things can be rendered too. Hopefully one of these is what you want.

Luke Woodbury's icon

PS- You've got three different threads going on this topic, best way to get coherent help is to keep it to one and post a patch that just includes your problem area simplified as much as possible.

medinnersready's icon

Hi Scat...

Thanks for all your help. I was under the misguided notion that more posts would garner more replies/opinions but I can see that it is causing incoherency - I'll rectify that. Gonna give your suggestions a crack now. Once again thank you - especially for your indulgence.

medinnersready's icon

Hey Scat....

I want my rendered drawing to be 'rotatable' but I want the background video to be static. You were saying .....it is rendering the line into a shared space where other things can be rendered too.......
so does that mean that the gl.handle will affect everything in the named window and not be separately assignable to just the drawing? Sorry to be 'doing your head in' but it's doing mine in - so as it's the season for sharing - I thought I'd share my headache with you!!LOL!

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

Here's the patch so far - any thoughts..?

Thanks again

Luke Woodbury's icon

Looks like someone has given you the answer on your other thread (maybe it was a good tactic!). Basically you can attach the jit.gl.handle to your jit.gl.mesh instead of the whole scene [jit.gl.render]

medinnersready's icon

Hi Scat...

Thanks for all your help and patience. Seasons greetings to you and yours.

Cheers