jit.gl.mesh and z-displament - incorrect output video size

agustin issidoro's icon

Hello! I am trying to do a video patch that takes 1920 1080 video and does some z-displacements using jit.gl.mesh. However, at the output I always get a video that has been resized and that does not conform to 1920 1080.

Using @transform_reset 2 on jit.gl.mesh would do the work, but then I lose all the 3D views and displacements.

How could I sort this out?

Thank you very much!

P.D:

The patch just fiddles randomly between frames (30 fps). First load a video, turn world on and open the gate.

glitches-searchlove.maxpat
Max Patch

TFL's icon

It's because the coordinates of your mesh points are in the range (-1, 1) both vertically and horizontally, because this how it is by default. So no matter what your mesh size is (here 384x216), it will result in a square aspect ratio.

To fix that, you can multiply the x coordinates of your mesh by 1.777777 (the ratio for 16/9) by adding a [* 1.77777 1. 1.] just after [concat xy z] in your [jit.gen], or add @scale 1.77777 1. 1. to your [jit.gl.mesh] attributes.

In red: one of the two suggested solutions (among others existing).


agustin issidoro's icon

Thank you very much for your answer, TFL. I didn't know this and it is very helpful! Thanks again!