---
title: "charGrid"
description: "The character grid: which cell each pixel falls in, and where it sits inside that cell."
group: "effects"
groupTitle: "Filters & effects"
categoryId: "effects.stylize"
categorySlug: "effects-stylize"
categoryTitle: "Stylize"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/effects/stylize.ts#L303"
---

# charGrid

The character grid: which cell each pixel falls in, and where it sits inside that cell.

```ts
charGrid(slots: {cellSize: PropRef; spacing: PropRef}): FragmentStage
```

Import `effects` from `shaders/std` and use `effects.stylize.charGrid`.

`cellSize` is the cell size in pixels on a 1080-pixel-tall canvas; it scales with the canvas height. `spacing` is how much of the cell the character fills (1 fills it). Build it once and share it with `cellSample`, `glyphFor` and `glyphTint`.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `slots` | `{cellSize: PropRef; spacing: PropRef}` |  |

## Example

```ts
const grid = charGrid({cellSize: p('cellSize'), spacing: p('spacing')})
```

## See also

- [`cellSample`](/docs/primitives/effects-stylize/cellsample) — The color of the layer inside at the centre of each character cell.
- [`glyphFor`](/docs/primitives/effects-stylize/glyphfor) — The character drawn in each cell, picked by how bright the cell is.
- [`glyphTint`](/docs/primitives/effects-stylize/glyphtint) — The finished ASCII look: each character tinted with its cell's color, everything else transparent.

## Used by

[Ascii](/docs/components/ascii)