placementPoint

A position prop in the shape's own coordinates, so you can compare it with the field.

placementPoint(params: GpuFragmentParams, position: Expr, hint: string = 'placed'): Expr

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

Takes a transformPosition prop and applies the same center, scale and rotation the shape has. Distances from it are in placement units, not canvas units.

Parameters

NameTypeNotes
paramsGpuFragmentParams
positionExpr
hintstringOptional. Default 'placed'.

Example

const lightUV = placementPoint(params, params.uniforms.lightPosition)

See also

  • pointLightFrom — A point light as seen from a point on the shape: the 3D light vector L, the 2D direction toLight and the distance.
  • nearestEdge — The closest point on the shape's edge to this pixel, and the outward normal there.

Used by

Irradiance