---
title: "shellRefract"
description: "Coordinates for what sits inside a glass shell, bent where the shell curves."
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#L1129"
---

# shellRefract

Coordinates for what sits inside a glass shell, bent where the shell curves.

```ts
shellRefract(frame: SurfaceFrame, n: Expr, amount: Expr): {
    x: Expr
    y: Expr
    centered: {x: Expr; y: Expr}
}
```

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

Returns `x` and `y` centred on the shape and displaced by the normal's tilt times `amount`, plus the unbent `centered` pair for anything fixed to the container. The bend is strongest at bevels and silhouettes, where real glass bends its interior.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `frame` | `SurfaceFrame` |  |
| `n` | `Expr` |  |
| `amount` | `Expr` |  |

## Example

```ts
const interior = shellRefract(frame, n, u.bend)
```

## See also

- [`rotationSensor`](/docs/primitives/materials/rotationsensor) — How far a 3D shape has rotated, as a 2D pan you can move content by.
- [`refract`](/docs/primitives/math/refract) — The direction `i` bent through a surface with unit normal `n`.

## Used by

[Nebula](/docs/components/nebula)