mathematically cosθ|a||b| is the dot product of two vectors, but in blender what does the vector math node do both technically and intuitively?
. If possible could you also please explain the normalize, cross product and subtract operations, and how do these follow with the geometry node?
-
$\begingroup$ The Dot Product is purely mathematical. It seems as if you were wondering about the Geomertry node. If not, edit and explain why you think that it is not mathematical. One a side note, your equation is wrong. This is the correct dotproduct $\endgroup$– LeanderCommented May 16, 2017 at 6:31
-
$\begingroup$ @Leander, it's not wrong, I didn't write the left hand side for briefity $\endgroup$– lindCommented May 16, 2017 at 7:38
2 Answers
The source used for the vector math node can be found here.
For each Operation -
Add, the output Vector is the two input vectors added together. The Value output is the average of the output vector components
(x+y+z)/3
.Subtract, the output Vector is input vector one(upper) minus input vector two(lower). The Value output is the average of the output vector components
(x+y+z)/3
.Average, the output vector is the normalised result of the sum of both inputs. That is the vector divided by the length of the vector. The length is calculated as the square root of the dot product.
Normalize, The result vector is the normalised vector of input vector one. The result value is the length of the vector.
Dot Product, the output value is the dot product of the input vectors, that is vector one times vector two and all components added together
v1.x*v2.x + v1.y*v2.y + v1.z*v2.z
. The Vector output is0,0,0
.Cross Product, the output vector is the cross product of both inputs. The Value output is the length of the result, calculated as the square root of the dot product of the output vector. The cross product is calculated as
result[0] = v1.y * v2.z - v1.z * v2.y result[1] = v1.z * v2.x - v1.x * v2.z result[2] = v1.x * v2.y - v1.y * v2.x
-
$\begingroup$ could you give atleast one example of how the geometry is interpreted by these function? $\endgroup$– lindCommented May 16, 2017 at 7:35
-
$\begingroup$ @lind The geometry itself isn't interpreted - the Geometry node provides details of how a particular light ray interacts with the geometry, so the Position is the vector in space where the interaction occurred, the Normal is the surface normal at that point, etc. The Vector Math node simply operates on those vectors as mathematical functions. $\endgroup$ Commented May 23, 2017 at 6:53
-
$\begingroup$ @RichSedman, Do you have any sources in sight for learning these? $\endgroup$– lindCommented May 23, 2017 at 9:43
I haven't read the source code, but it almost certainly does the Algebraic Definition of dot product from https://en.wikipedia.org/wiki/Dot_product .
For cross product, go read https://en.wikipedia.org/wiki/Cross_product#Computing_the_cross_product .
Add and subtract will be element-wise, so o_i = a_i + b_i
or a_i - b_i
.
Normalize is covered by http://www.wikihow.com/Normalize-a-Vector, although their narrative is kind of awkward.
-
$\begingroup$ I am familiar with the definitions of dot/cross/normalize etc , my point was how do these interpret the geometry? $\endgroup$– lindCommented May 16, 2017 at 4:26
-
$\begingroup$ Well, for a few, the terms are self-explanatory, but for things like Tangent, True Normal, and Parametric, I have no idea. $\endgroup$ Commented May 16, 2017 at 15:15