### Look At VOP node

3351   11   2
Member
40 posts
Joined: March 2018
Offline
Hello,

the documentation about this node does not clarify too much (for me at least). Could somebody clarify a little bit about what applications is it useful for? Some test files to practice? When do you use it?

Member
40 posts
Joined: March 2018
Offline
Okay, at the end I could create a Rotation matrix for that small primitive.

So, now if I multiply the created matrix by the z_axis (0,0,1) I will get my local_z_axis.

I would like to visually check that out…

So following my intuition I tryed to do:
(RotM) x (0,0,1)=?

But I can not do that with the multiply node. I can only do:
(0,0,1)x (RotM)
and the result that I get is -(z_localaxis)

Can somebody help me to understand this? Am I missing something about how Houdini represents vectors maybe? (rows, colms?)

Edited by Dav_Rod - May 20, 2018 17:55:06
Member
77 posts
Joined: Feb. 2017
Offline
Look at function:
http://www.sidefx.com/docs/houdini/vex/functions/lookat.html [www.sidefx.com]

the target's new z-axis = normalize(vector from - vector to)
(I do not know why it is (from - to) but not (to - from)…)
if you use vector up, the target's new x-axis = normalize(cross(vector up, vector new z-axis))

Cross product function:
http://www.sidefx.com/docs/houdini/vex/functions/cross.html [www.sidefx.com]

look at function is similar to the first maketransform function:
>>> matrix3 maketransform(vector zaxis, vector yaxis)
http://www.sidefx.com/docs/houdini/vex/functions/maketransform.html [www.sidefx.com]
Edited by zengchen - May 21, 2018 03:14:41

Attachments:
lookat.hipnc (158.5 KB)

Member
40 posts
Joined: March 2018
Offline
Thanks a lot for the info and specially for the file zengcheng 01. It was really useful work with it in the Vex form.

But my initial questions are still open:

1st: The rotation defined in the theory works like this:
(RotMatrix)x(Vector) as we can see in any Algebra book.

But in the vex from the example it is done the opposite way:
v@P = @P * rotation; And as you can see in my initial post, also in the VOPs I have to do (Vector) * (RotMat). I could not do (RotMat)*(Vector)

2nd: In the vex code in the example the from and to vectors are defined in the opposite way as it should be.

I could not find any other post talking about it.
Can somebody help to understand this?

Edited by Dav_Rod - May 21, 2018 10:58:04
Member
77 posts
Joined: Feb. 2017
Offline
Dav_Rod
Thanks a lot for the info and specially for the file zengcheng 01. It was really useful work with it in the Vex form.

But my initial questions are still open:

1st: The rotation defined in the theory works like this:
(RotMatrix)x(Vector) as we can see in any Algebra book.

for the first question:
the vector in Houdini has three columns but not three rows…
Edited by zengchen - May 21, 2018 11:31:31
Member
7207 posts
Joined: Sept. 2011
Offline
Houdini matrices will be represented transposed from how they are in math text books. Houdini uses Row-major matrices, which are multiplied in reverse order from column major.

https://en.wikipedia.org/wiki/Row-_and_column-major_order [en.wikipedia.org]
Member
77 posts
Joined: Feb. 2017
Offline
my teacher only told me the Row-major when using Houdini…
i have never cared about the major order (╥_╥)
Edited by zengchen - May 21, 2018 12:09:30
Member
40 posts
Joined: March 2018
Offline
jsmack
Houdini matrices will be represented transposed from how they are in math text books. Houdini uses Row-major matrices, which are multiplied in reverse order from column major.

https://en.wikipedia.org/wiki/Row-_and_column-major_order [en.wikipedia.org]

ouuuuuukay now everything fits better.

But still seems that the definition in the documentation (to-from) should be (from -to)?

Thanks for all replies and links.
Helps a lot
Member
98 posts
Joined: Aug. 2014
Offline
Dav_Rod
Hello,

the documentation about this node does not clarify too much (for me at least). Could somebody clarify a little bit about what applications is it useful for? Some test files to practice? When do you use it?

When it comes to practice, it does the same as Aim/Direction constraint in DCC apps, perhaps this is one of most important constraints for rigging, also is a sort of complement to IK chain. Both are able to create rotation from input positions.
One a bit unusual thing is ‘from’. By leaving ‘from’ to zero and feeding two non-parallel vectors into ‘to’ and up vector it does exactly the same as Aim/Direction constraint.
If you just want a test file, I could offer this thing [vimeo.com] - probably is a way over complicated as example, anyway I'd believe it's full of ‘practical solutions’, typical for rigging and building the deformations.
Member
8023 posts
Joined: July 2007
Online
Dav_Rod

But still seems that the definition in the documentation (to-from) should be (from -to)?

lookat is quite old node/function and it seems to be based on the idea around camera look at constraint

since camera x-axis points right y-axis up, then in right handed coordinate system z-axis points back
so the forward camera direction is negative z (so -z)

therefore Lookat VOP builds matrix that points -z in the direction from->to and aligns y using up vector just so that the camera is looking from “from” to “to” location rather than arbitrary positive z pointing that way
Tomas Slancik
FX Supervisor
Method Studios, NY
Member
77 posts
Joined: Feb. 2017
Offline
tamte
lookat is quite old node/function and it seems to be based on the idea around camera look at constraint

since camera x-axis points right y-axis up, then in right handed coordinate system z-axis points back
so the forward camera direction is negative z (so -z)

i am suddenly enlightened…thanks a lot
Member
40 posts
Joined: March 2018
Offline
Thanks you all zengchen01, tamte, amm, jsmack, now everything fits logically great.

Was a nice solution to the puzle