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

ParameterTypeDefault
operationString"Dot Product"
aOneOf([Vec2, Vec3, Vec2Array, Vec3Array, FieldOf(Vector)])
bOneOf([Vec2, Vec3, Vec2Array, Vec3Array, FieldOf(Vector)])
factorNumber0.500
powerNumber5

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

  1. 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).

  2. 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.

  3. 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.

See also

Math · Gradient · Split / Combine · Vector fields