Field Gradient
The slope of a scalar field as a vector field. Every sample points uphill — toward higher values — so particles driven by it flow into the bright parts of an image or the centre of a radial ramp. Curl is this same vector rotated 90°.
Category: Fields Menu path: Fields > Field Gradient
Ports
| Port | Type | Direction | Description |
|---|---|---|---|
in | scalarField | input | The scalar field to take the slope of. Scalar fields only (fields are strictly typed); a plain scalar value connects but is flat, so it yields no push |
out | vectorField | output | ∇s = (∂s/∂x, ∂s/∂y) — unit-less, −1 to 1 per axis, like every other force field |
Parameters
| Param | Type | Default | Description |
|---|---|---|---|
step | scalar | 1.0 | Sample distance in comp pixels for the slope estimate. Same meaning as Curl's step: larger = smoother, smaller = sharper but noisier |
strength | scalar | 1.0 | Multiplier on the slope. 1 = a 0→1 ramp spread across 100 px pushes at full strength (1.0). A 200 px ramp pushes at 0.5, a 50 px ramp saturates at 1.0. Raise it for wide, gentle fields; lower it to keep sharp edges from clipping |
invert | boolean | off | Flip the vector — flow downhill, toward darker / lower values |
How It Works
At each sample the node reads the input field a step either side in x and in y and takes the central difference, exactly the stencil Curl uses. The result is the field's gradient: a vector pointing the way the value increases, as long as the slope is steep. Where the field is flat (a plateau, a solid area, a constant) the vector is zero.
The raw slope of a smooth field is tiny — 0.01 per pixel for a 0→1 ramp over 100 px — which is why Curl users end up multiplying by thousands downstream. Field Gradient bakes that scale in: the output is slope × 100 px × strength, so the default is usable straight away. Each axis is clamped to −1…1 on the way out, matching Curl, so a very sharp edge saturates rather than producing a runaway push.
Because Curl is the gradient turned 90° (curl(s) = (−∂s/∂y, ∂s/∂x)), the two nodes pair naturally: Field Gradient pulls particles into a feature, Curl makes them orbit it. Feed both into a Point Solver's forces to get a spiral.
Usage Examples
Basic: Attractor with a drawn falloff
Gradient (mapping Radial) → Field Gradient → Point Solver.forces. A radial gradient is brightest at its centre, so the slope points inward everywhere and particles are pulled to the middle. The gradient's ramp is the falloff curve — reshape it to make the pull sharpen near the centre or fade at the edge, and move the gradient's centre (or keyframe it) to move the attractor. Turn invert on and it becomes a repeller.
Basic: Flow toward the bright parts of an image
Image Source → Image Sample (channel Luminance, coordinateSpace Comp) → Field Gradient → Point Solver.forces. Particles drift toward light areas and pile up on bright edges. Blur the image first (or raise step) for a broader, calmer pull; leave it sharp for particles that snap to detail.
Creative: Spiral into a shape
Take one Distance Field of a shape and feed its scalarField into both a Field Gradient (inward pull) and a Curl (rotation), then sum them with Field Math (Add) into the solver's forces. Particles spiral in along the shape's outline. Balance the two with each node's strength (Curl's via a Field Math Multiply).
Tips
- Nothing moving? The field is probably flat where the particles are. A Radial gradient covering the whole comp has a slope of only ~0.1 per unit strength on a 1080p comp — raise
strengthto 5–10, or tighten the gradient'sscaleso the ramp is steeper. - Particles jittering on an image-driven field? That is pixel noise in the slope. Raise
stepto 4–8 px, or blur the image before Image Sample. - Field Gradient with
invertoff is a descent toward brightness; with it on it is the classic "roll downhill" of a height map. Use a Distance Field as the height map and you get particles that settle onto (or flee from) a shape. - Inside a Point Solver the output is scaled by the solver's
forceStrengthlike every other force; an individual field's weight is this node'sstrength. - Curl has no strength knob of its own; its output is the raw slope. To make Curl match Field Gradient's scale, multiply it by 50 with a
Field Math— or just remember the two differ by that factor.
Related Nodes
- Curl — the same slope rotated 90°: orbit instead of pull
- RadialForce — a purpose-built attractor with its own falloff; Field Gradient is the general version that takes any scalar field as the falloff
- Gradient — the usual way to draw an attractor's falloff
- ImageSample — bring an image's luminance in as the scalar field
- DistanceField — a shape as the scalar field: pull to (or push from) its outline
- FieldMath — combine several forces, or
Normalizethe result for a constant-speed pull - PointSolver — the consumer this node is built for