fieldSlope

The direction the shape's distance grows in: a 2D vector pointing outward at this pixel.

fieldSlope(field: SurfaceField, eps: number = 0.01): Expr

Import materials from shaders/std and use materials.fieldSlope.

Its length is about 1 on a flat shape. eps is the tap step (default 0.01) and must match the stencil step.

Parameters

NameTypeNotes
fieldSurfaceField
epsnumberOptional. Default 0.01.

Example

const grad = fieldSlope(field)

See also

  • nearestEdge — The closest point on the shape's edge to this pixel, and the outward normal there.
  • geometricNormal — The surface normal of the shape, whichever kind of shape is active.
  • tiltAlong — Tilts a normal along one 2D direction by a slope amount.

Used by

Crystal, Frost, Holographic, Irradiance, Plastic, Water