Issues on creating a dinamically resizable mosaic

Jan 8, 2013 at 6:34pm

Issues on creating a dinamically resizable mosaic

Hello everybody,
Taking inspiration from Jitter Recipe #36 http://cycling74.com/2010/09/13/jitter-recipes-book-3/, I started working on a patch that grabs single frames and sends them to a matrix in a “mosaic” fashion. What I was trying to obtain was that the size of the “tiles” varies according to frames number. Hence, a single frame takes all the screen, two frames split it in a half and so on.

I’m almost there. I found the way to create a square grid that adapts to the number of frames, and I can use this info to control the mesh and to feed the texture (as in the “TinyVideo” recipe)
Now I’m stuck in correctly set the vertical position of the frames in the matrix that will become the texture. It seems I can’t figure out the correct math.

– Pasted Max Patch, click to expand. –

Please have a look at this patch. Try clicking a few times. It seems to work somehow for some values, but at the beginning it outputs values too high for the “row” coordinates, while the “columns” are set correctly.
Any hint would be appreciated.

#65972
Jan 9, 2013 at 2:42pm

Still banging my head against the wall.

Here’s the original part of the TinyVideo patch, which works with 100 frames

– Pasted Max Patch, click to expand. –

And here’s my attempt to make it work with a different number of frames.
I made some modifications and now it works correctly for the first four frames (I decided to start from a 2×2 grid), then the vertical values start to go somewhere I don’t understand….

– Pasted Max Patch, click to expand. –
#237557
Jan 9, 2013 at 4:10pm

hi
the original part of “TinyVideo” with some tricks….

– Pasted Max Patch, click to expand. –
#237558
Jan 9, 2013 at 6:50pm

Thank you, matmat, you solved the issue.
Now I got my patch to work!

– Pasted Max Patch, click to expand. –

the only small issue remaining is related to the redrawing of the tiles when the page is filled.
For example, when 4 tiles are displayed and I grab the 5th frame, the tiles are not resized until the 6th frame is grabbed. This happens also for the 17th frame, and so on.

P.S.
Here I limited the matrixset to 64, but I am currently using it with 1024 and seems to work fine.

#237559
Jan 9, 2013 at 7:57pm

LSka, it seems your problem for that lies in the power of two math you’ve got going on, plus the count itself. Try adding a [+ 1] between the counter and the subpatcher and see what happens :)

#237560
Jan 10, 2013 at 7:44am

Great, thank you Wetterberg!

#237561
Jan 10, 2013 at 9:32am

So, here we are! Let’s share it!

– Pasted Max Patch, click to expand. –

Thanks again

#237562

You must be logged in to reply to this topic.