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

vade's icon

Hello

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.

diablodale's icon

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

vade's icon

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!

vade's icon

Hrm. Some quick experimentation indicates that jit.gl.mesh isn't actually changing any geometry that is input. Have you tried this before?

vade's icon

Yea, jit.gl.mesh does *not* handle matrix output

Time to manually hack matrices I guess.

Rob Ramirez's icon
Max Patch
Copy patch and select New From Clipboard in Max.

a simple jit.gen will do the trick:

Rob Ramirez's icon

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.

vade's icon

Thanks. I had finished implementing scale and translate earlier and was looking into rotation. You beat me to it. :)

Appreciate it Rob :)

diablodale's icon

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.

vade's icon

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.