video puzzle
Greetings,
I’m trying to create a simple video puzzle where the video is broken up into 8 pieces on a 3x3 grid leaving 1 blank space for the piece to slide. See attached jpg. I consider myself an advanced beginner so I’m uncertain which way to approach this.
A. scissors and glue
B. Mesh plane
From the shatter examples I see that Gen might be the way, but most of that is over my head.
Any pointers, tips, patches appreciated.

This is what I'm trying to achieve. Seems to be working, but I wonder if there's a more efficient way to do it.
no need to use gen etc-- here's a version using router:
note that instead of "moving" (legally) one of a number of possible picture submatixes, the logic I've used is simplified by "moving" the blank matrix to one of a number of legal positions. what this patch does is swap the blank tile with another tile randomly to shuffle the tiles around. It wouldn't be that hard now to patch it up so the user can grab the (blank) tile with the mouse and move it to a new position to solve the puzzle once it is shuffled. Note it has to be shuffled from its solved state first, as not every random state is solvable (only half the combinations of tile positions are solvable). You could shuffle it automatically by using an uzi
the jit.gl.pix solution is a good one. using jit.glue or other matrix processing techniques for this will be significantly slower.
if you're feel adventourous, you can use jit.gl.mesh for this. you can take a 3x3 input matrix of positions (one for each tile), and use jit.gen to generate quad vertex values around each position input value, and also generate texcoord values. this technique, while a bit tricky to wrap your head around at first, offers a lot of flexibility.
to reposition each tile, you reposition the 3x3 position matrix and re-send. you can use jit.xfade or jit.slide to animate the positions.
Great, great... thank you both for your insight and time. I don't patch all that often, but when I do I'm always grateful that there's a helping hand out there when needed. Cheers!
Hi Rob,
I love how your solution is light on the CPU, but I can’t seem to reposition the tiles using the 3x3 matrix.
What am I doing wrong?
not sure what you're trying to do there.
perhaps jit.repos will be of use. that way you only have to think about re-arranging the cell indices, rather than any actual position values:
Aaaaah... I'd like to move each pixel/tile individually... and find a way to turn just one of them off. I'll play with jit.repos - thanks!
to move individual tiles, use the setcell message to the 3x3 position matrix. to turn off cells, easiest may be to position them off screen. otherwise you'll need to patch in some kind of logic to handle a mask matrix.
Big thanks to Floating Point and Rob for their help!
nice!