Combining matrices of different dimensions

    Jul 02 2012 | 9:15 pm
    I want to be able to combine/mix/alphablend matrices of differing dimensions. For example, take a smaller matrix and mix it into the bottom right hand corner of a larger matrix.
    How can this be done? Other than using a combination of jit.spill and jit.fill. Can it be done somehow using jit.op, or does this require the matrices to be the same dimension?

    • Jul 02 2012 | 9:44 pm
      In order to mix or blend matrices directly, they'll need to be the same format. If they're not, the jit.xfade/jit.alphablend/jit.op/etc. objects will internally adapt the inputs to be the same format. I would definitely recommend giving it a try to see what happens.
      There are 3 ways to mix differently sized matrices: 1) using jit.matrix @src/dstdim attributes to put your smaller matrix into a larger one that matches the size of the matrices you're mixing 2) use OpenGL ( + to composite objects in a window 3) use OpenGL ( to mix together your matrices. It takes matrix and texture inputs and outputs a texture
    • Jul 02 2012 | 10:10 pm
      Awesome, thanks again Wesley!
    • Jul 03 2012 | 12:29 am
      Great, I've been successful in implementing method 1 listed by Wesley above. Check it out:
    • Oct 17 2013 | 1:47 am
      Anyone knows if it's possible to use this technique but have several smaller matrices blended in a larger one ?
    • Oct 17 2013 | 2:53 pm
      @Nat Do you mean something like this?
    • Oct 17 2013 | 4:55 pm
      Thanks, that's pretty much what I want to do. The only thing missing would be a way to control the blending of the matrices if they overlap but I'm afraid the only solution would be to go with I'm doing this to animate pixels on a led strip so going the opengl way is not convenient as I need direct access to the pixel data.
    • Oct 17 2013 | 5:00 pm
      You can use to blend things together and then do a readback from the texture to a matrix.
    • Oct 17 2013 | 5:02 pm
      Here's what I have so far, it works but there's no blending, I'm not sure that's even possible using that technique. If you play with the position setting and they overlap you will see what I mean.
    • Oct 17 2013 | 5:12 pm
      @Wesley, I tried with videoplanes and the blending works great, in a jit.window all is fine but as soon as I render to a matrix things get very strange, here's the patch I have:
    • Oct 18 2013 | 2:01 am
      You might get some ideas from this page: Scroll down to the examples "make a mask image" and "masking by alphablend".
    • Oct 18 2013 | 4:10 am
      nat, if you want to do it the way you proposed in your last patch, your matrix dimensions should match the jit.window dims if you want to get the same result in both:
      also maybe have a look at
    • Oct 18 2013 | 1:48 pm
      Thanks ! What also seems to help is a bigger matrix. Even if the window and matrix are the same size, if I go lower, say 60, the matrix output looks weird. I assume it's the way it's converted.
      Things always get complicated when you try to output stuff somewhere else than on a screen...