Skip to content

Math

Performs one of 28 scalar math operations on one or two inputs. Pure CPU value node.

Category: Math Menu path: Math > Math

Ports

PortTypeDirectionDescription
ascalarinputFirst operand
bscalarinputSecond operand (not used by unary operations)
outscalaroutputResult

Parameters

ParamTypeDefaultDescription
operationenumAddThe math operation to perform (see table below)
ascalar0Fallback value for input A when not connected
bscalar0Fallback value for input B when not connected
tscalar0.5Interpolation factor (Lerp, Smoothstep)
inMinscalar0Input range minimum (Remap)
inMaxscalar1Input range maximum (Remap)
outMinscalar0Output range minimum (Remap)
outMaxscalar1Output range maximum (Remap)
clampbooleantrueClamp output to range (Remap, Clamp)
minscalar0Minimum bound (Clamp)
maxscalar1Maximum bound (Clamp)
stepscalar1Step size (Snap)

The Properties panel automatically shows only the params relevant to the selected operation.

Operations

Binary (A, B)

OperationFormula
AddA + B
SubtractA - B
MultiplyA * B
DivideA / B
PowerA ^ B
ModuloA % B
Atan2atan2(A, B)

Comparison

OperationFormula
Minmin(A, B)
Maxmax(A, B)
Clampclamp(A, min, max)

Rounding

OperationFormula
Floorfloor(A)
Ceilceil(A)
Roundround(A)
Snapround(A / step) * step

Unary (A only)

OperationFormula
Abs`
Negate-A
Signsign(A) (returns -1, 0, or 1)
Sqrtsqrt(A)

Trigonometry

OperationFormula
Sinsin(A)
Coscos(A)
Tantan(A)

Interpolation

OperationFormula
LerpA + (B - A) * t
StepA < B ? 0 : 1
Smoothstepsmoothstep from A to B at t
Remapmaps A from [inMin, inMax] to [outMin, outMax]

Looping

OperationFormula
Pingpongbounces A between 0 and B
Wrapwraps A into range [0, B)

How It Works

Math is a lightweight CPU-only node that produces a scalar value. It does not allocate GPU textures. The operation is evaluated every frame, making it ideal for building expressions from Time, Constant, and other value nodes.

When an input port is not connected, the corresponding param value (a or b) is used as the operand. When a port is connected, the incoming value overrides the param.

Usage Examples

Basic: Oscillating value

Time.seconds -> Math (Sin). Produces a value oscillating between -1 and 1. Chain another Math (Remap, inMin: -1, inMax: 1, outMin: 0, outMax: 360) to get a 0-360 range for rotation.

Clamped speed

Time.normalized -> Math (Multiply, b: 2) -> Math (Clamp, min: 0, max: 1). Doubles the speed but caps at 1.0.

Stepped animation

Time.frame -> Math (Snap, step: 5). Frame number quantized to multiples of 5 for a hold-frame effect.

Looping value

Time.frame -> Math (Modulo, b: 60). Cycles 0-59 repeatedly for a 60-frame loop.

Tips

  • Only the params relevant to the current operation are shown in Properties -- switching operations updates the panel
  • Chain Math nodes for complex expressions (e.g., sin(time * 2) * 50 + 100)
  • Unary operations ignore input B and hide the b param
  • Math output is a scalar -- use MakeVector to combine into vec2/vec3 for spatial parameters
  • VectorMath -- same concept for vec2 operations
  • Time -- common input source for animated expressions
  • Constant -- fixed value source
  • MakeVector -- combine scalar results into vectors
  • Remap -- curve-based field remapping (more control than Math's Remap)