masking jit.gl.mesh with video – a question

Nov 9, 2012 at 6:22pm

masking jit.gl.mesh with video – a question

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?

#65153
Nov 9, 2012 at 9:42pm

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. –
#234847
Nov 10, 2012 at 12:16pm

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

#234848

You must be logged in to reply to this topic.