jit.gl.node like nested 3D transformations on matrix / cpu side?

    Sep 15 2015 | 4:05 am
    Due to the fact that jit.gl.model won't load vertex colors in obj/ply/dae etc models, I've had to manually make a ascii file format for my vertices and colors that basically mirrors jit.fprint.
    So now I can load my models with colors. However, jit.gl.model @matrixoutput 2 - allowing me to output *transformed* vertices was really handy. So much so, that Its not clear I can move forward without it
    Is there a method to manually concatenate 3D transformations (rotation, scale, translation) onto a jit.matrix 3 float32 in such a way that it would be the same as just asking jit.gl.node to do it?
    Also, jit.gl.node @matrixoutput 2 + jit.gl.node matrix in support would solve this *really* intuitively and nicely. Just a thought.
    Thanks for any ideas.

    • Sep 15 2015 | 11:25 am
      You know shaders, you could always use the well documented matrix math or quat math methods to do a rot scale trans on data. Or write the same in gl.pix, or a matrix operator. Google, math libraries, etc are all your friend. e.g. http://gamedev.stackexchange.com/questions/61473/combining-rotation-scaling-around-a-pivot-with-translation-into-a-matrix
      However, if you want to keep from writing your own code and just use native objects and attributes, what if you sent only the xyz plane values to a gl.mesh and used the rot scale trans attribs on it + a matrixout to do your work. Then you can merge those 3 plane back into the other planes of data as needed with a jit.concat
    • Sep 15 2015 | 3:03 pm
      True - i forgot mesh takes in matrices, and can also output them. Obvious in hind sight. Thanks!
      I didn't want to manage my own transforms because this should be 'out of the box', and that stuff is subtle, row/column order nuances and all sorts of shit.
      Thanks though!
    • Sep 15 2015 | 3:45 pm
      Hrm. Some quick experimentation indicates that jit.gl.mesh isn't actually changing any geometry that is input. Have you tried this before?
    • Sep 15 2015 | 4:00 pm
      Yea, jit.gl.mesh does *not* handle matrix output
      Time to manually hack matrices I guess.
    • Sep 15 2015 | 6:04 pm
      a simple jit.gen will do the trick:
    • Sep 15 2015 | 6:17 pm
      if you need to create transform hierarchies, you can use jit.anim.node. build your tree structure, and then at the leaf nodes simply query worldpos, worldquat and worldscale, and send those values to the jit.gen parameters in the above patch. if that doesn't make sense, let me know.
    • Sep 15 2015 | 7:03 pm
      Thanks. I had finished implementing scale and translate earlier and was looking into rotation. You beat me to it. :)
      Appreciate it Rob :)
    • Sep 15 2015 | 10:35 pm
      Sorry about that Vade. It seemed so natural to me for jit.gl.mesh to have the standard behavior. Glad gen could help you instead.
    • Sep 15 2015 | 10:37 pm
      No worries. I came across a few old threads lamenting the fact. I apparently had purged that small factoid from my mind. That and the fact that jit.gl.model won't load vertex colors got lost.