Go to: Related nodes. Attributes.

The Vector Product utility node lets you multiply a vector by another vector in several different ways. The Vector Product node has three parts; two input attributes, an operator that is applied to the two input attributes, and an output attribute for holding the result of the operation.

This node uses standard vector/matrix mathematics. Say we have two input vectors, (a,b,c) and (d,e,f), and we are calculating the output vector (x, y, z). The calculations are defined as follows:
The Dot Product is useful for comparing the direction of two vectors. If you turn on "Normalize Output", the Dot Product is actually the cosine of the angle between the two vectors. A value of 1.0 means the vectors point the same way. A value of 0 means that they are at right angles to each other. And a value of -1 means that the vectors point in opposite directions. Dot Product is defined as follows:
  Dot Product = (a*d) + (b*e) + (c*f)
  
A dot product is a single value, so all three output values x, y and z will be set to the same thing. The Cross Product of two vectors gives you a new vector. This new vector is guaranteed to be perpendicular (i.e. at right angles to) both of the input vectors. Cross Product is defined as follows:
    x = (b*f)-(c*e)
y = (c*d)-(a*f)
z = (a*e)-(b*d)
Note: If you just want to do simple component-by-component combinations of your vectors (i.e., x = a*d, y=b*e, z=c*f) then you should use the Multiply Divide utility node instead of the Vector Product utility node. The Vector Matrix Product is useful for taking a vector in one coordinate space and moving it to another. For example, if you have a vector in camera coordinate space, you can multiply it by the Xform Matrix attribute of the camera. That will give you a new vector in world coordinate space. Similarly, the Point Matrix Product is useful for taking a point in one coordinate space and moving it to another. For example, if you have a point in camera coordinate space, you can multiply it by the Xform Matrix attribute of the camera. That will give you a new point in world coordinate space. Given an input vector (a, b, c) and an input matrix:
 A B C D
 E F G H
 I J K L
 M N O P
 
Then Vector Matrix Product is defined as follows:
 x = (a*A) + (b*B) + (c*C)
 y = (a*E) + (b*F) + (c*G)
 z = (a*I) + (b*J) + (c*K)
 
And the Point Matrix Product is defined as follows:
 x = (a*A) + (b*B) + (c*C) + D
 y = (a*E) + (b*F) + (c*G) + H
 z = (a*I) + (b*J) + (c*K) + L
 
In the table below, important attributes have their names listed in bold in the description column.

This node is MP safe

Node name Parents Classification MFn type Compatible function sets
vectorProduct shadingDependNode utility/general:drawdb/shader/operation/vectorProduct kVectorProduct kBase
kNamedObject
kDependencyNode
kVectorProduct

Related nodes

plusMinusAverage, reverse, chooser, choice, blend, blendTwoAttr, blendWeighted, blendDevice

Attributes (15)

input1, input1X, input1Y, input1Z, input2, input2X, input2Y, input2Z, matrix, normalizeOutput, operation, output, outputX, outputY, outputZ

Long name (short name) Type Default Flags
operation (op) enum 1 outputinputconnectablestorable
The operation to be performed on the inputs. (See detailed descriptions at the top). Values are:
No operation: The value of Input1 is copied to the Output. All other inputs are ignored. Dot Product: Each of the components of Output is set to the dot product of Input 1 and Input 2. Cross Product: Output is set to the cross product of Input 1 and Input 2. Vector Matrix Product: Output is set to the vector-matrix product of Input 1 and Matrix. Input 2 is ignored. Point Matrix Product: Output is set to the point-matrix product of Input 1 and Matrix. Input 2 is ignored.
input1 (i1) float3 0.0, 0.0, 0.0 outputinputconnectablestorablekeyable
Input 1 is the first vector input, used for all operations.
input1X (i1x) float 0.0 outputinputconnectablestorablekeyable
The x component of Input 1
input1Y (i1y) float 0.0 outputinputconnectablestorablekeyable
The y component of Input 1
input1Z (i1z) float 0.0 outputinputconnectablestorablekeyable
The z component of input 1
input2 (i2) float3 0.0, 0.0, 0.0 outputinputconnectablestorablekeyable
Input 2 is the second vector input, used for the Dot Product and Cross Product operations only.
input2X (i2x) float 0.0 outputinputconnectablestorablekeyable
The x component of Input 2
input2Y (i2y) float 0.0 outputinputconnectablestorablekeyable
The y component of Input 2
input2Z (i2z) float 0.0 outputinputconnectablestorablekeyable
The z component of Input 2
matrix (m) fltMatrix identity outputinputconnectablestorable
Matrix is the matrix input, used for the Vector Matrix Product and Point Matrix Product operations only. This attribute is only connectable in the Connection Editor window.
normalizeOutput (no) bool false outputinputconnectablestorablekeyable
Normalize Output. If this is turned on, then this node will attempt to normalize the vector output. This means that the output vector will be re-sized to a length of 1, while maintaining the same direction. If the vector is of zero length, an error will be produced. For Dot Product (which does not produce a vector), turning on Normalize output will guarantee the output values lie between -1 and 1. Effectively, the output will be the cosine of the angle between the input vectors.
output (o) float3 1.0, 0.0, 0.0 outputconnectable
Output is the result of the calculation performed by this node.
outputX (ox) float 0.0 outputconnectable
The X component of Output
outputY (oy) float 0.0 outputconnectable
The Y component of Output
outputZ (oz) float 0.0 outputconnectable
The Z component of Output