Dot Product Node
Description
Outputs the dot product of two vectors A and B, which is the sum of the multiplication of each vectors components. For example, if A and B are 3-component vectors, then the result is A.x * B.x + A.y * B.y + A.z * B.z.
If A and B have a different number of components, a cast is performed to match the one with the greater number of components.
The geometric interpretation of the dot product is that it represents the magnitude of one vector's projection onto another. This projection can be visualized as the "shadow" of one vector cast onto the axis defined by the direction of the other.
The dot product is commutative, so the order of arguments is not important.
This operation is essential in shading, determining light intensity based on the alignment between the surface normal and the light direction.
Usage Examples
View-Dependent Shading
The example demonstrates a view-dependent shading effect, where color transitions are based on the alignment between the view direction and the surface normal.
The outputs of the View Direction and Vertex Normal nodes in Tangent space are connected to the Dot Product node that calculates the dot product of these vectors. The result is inverted by subtracting it from 1 using input adapter and passed to the Lerp node as a linear interpolation coefficient. The Lerp node blends between two colors — red and green — based on this coefficient. The result of linear interpolation provides Albedo values for the Material.
The information on this page is valid for UNIGINE 2.20 SDK.