Field Math
Combines two fields with a math operation, or reshapes one field on its own (Normalize, Magnitude). Supports scalar-scalar, vector-vector, and mixed scalar-vector combinations.
Category: Math Menu path: Math > Field Math
Ports
| Port | Type | Direction | Description |
|---|---|---|---|
a | scalarField | input | First field operand (also accepts vectorField and scalar). The only input the unary operations read |
b | scalarField | input | Second field operand (also accepts vectorField and scalar). Ignored by Normalize and Magnitude |
scalarField | scalarField | output | Combined scalar field result |
vectorField | vectorField | output | Combined vector field result |
Parameters
| Param | Type | Default | Description |
|---|---|---|---|
operation | enum | Multiply | Math operation: Add, Subtract, Multiply, Divide, Min, Max, Lerp, Power, Screen, SmoothMin, SmoothMax, Normalize, Magnitude |
t | scalar | 0.5 | Lerp factor (Lerp) OR smoothness coefficient k (SmoothMin, SmoothMax) |
The t param is visible only for Lerp, SmoothMin, and SmoothMax — it does double-duty across those three operations. For every other operation only operation is shown.
Operations
| Operation | Formula |
|---|---|
| Add | A + B |
| Subtract | A - B |
| Multiply | A * B |
| Divide | A / B |
| Min | min(A, B) |
| Max | max(A, B) |
| Lerp | A + (B - A) * t |
| Power | A ^ B |
| Screen | 1 - (1 - A) * (1 - B) |
| SmoothMin | polynomial smooth min with smoothness k = t: degenerates to min at t = 0, widens the smooth blend radius as t grows |
| SmoothMax | polynomial smooth max: -SmoothMin(-A, -B, t) |
| Normalize | unary — vector: `A / |
| Magnitude | unary — vector → scalar: `min( |
SmoothMin / SmoothMax produce blended level sets when applied to two distance fields — the core primitive for metaballs. Combine with ContourExtract downstream to extract the blended boundary as a shape:
DistanceField(A) ─┐
├─► FieldMath(SmoothMin, t=0.3) ─► ContourExtract ─► DrawShape
DistanceField(B) ─┘Typical t values for [0, 1] fields like normalized distance: 0.1–0.5. Higher t = wider smooth transition.
Unary Operations
Normalize and Magnitude work on input a alone. Leave b empty — anything wired there is ignored — and t is hidden.
Normalize keeps a vector field's direction and throws away its strength: every sample is scaled to length 1, and where the field is zero it stays zero. A Field Gradient that pulls hard next to a shape and barely at all far away becomes a constant-speed pull everywhere. A scalar field has no direction to keep, so it passes through unchanged (it still comes out on scalarField).
Magnitude turns a vector field into the scalar field of its lengths, on the scalarField port. Fields are bipolar — −1 to 1 on each axis — so a full-strength diagonal is √2 ≈ 1.41 long, and anything above 1 is clamped to 1. If that top end matters, run the vector through Field Remap first (its vector mode reshapes the length while keeping the direction — set outMax to 0.7 and nothing clips), then Magnitude. A scalar field in gives |A| — no change for an ordinary 0–1 field, a fold of the negative half when a consumer samples it bipolar.
How It Works
FieldMath composes fields lazily -- the operation is applied at eval() time when a consumer samples the combined field. No GPU textures are allocated.
Type dispatch:
- Both scalar fields -> scalar output.
- Both vector fields -> vector output (component-wise operations).
- Mixed scalar and vector -> vector output. The scalar is used as a weight in [0, 1] space (not bipolar [-1, 1]) to modulate the vector field.
- Scalar values (from Constant or Math nodes) are promoted to constant fields.
- Unary operations (Normalize, Magnitude) read
aonly and pick the output port by result type: a vector stays onvectorFieldfor Normalize and becomes ascalarFieldfor Magnitude; a scalaraalways comes out onscalarField.
Single-input passthrough: For the binary operations, if only one input is connected the field passes through unmodified.
Usage Examples
Basic: Mask a flow field
Noise.vectorField -> FieldMath.a (Multiply). DistanceField.scalarField -> FieldMath.b. The noise flow is multiplied by the distance field falloff -- particles flow near the shape but are still outside it.
Blend two noise fields
Noise1.scalarField -> FieldMath.a (Add). Noise2.scalarField -> FieldMath.b. Combines two noise patterns for a more complex field.
Lerp between fields
Noise1.vectorField -> FieldMath.a (Lerp, t: keyframed 0 to 1). Noise2.vectorField -> FieldMath.b. Smoothly transitions from one flow field to another over time.
Screen compositing
DistanceField1.scalarField -> FieldMath.a (Screen). DistanceField2.scalarField -> FieldMath.b. Produces a union-like combination where both fields contribute without exceeding 1.0.
Normalize a force
Field Gradient → Field Math (Normalize) → Point Solver.forces. The gradient's pull is only as strong as the slope under each particle, so particles snap in near the target and barely move far from it. Normalizing makes every particle feel the same pull toward the centre wherever it is — an even, steady drift. Set the overall speed with the solver's forceStrength, and multiply by a scalar field afterwards (Multiply, with a Distance Field or Gradient in b) if you want the constant speed and a mask.
Use a flow's strength to drive size
Noise.vectorField → Field Math (Magnitude) → Point Attributes (target Scale, field_in). Points sitting in the fast part of the flow grow; points in the still regions shrink — the same field that moves the particles also sizes them. Any field-reading target works: Opacity, Color through Colorize, stroke width through Shape Attributes.
Tips
- Multiply is the default and most common operation -- it works like a field mask
- Mixed scalar-vector math uses [0, 1] range for the scalar (not [-1, 1]), so a scalar value of 0.5 halves the vector
- Field operations are lazy -- chaining multiple FieldMath nodes has no cost until a consumer evaluates the combined field
- Screen is useful for combining multiple distance fields into a soft union
- Magnitude of a Curl or Vortex field shows where the swirl is strongest — send it to Draw Field (or Colorize) to see a force field's strength map
- Normalize then Multiply is the "constant speed, but only here" pattern: direction from one field, on/off from another
Related Nodes
- Remap -- reshape a single field's value distribution via curve (magnitude-preserving for vectors — the tool for rescaling before Magnitude)
- FieldGradient -- slope of a scalar field; the usual thing to Normalize
- Noise -- common field source for both scalar and vector
- DistanceField -- shape-based field source
- Math -- scalar math operations (non-field)
- PointAdvect -- consumer of combined vector fields
- PointSolver -- sums vector fields as forces; Normalize feeds it a constant-speed pull
- PointAttributes -- reads a Magnitude field to size, fade, or colour particles