---
title: "opticalThickness"
description: "How much material the view passes through at this pixel: 0 at the edge, up to about 1.2 deep inside."
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#L866"
---

# opticalThickness

How much material the view passes through at this pixel: 0 at the edge, up to about 1.2 deep inside.

```ts
opticalThickness(field: SurfaceField, frame: SurfaceFrame): Expr
```

Import `materials` from `shaders/std` and use `materials.opticalThickness`.

Multiply by a density prop and feed `beerLambert` for glass, ice and water.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `field` | `SurfaceField` |  |
| `frame` | `SurfaceFrame` |  |

## Example

```ts
const thickness = mul(opticalThickness(field, frame), u.density)
```

## See also

- [`beerLambert`](/docs/primitives/materials/beerlambert) — How much light survives a thickness of tinted material, per channel.

## Used by

[Frost](/docs/components/frost), [Water](/docs/components/water)