nearestEdge
The closest point on the shape's edge to this pixel, and the outward normal there.
nearestEdge(
sdfUV: Expr,
sdf: Expr,
slope: Expr,
hint: string = 'edge',
): {point: Expr; normal: Expr}
Import materials from shaders/std and use materials.nearestEdge.
Where a rim glow or contact shadow comes from for pixels outside the shape. slope is fieldSlope; its length is guarded.
Parameters
| Name | Type | Notes |
|---|---|---|
sdfUV | Expr | |
sdf | Expr | |
slope | Expr | |
hint | string | Optional. Default 'edge'. |
Example
const edge = nearestEdge(frame.sdfUV!, field.sdf, fieldSlope(field))
See also
fieldSlope— The direction the shape's distance grows in: a 2D vector pointing outward at this pixel.pointLightFrom— A point light as seen from a point on the shape: the 3D light vectorL, the 2D directiontoLightand thedistance.continuedField— The distance field extended past the edge of an SVG shape's texture.