ModelMatrix in the GLSL shader

FineCutBodies's icon

In GLSL shaders you only have ModelViewMatrix.... But what if i need ModelMatrix in the vertex shader? Is there a way in Jitter to help this problem? As i guess Jitter passes the ModelViewMatrix to the shader, so thought maybe there is an option to pass ModelMatrix and ViewMatrix instead.

thanx in adv,
Kevin

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

You will need to calculate it yourself or use something like jit.anim.node. With the latter, hook it as the parent of the GLobject on which you are shading. Then use it to position and rotate your GL object instead of the objects attributes themselves. Send a "gettransform" or "getworldtransform" to the jit.anim.node and then you will get out a message with the 4x4 model matrix. You can then send that message into the shader as a uniform parameter of mat4 type.

FineCutBodies's icon

Thanx Dale, sounds a perfect solution! :)

Kevin

Federico-AmazingMaxStuff's icon

Hi guys, sorry for putting back this old post, but I don't know the syntax to pass the matrix inside the shader. I have tried something like:
<param name="viewProj" type="mat4x4" default="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"/>
to pass a 4x4 matrix but this doesn't seem to work. Thank you for any help

Rob Ramirez's icon

should be type="mat4"

Federico-AmazingMaxStuff's icon

And the rest is okay right? Thank you Rob

Rob Ramirez's icon

i believe so