Attaching two screens like layers

uforange's icon

Hello,
I want to attach two screens and make one screen movable (vertically or horizontally), but I'm not sure how to approach this. jit.glue doesn't seem to be the right object for this as it can't arrange two screens like layers.

What I'm trying to do is, for example, there's a 500x500px video1 and a 500x100px video2. I want to display video2 on top of video1 and make it move in an up-down direction. How can I do this? Thank you.

TFL's icon

How about using a [jit.gl.videoplane @depth_enable 0 @blend_enable 1] for each movie, and play with their scale and position attributes to place them however you want?

uforange's icon

thank you. My question might be a bit basic, but how do I view a videoplane in jit.pwindow? Is this the correct method you mentioned? I'm not very good at Jitter compared to Max/MSP :(

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

Wil's icon

It is good practice to use only 1 jit.gl.videoplane

That is why there are jit.gl.layers

put on top of videoplane

jit.pwindow connects directly to video source. + any effects that you add

here 1 jit.gl.videoplane @layer 0 and 1 jit.gl.layer @layer 1

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

//

to see the videos mixed together in jit.pwindow use jit.gl.node

here 2 jit.gl.layers -> capture with jit.gl.node -> 1 jit.gl.videoplane

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

***after jit.gl.node - scale and size both videos together, add effects to both videos, etc

uforange's icon

@Wil Wow, thank you! This is a really great solution.

Pedro Santos's icon

Hello. Just some quick notes to complement Wil's suggestions.

  1. You can use jit.world's texture output to visualize the rendered content in a jit.pwindow and get rid of the jit.gl.node and corresponding jit.gl.videoplane (unless you wanna post-process the scene, as Wil referred).

  2. jit.gl.layer is jit.gl.videoplane with specific settings configured. If you open the help file, it refers to jit.gl.videoplane and in the 2nd tab it specifies the predefined configuration (see below).

jit.gl.layer is an alias for jit.gl.videoplane that instantiates with the following defaults to make layering images and videos easier:

preserve_aspect 1

blend_enable 1

depth_enable 0

Here's a simple example of this.

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

uforange's icon

thank you @Pedro Santos this is great too. this really helps! I have one quick question. I am wondering how the x- or y-position control is corresponding to the actual position of the green screen. The position values in the attrui object looks like relative values. For example, if the screen size is 500px x 400px, is there a way to use this absolute pixel value to move the screen vertically or horizontally? Thank you!

Wil's icon

video is 400p tall

if center is 0

-2/+2 moves the entire video to edge of screen

you can [scale] or math to get pixel

{scale 0. 400. 0. 2.}

or

  1. * .005

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

uforange's icon

oh right! big thanks!