inverseSquare
How a point light fades with distance: 1 at the source, half at range.
inverseSquare(distance: Expr, range: Expr | number): Expr
Import materials from shaders/std and use materials.inverseSquare.
Parameters
| Name | Type | Notes |
|---|---|---|
distance | Expr | |
range | Expr | number |
Example
const lit = mul(lambert(n, onBody.L), inverseSquare(onBody.distance, u.lightRange))
See also
pointLightFrom— A point light as seen from a point on the shape: the 3D light vectorL, the 2D directiontoLightand thedistance.lambert— How much a light falls on a surface: 0 facing away, 1 facing it.