masking video with jit.gl.gridshape

May 20, 2012 at 4:59pm

masking video with jit.gl.gridshape

Hi everyone,

This seems like a simple question, but I cannot figure out how to create a circular mask using jit.gl.gridshape that will not change the dimensions of the incoming video.

What I would like to do is take a live video signal and simply “open up” a circle that will allow a specific portion of the video to be viewed. My current patch (which is mostly from the jit.gl.gridshape help file) changes the dimensions of the video to conform to the circular shape. I have posted the patch below. There are many loadbangs, so please save it and then re-open it.

I would like to be able to change the values to [pak scale] (which is highlighted in green in the patch) and be able to see more or less of the incoming video, without distorting the dimensions.

Any tips would be appreciated.

Thanks!

– Pasted Max Patch, click to expand. –
#63690
May 22, 2012 at 6:25pm

hello.
you want to make use of the tex_plane_s/t attributes in order to zoom the texture.

i’ve added to your patch a helpful abstraction for doing this.

– Pasted Max Patch, click to expand. –
#229640
May 23, 2012 at 6:34am

Thanks a lot!

On a related note: is there a way to poll the source/destination data for all of the “copies” of the image that are made using a zoom value less than 1.0 in tex_map mode 1? I’m interested in changing the timings of the different copies when the zoom value is 0.258, for example. I’m not sure how this would work using the GL objects.

#229641
May 23, 2012 at 5:24pm

no, these copies are simply a gl texture with wrap-mode repeat.

of course you could build this yourself using multiple gl.videoplanes or gridshapes.

#229642
Jun 19, 2012 at 9:38pm

i’m using some of this as the basis for a patch I’m working on. Is there a way to map the video texture in its native dimension? My video is being warped to a 1×1 shape, and the video was shot in 16×9.

#229643
Jun 19, 2012 at 10:25pm

if you are displaying a texture using jit.gl.videoplane, set @transform_reset 2, and make sure the aspect ratio of your jit.window matches the aspect ratio of your source image.

alternatively, you can try jit.gl.cornerpin @preserve_aspect 1

if the aspect ratios do not match, you can set @adapt 0 and explicitly set the @dim attribute on your jit.gl.texture.

if this doesn’t help, post your patch.

#229644
Jun 20, 2012 at 9:25pm

great! I will try that. The other thing that I’m wondering about is this: For the effect I’m trying to build, I’d like all the circles to come from the same video source (done), and I’d like the outer circles to have a slight delay from the inner ones so that the further out you go, the more it wiggles. (basically this: http://youtu.be/brIGXnBKEzo).

I’m pretty sure I can control the delay by pulling frames from the jit.qt.movie and just subtracting for each layer, but what if I wanted to do this live? Is there a way to save 3 seconds of incoming video into a buffer from jit.grab, or is there a better way to do it?

Thanks!

#229645
Jun 20, 2012 at 10:07pm

jit.matrixset

#229646
Jun 20, 2012 at 11:14pm

SWEET. This is gonna look so cool when I’m done! I’ll post the patch when I’m through.

#229647
Jul 3, 2012 at 3:25pm

Hey,

very interesting thread!

I was just wondering: Can I use a still-image as a shape for gridshape?
If I understand everything right, my goal is something simular as above. I would like to play a movie as texture and masking it, but in a way that I can move, scale and rotate the movie, without doing the same for the mask. Just as in the example you have posted. Only difference: I don’t want to use the gl-shapes (circle etc..) but still images (tiffs with alphachanel). And I have to do this on three or four different movies+masks.
Possible?

Thanks!!!

#229648
Jul 3, 2012 at 10:48pm

mr. l, you can just have 2 or more videoplanes (with @blend_enable) in one render context… the mask in front

#229649
Jul 16, 2012 at 5:00pm

So, still not quite working. Transform reset in the gridshape object fixes the aspect ratio, but makes the circle an oval. Also, I can’t seem to get the delayed signal to propagate into the second gridshape, it just uses the original signal, which I haven’t been able to wrap my head around.

– Pasted Max Patch, click to expand. –
#229650
Jul 16, 2012 at 5:01pm

ps. I don’t have a good loadbang/loadmess setup yet. You’ll have to play with the videozoom and circle size a little.

#229651

You must be logged in to reply to this topic.