pointLightFrom

A point light as seen from a point on the shape: the 3D light vector L, the 2D direction toLight and the distance.

pointLightFrom(
  light: {position: Expr; height: Expr | number},
  at: Expr,
  hint: string = 'pl',
): {L: Expr; toLight: Expr; distance: Expr}

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

position is in placement coordinates (see placementPoint). height lifts the light toward the viewer, in the same units. Feed L to lambert and distance to inverseSquare.

Parameters

NameTypeNotes
light{position: Expr; height: Expr | number}
atExpr
hintstringOptional. Default 'pl'.

Example

const onBody = pointLightFrom({position: lightUV, height: u.lightHeight}, frame.sdfUV!)

See also

  • placementPoint — A position prop in the shape's own coordinates, so you can compare it with the field.
  • lambert — How much a light falls on a surface: 0 facing away, 1 facing it.
  • inverseSquare — How a point light fades with distance: 1 at the source, half at range.
  • keyLightAt — A key light from an angle: the light direction .L and the half vector .H for highlights.

Used by

Irradiance