---
title: "inverseSquare"
description: "How a point light fades with distance: 1 at the source, half at `range`."
group: "light"
groupTitle: "Noise, light & materials"
categoryId: "materials"
categorySlug: "materials"
categoryTitle: "Materials & surfaces"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/paint/materials.ts#L1363"
---

# inverseSquare

How a point light fades with distance: 1 at the source, half at `range`.

```ts
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

```ts
const lit = mul(lambert(n, onBody.L), inverseSquare(onBody.distance, u.lightRange))
```

## See also

- [`pointLightFrom`](/docs/primitives/materials/pointlightfrom) — A point light as seen from a point on the shape: the 3D light vector `L`, the 2D direction `toLight` and the `distance`.
- [`lambert`](/docs/primitives/materials/lambert) — How much a light falls on a surface: 0 facing away, 1 facing it.

## Used by

[Irradiance](/docs/components/irradiance)