Why is the video flickering?

lisamarie's icon

Hello-

I am attempting to render a texture using jit.gl.sketch over a live video feed. I've tried various techniques and the closest I've come is represented in the attached patch. The jit.gl.sketch object appears over the live video but the video flickers.

Any suggestions would be greatly appreciated!
Thank you.
~Lisa Marie

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

MJ's icon

your sending the results of a jit.gl.render and the results of a jit.qt.grab to the same window at the same time.

if you want to combine it you can use the jit.qt.grab data as a texture in the gl scene

or mix the output of the jit.gl.render as a 2d matrix with the jit.qt.grab for example with jit.lumakey

lisamarie's icon

Thank you MJ-

Here is a different version of my attempt to combine video with the jit.gl.sketch object. This time I created a new texture for the video. Depending on my render order, I have been able to get either the torus shape or the video to appear, but not both. I've played around with render order, layers, blend_enable, and depth_clear. I have been looking at tutorials and reading other posts on the forum for the last week so please don't think I'm not doing my homework. I really wish I could figure this out on my own!

Thank you for any help you can offer.

Lisa Marie

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

MJ's icon

what exactly do you want to achieve?

a manualy blurred gl-torus over a video ?
like this

lisamarie's icon

Hello MJ-
That is an interesting image.
This is more what I am going for:

To summarize the project, I am working with video input from a multitouch table. The video of a person's fingerprints is being used both as the live video image as well as x,y data coordinates to create trails that are intended to follow the fingerprints on the live video. This is why I need to layer the video and jit.gl.sketch objects. One layer to show the live video input of the blue fingerprints and one layer to show the white trails as though the person is drawing. The layered video is then projected through 3 different projectors using a Matrox Triple Head To Go. I had everything working fine when I was using just one jit.window but when I moved into making 3 versions of the exact same video things became much more complex. I've received a lot of help from the forum over the last couple of weeks and I am really really close, but still I can not figure out how to get the trails to layer over the live video. If you want to see more about the project, here is a video of the multitouch table my team member and I created. It shows how the camera captures the finger prints.

My actual patch is very big. I can post my large patch if that is helpful, but I was asked before to simplify my example.

Thank you so much for your attention.
Lisa Marie

Zachary Seldess's icon

Hey Lisa Marie,

I didn't take a close look at your patch, but it sounds like you could benefit from the layer attribute. Here's an example patch overlaying a particle system on top of a videoplane (taken from a patch I posted in another thread a while back). Hope that helps a bit.

best,
Zachary

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

MJ's icon

you want the output of the 3 projectors to be the same , like copies of each other?
if so why are you using a th2g ? and not just a video amplifier with multiple outputs ?
i'm not sure but if you set the resolution of the th2g just to 1280x1024 it acts like a video amplifier

MJ's icon

here patch moving jit.gl.sketch over video and copied 3 time to a th2g sized window

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

lisamarie's icon

Zachary-
This is amazing.
The trails are so sophisticated!
I am definitely going to study this for awhile to see if I can understand what is going on and incorporate it into my patch.
Thank you!

lisamarie's icon

Hi MJ-

Thank you for your question about TH2G and your example patch.
I want to use the device because I already own it and can not afford to buy more gear. I looked into the specs a little but can not find how to change the settings to have it act as an amplifier as you suggest. So...I will have to do it in Jitter.

I studied your patch for a bit and I have one question. The name "hop" and "poh" both appear. Is this correct? The patch works the way you describe, but I want to understand why. If I were to try and recreate it, I would think the matrix, drawto, window and videoplane would all need to be named "hop" but when I try that the flickering starts up again. So are you intentionally drawing to a matrix named "poh" and then sending that to the "hop" window to avoid the flicker? At first I thought it was a type-o but now I am thinking it was a clever use of semantics.

Thank you,
Lisa Marie

MJ's icon

'hop' and 'sketch' are gl worlds
'poh' is a jit.matrix which is used in 'hop'

the output of the 'sketch' gl world is first drawn to the window 'sketch' and later to the matrix 'poh'
( the jit.window 'sketch' stays onder the 'hop' window at startup)

the contents of matrix 'poh' are then used as a texture for the three videoplanes who live in 'hop'

its a bit odd to manualy press 'drawto sketch' first and press 'drawto poh' second but when i attach it to the loadbang it wont work ....

maybe the use of poh and hop is bit confusing...
should change poh in to "Ni"

and should automaticaly changed later on with some nifty maxscripting into "Ekke Ekke Ekke Ekke Ptang Zoo Boing Zow Zing"

lisamarie's icon

Thank you for the explanation and humor
I really appreciate your help!!!