Video Collage: Aspect Ratio Issues with jit.gl.videoplane and jit.gl.node

Duffield's icon

Hey Guys,

I apologize if I overlooked any past posts, I did my best to look into this.

PSEUDOCODE: I'm trying to make a video-tilish (more like comic book). Planes are of differing sizes so no [jit.glue]. I am using [jit.gl.videoplane] and [jit.gl.node]. What I think is the best approach is to make multiple [jit.gl.videoplane]s (children) and use jit.gl.node mixed to a parent [jit.gl.videoplane] which I'm trying to keep as a 16:9 aspect ratio so that no matter what space I work in, I will have a consistent aspect template. If there is another approach that is better I'm all ears!

PROBLEM: I want to go full screen. When I try to activate [jit.gl.node] with the parent [jit.gl.videoplane], the position of the children move. Additionally, the children become stretched. My gut is that its some issue with transform_reset but playing with that led me to no avail.

Below is the patch.

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

Some notes:
jit.gl.render --> Ortho 2
jit.gl.videoplane children --> transform_reset 1
jit.gl.videoplane parent --> transform_reset 2

Rob Ramirez's icon

before your final output, send everything to jit.gl.cornerpin @preserve_aspect 1. this will preserve the aspect ratio of the final texture, even when going full screen.

you may need another gl.node to capture everything, haven't looked at your patch.

Duffield's icon

Still having trouble unfortunately. Perhaps I'm misunderstanding something. Mainly the issue is that the position of the objects seem to be cut off when going fullscreen (I used countdown.mov as an example because it's easy to see where the circle / line are cut off). For example, if I position a video precisely, when going fullscreen, the sides are cut off.

Here are some observations before adding the cornerpin:

Remember, [jit.gl.render @ortho 2]

jit.gl.videoplane - transform reset 1 - Scale 1. 0.75 - Fullscreen aspect ratio not distorted, position of objects offset from 'true' position before fullscreen

jit.gl.videoplane - transform reset 2 - Scale 1. 1. - Fullscreen distorted aspect ratio, position of objects relative to each other seemingly accurate when fullscreen

After the corner pin, once again it kind of works, except I lose part of the image when going fullscreen. I attached two patches, one is of my attempt using jit.gl.cornerpin. One is of my attempt using [jit.gl.cornerpin] with a nested [jit.gl.node] which doesn't seem to make a difference.

Any additional help would be soooooo appreciated as this is really driving me bonkers.

Jit_GL_Node_Corner_Pin.maxpat
Max Patch
Nested_Jit_GL_Node_2.maxpat
Max Patch
Jesse's icon

Are you trying to set things up so that the content sent to jit.window looks the same when capturing as when not?

If so, set parent jit.gl.videoplane to @transform_reset 1 and @scale 1.77778 1. 1. (16 x 9 ratio)

Duffield's icon

Okay, lets try this! I attached two pictures also to outline the issue.

Picture 1: Non-Fullscreen - Note on the sides that we can see a larger percentage of the circle.

Picture 2: Fullscreen - Now note that the sides of the image [jit.gl.videoplane] are now outside of the screen. It is almost as if the camera position had changed...except that can't happen with transform reset as far as I can tell, and especially with [jit.gl.render] set to @ortho 2.

The problem persists whether I just use one [jit.gl.node] assigned to a [jit.gl.cornerpin] or [jit.gl.videoplane]. The same issue also exists when I use the nested [jit.gl.node] method.

The patch below is using the nested [jit.gl.node] method.

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

Any insights? Is this inescapable?

Picture_1_Non-Fullscreen.png
png
Picture_2_Fullscreen.png
png
Duffield's icon

Actually, I think the only solution is scale to a [jit.gl.videoplane] NOT by 1.7778 1. 1. but by something closer to 1.6 0.9 1. to compensate for position shift when going fullscreen. Makes some sort of sense (i.e., 1.6 X 0.9 = 16:9) but not entirely intuitive as you have pillarbox effect on the side in non-fullscreen mode. No need to go the nested [jit.gl.node] route, as the same problem persists...and this is simpler.

HOWEVER!!!!
Check out this patch. I find when going fullscreen it looks distorted (stretched) even though I kept it in 16:9 ratio and did @transform_reset 1. On a closer look I find I scale by 1.63-66 1. 1. it looks less stretched when going fullscreen for whatever reason.

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

Attached is my fix - (ishness?!?). Anyone with any insight into this behaviour? I'm sure I'm just totally missing something fundamental to Open GL.

Jesse's icon

It sounds to me like your screen is 16:10, not 16:9

Duffield's icon

Exactly :) Sorry, maybe what I was trying to accomplish wasn't entirely clear.

Because I do shows and events, I never know what type of gear I'll be given (i.e., monitors, TV's, projectors with different resolution specs, etc). I was trying to first: Mix multiple child [jit.gl.videoplane]s onto a parent [jit.gl.videoplane] to retain position and maintain aspect ratio. I was hoping that I could do this and keep it always on a 16:9 [jit.gl.videoplane[, so that regardless of the display aspect ratio (i.e., 4:3, 16:9, 16:10) I could keep it in 16:9 with a letterbox effect if necessary, much like this thread: https://cycling74.com/forums/how-to-maintain-aspect-ratio-of-movie-when-going-fullscreen/

Zachary Seldess's automatic approach is what I've been looking for, but still has the problem where part of the [jit.gl.videoplane] can extend outside of the display area.

HOWEVER, even with this thread the problem persists, let's say I'm on a 16:10 monitor as that is my laptop. I develop the patch on my laptop. I take it to event, and have no clue what their monitors are sometimes. When I go fullscreen, the [jit.gl.videoplane] is still outside of the display monitor. What I'm looking at is an auto way to ensure that it's 16:9 even if need be letter-boxed regardless of the displau, no part of the image cut off.

Jesse's icon

Simplest way I can think of is to not go fullscreen with the jit.window and just calculate its resolution by mapping the available pixel width to the 16:9 ratio. You can remove the border of the jit.window, use a black background for the display/projector, and place the jit.window appropriately for your needs i.e. letterboxing.

I do this often with 2:1 projection and it's pretty easy to maintain once you let go of the fullscreen approach.

Rob Ramirez's icon

again, jit.gl.cornerpin @preserve_aspect is your friend.

you need to turn off gl.node's adapt, and explicitly set the dimensions (@adapt 0 @dim 426 240) or whatever dimension you want for your final output, and then send the captured output to a gl.cornerpin. you will then be able to fullscreen the window at whatever size, and it will maintain the aspect ratio of the gl.node dimensions.

Duffield's icon

Sorry, I know this is older, I got busy and I just wanted to confirm my findings.

@Rob Ramirez - Yes, that is the answer I'm looking for. I must have had some setting that was off in my earlier attempts.

Thanks!