---
title: "clampSplatGridSize"
description: "The grid size `pointerSplatField` really uses for a prop value: floored, then held to 8–128."
group: "effects"
groupTitle: "Filters & effects"
categoryId: "effects.pointerFields"
categorySlug: "effects-pointerfields"
categoryTitle: "Pointer fields"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/effects/pointerFields.ts#L48"
---

# clampSplatGridSize

The grid size `pointerSplatField` really uses for a prop value: floored, then held to 8–128.

```ts
clampSplatGridSize(v: number): number
```

Import `effects` from `shaders/std` and use `effects.pointerFields.clampSplatGridSize`.

Use it in the `gridSize` prop's recompile rule, so the simulation rebuilds only when the cell count changes and not on every drag of the slider.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `v` | `number` |  |

## Example

```ts
gridSize: {default: 20, recompile: recompileWhen((prev, next) => clampSplatGridSize(prev as number) !== clampSplatGridSize(next as number))}
```

## See also

- [`pointerSplatField`](/docs/primitives/effects-pointerfields/pointersplatfield) — A field the cursor smears: cells near the pointer move with it, then fade back to rest.

## Used by

[GridDistortion](/docs/components/griddistortion)