Vector Math
Vector operations: dot, cross, normalise, length, distance, reflect, refract, Fresnel, project, faceforward, mix, and scale.
What it does
Vector Math runs the operations that treat a vector as a whole direction or position rather than a bundle of independent numbers: dot products, cross products, normalising, measuring length or distance, reflecting off a surface, and more. Operation exposes only the inputs it uses. Some take one vector, some take two, and Mix, Scale, Refract and Fresnel add a scalar control.
It runs on a single vector or on a whole array of vectors, so per-point data, normals, positions, velocities, can be wired straight in and every element is processed.
When to use it
The angle or facing relationship between two directions → Dot Product
A perpendicular vector from two others, for example building a surface normal → Cross Product
A direction without its length → Normalize
A distance, speed or magnitude as a plain number → Length / Distance
A bounce direction off a surface → Reflect
A bent direction through a surface, as with light entering glass or water → Refract
A rim-light or facing-ratio falloff, edges bright and straight-on dark → Fresnel
The component of one vector along another → Project
A vector flipped so it points away from a surface → Faceforward
A direction or position blended or scaled → Mix / Scale
| Parameter | Type | Default |
|---|---|---|
operation | String | "Dot Product" |
a | OneOf([Vec2, Vec3, Vec2Array, Vec3Array, FieldOf(Vector)]) | — |
b | OneOf([Vec2, Vec3, Vec2Array, Vec3Array, FieldOf(Vector)]) | — |
factor | Number | 0.500 |
power | Number | 5 |
Gotchas
The scalar control changes meaning with Operation: blend amount on Mix, multiplier on Scale, and refraction ratio (η = outside index ÷ inside index) on Refract, about 0.667 for light entering glass from air. It appears only for the operations that use it.
2D vectors are accepted everywhere a vector input is, treated as flat vectors with no depth. Cross Product on two 2D vectors still returns a 3D result, with the interesting part entirely in its third component.
Reflect, Faceforward and Project treat the second vector (B) as a direction to measure against. For Reflect, B is the surface normal being bounced off and should be unit-length for a correct bounce. Use Normalize on it first if it did not come from a normal-generating node.
Fresnel and Refract read A as the surface normal (N) and B as the view or incoming direction (V / I). Both assume normalised inputs. If the result looks too dark, too bright, or the rim is uneven, normalise A and B before this node.
Worked example
Add a Vector Math node and set Operation to Dot Product. Wire two direction vectors into A and B to test how aligned they are (1 = same direction, 0 = perpendicular, -1 = opposite).
Switch Operation to Fresnel for a facing-based falloff instead. Wire a surface normal into A and a view direction into B, then raise Power for a tighter rim.
Switch to Mix and wire two vectors into A and B; drag Factor to blend between them, or wire another node into Factor to drive the blend per-point.