calculation for the transformation in world space
Matrix is very powerful. Especially "World matrix" is very useful to "bake animation" for exporting to the other softwares. There is pretty nice tutorial "Enter the Matrix Knob" in this nukepedia.com. Well, "Camera" node, "Light" node and "Axis" node have this "World matrix" knob. And "TransfromGeo" node doesn't have it in its property.
Sometimes I want to get the values in this "World matrix" after "TransformGeo" and as they mean the final transformation, I mean it is some kinds of "the transformation in world space".
Simple example
First of all, I will show you "link" or "parent" with "matrix".
Here are two "Axis" nodes with simple connection.
"Axis" node has both "World" and "Local" matrix knob. "World matrix" means the final transformation at that node. "Local matrix" means just how much "translate","rotate" and "scale" at that node.
Let's see their "matrix"
"Local matrix" and "World matrix" have same values in "Axis_parent". And ones of "Axis_child" are two different. In this case,"Axis_parent" is a kind of "root" or "top" node, so they must be same, and "Axis_child" is affected by "Axis_world". This is why the values in "Axis_child" are different.
And Let's calculate for this "World matrix" of "Axis_child" with python. We can get it the multiple with matrix.
The multiple oreder has to be "the matrix of child * the matrix of parent". This is very important.
So it can be written.....
World matrix of Axis_child = Local matrix of Axis_child * World matrix of Axis_parent
In python like this
1 
import math

Let's compare this with "World matrix" in "Axis_local".
{1.63506, 0.761793, 0.863863, 52.2646, 1.07639, 0.47688, 1.61678, 167.706, 0.409846, 1.78669, 0.799856, 175.59, 0, 0, 0, 1}
They are same!!
Working with "TransformGeo"
"TransformGeo" node desn't have "World matrix" knob. So we cannot get final transformation in world space so easily.
And we can make some kind of complicated combination.
The relationship of child and parent is like this
Well, the order of the multiple is....
The transformation of "Sphere" = matrix of "TranformGeoA" * matrix of "AxisA" * matrix of "TranformGeoB" * matrix of "AxisB"
in python like this
1 
import math

This code make "Axis" node named "Axis_result" which has the answer of this multiplication.
Once excute this code, eventually we can get "Axis_result" which has same transformation of "Sphere1"
For good measure
We can get not only matrix but just simple "translate", "rotate" and "scale" as well.
translationOnly(), rotationOnly() and scaleOnly() can provide us those values.
in python like this
1 2 
import math

Thanks,
Comments
http://bit.ly/1GKq04V
Actually I tried it, and It works.
Im net quite getting this and maybe someone can help me.
so. he states that it is the child local * the parent world.
and the result after the python script is what is in the axis world...i get that. but a couple of things.
1. how is he calling the local child vs parent world in the script? because i dont see where these are distinctly called out?
2. if I look at the child local axis_child.matr ix.0 * the parent world matrix.0 and multiply them I dont get the same result as the child world matrix.0 ....so how come this is?
0.56 * 1.07 does not calculate to 1.63..
what am I missing here?
RSS feed for comments to this post