low framerate with jit.gl.multiple

MIB's icon

I am wondering if I am doing something inherently wrong here. I have a 5x5 grid of cubes that need to be able to independently move and rotate (and eventually have a different video on each cube). I am getting 5-10fps and this is a stripped down, simplified version of what is to come! In the end I will need to play back short, different videos on each cube (~2-5secs each), have a background animation AND do some msp stuff that will trigger the movement, rotation, etc...

For the video playback I was thinking of using jit.gl.textureset inside a poly~ to "record" a number of frames for each cube with a unique texture name that will be sent to jit.gl.multiple. A prototype is sort of working (not included below) but the framerate is just killing me!

Any pointers would be much appreciated.

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

Federico-AmazingMaxStuff's icon

Hey MIB, the patch on my computer runs at 60 fps.
There is one thing I don't understand though:

why are you using jit.anim.node?
You can scale, move and rotate the shape just by using the gridshape relative attributes, no need for anim.

Also, no need for @automatic 1 if you are drawing the shape with multiple.

The rest seems pretty straightforward and ok.

Let me know if now it runs better.

Federico

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

MIB's icon

Thanks!
I think the jit.anim.node was leftover from some testing, thanks for catching that!

If I run your patch it is at 60fps. If I swap it into my setup it goes down to 15-20 fps... better than before but still something wrong. Nothing else in the patch is doing anything right now so I don't understand... will investigate.

Since I will need short 1-2 second videos on each cube I was wondering if you think it would be better to use jit.gltextureset or jit.matrixset, specially since I will need to process the textures according to some input?

@FEDERICO-AMAZINGMAXSTUFF love your channel btw!

Herr Markant's icon

@MIB your patcher runs fine. no fps problem on my old MacbookPro2014

Matteo Marson's icon

@MIB I'd exclude jit.matrixset from the candidates, while [jit.movie @output_texture 1] or [jit.gl.textureset] should perform quite close. But it depends also on the codec of the movie file, so you should try both.
If you know how to write shaders, another way you can try to gain something performance-wise is to store your short clips into 3d textures. Check out the example patch named "3D textures 1" under the gl3 launch panel.