Forums > Jitter

masking jit.gl.mesh with video – a question

November 9, 2012 | 6:22 pm

Hello everybody,
Taking inspiration from this topic: http://cycling74.com/forums/topic.php?id=36373
and combining with the "SoundLump" jitter recipe, I obtained this patch, using jit.gl.mesh to visualize the lines generated with jit.catch and a "masking" texture captured from camera:

– Pasted Max Patch, click to expand. –

the only issues regards lines color, which in the "non-masked" version of the patch are white, while in the above patch they appear black.
Am I missing something? Maybe inverting planes?

Here is the SoundLines patch without masking.

– Pasted Max Patch, click to expand. –

Any ideas?


November 9, 2012 | 9:42 pm

i don’t think you’ve quite set this up correctly.
i’ve modified your patch to capture the gl.mesh to a texture using gl.node.
this texture is sent to the left input of the alphaglue slab, and the video "mask" is sent to the right input.

this creates a texture with an alpha channel based on the luminance of the mask.
to actually see the mask effect, you need to enable @blend_enable and disable @depth_enable on the videoplane that is displaying the texture.

you can now change the background color with the gl.render @erase_color, and the line color with gl.mesh @color.

hope this helps.

– Pasted Max Patch, click to expand. –

November 10, 2012 | 12:16 pm

Thank you Robert, now it works just like I wanted.

By the way, I added a little "roundness" to the lines modifying the expression in jit.vexpr and sent all the video elaborations in gl using jit.slab and jit.gl.pix. I think it’s a little more efficient, now

– Pasted Max Patch, click to expand. –

Thanks again


Viewing 3 posts - 1 through 3 (of 3 total)