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

ParameterTypeDefaultWhat it does
operationString"Dot Product"Vector operation mode. One of: Dot Product, Cross Product, Normalize, Length, Distance, Reflect, Refract, Fresnel, Project, Faceforward, Mix, Scale.
aVec2 or Vec3 or Vec2[] or Vec3[] or Vector Field—First vector operand (Fresnel/Refract: surface normal N)
bVec2 or Vec3 or Vec2[] or Vec3[] or Vector Field—Second vector operand (Fresnel: view dir V; Refract: incident dir I)
factorNumber0.500Blend factor (Mix), scalar multiplier (Scale), or refraction ratio η = n1/n2 (Refract; ~0.667 = air→glass)
powerNumber5Fresnel rim sharpness: pow(1 - saturate(N·V), power). 5 ≈ physical Schlick; higher = tighter rim.

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