---
title: "fwidthFine / fwidth: WGSL and GLSL function guide"
description: "The screen-space width is the sum of absolute horizontal and vertical derivatives. It estimates how much a value varies across a pixel."
url: https://typeshade.dev/reference/functions/fwidthFine/
language: en
---

# `fwidthFine`

Function

The screen-space width is the sum of absolute horizontal and vertical derivatives. It estimates how much a value varies across a pixel.

**Related names in other languages**

These related operations can differ in arguments, support, and semantics. The foreign names are not accepted TypeShade aliases. Check the target forms and restrictions.

- GLSL: `fwidth`

[Targets](https://typeshade.dev/reference/functions/fwidthFine/#targets)

## Compare examples

Compare a flat field, a horizontal ramp, and a diagonal ramp. Both directions contribute positively.

**Model assumptions**`f(px, py) = a × px + b × py + c`

**Example 1`a = 0; b = 0; c = 5`**

`5` `5` `5` `5`

Field values at neighbouring pixels. The lower row adds a vertical pixel step.

**Result**

`0`

**Example 2`a = 0.25; b = 0; c = 0`**

`0` `0.25` `0` `0.25`

Field values at neighbouring pixels. The lower row adds a vertical pixel step.

**Result**

`0.25`

**Example 3`a = 0.25; b = -0.5; c = 1`**

`1` `1.25` `0.5` `0.75`

Field values at neighbouring pixels. The lower row adds a vertical pixel step.

**Result**

`0.75`

The examples are calculation models and do not run GPU work. The reference below gives the complete call signatures. Decimal results are rounded for display. The stated assumptions determine each example; actual shader results follow the target precision and execution rules.

## When to use it

Use it to soften a procedural edge by approximately one pixel.

## Inputs and limits

The example uses affine fields. It is a pixel footprint estimate, not a gradient length or a CPU derivative. This operation belongs in fragment-stage uniform control flow.

For shader input rules and precision, consult [WGSL](https://www.w3.org/TR/WGSL/) and [GLSL ES 3.00](https://registry.khronos.org/OpenGL/specs/es/3.0/GLSL_ES_Specification_3.00.pdf).

## Related functions

- [`dpdx`](https://typeshade.dev/reference/functions/dpdx/)
- [`dpdy`](https://typeshade.dev/reference/functions/dpdy/)
- [`fwidth`](https://typeshade.dev/reference/functions/fwidth/)

**WGSL**

`fwidthFine(a)`

**GLSL ES 3.00**

`fwidth(a)`

The signature, the sentence and any message are the compiler's own text at commit af54ddad5.

`abs(dpdxFine(x)) + abs(dpdyFine(x))`.

## Syntax

```ts
declare function fwidthFine(a0: f32): f32
declare function fwidthFine<V extends vec2 | vec3 | vec4>(a0: V): V
declare function fwidthFine<T extends Numeric>(a0: T): T
```

A signature may name a type the ambient file declares for its own use. These are those declarations.

**`Numeric`**

`type Numeric = number | vec2 | vec3 | vec4 | vec2i | vec3i | vec4i | vec2u | vec3u | vec4u`

## Parameters

A parameter named by position (`a0`, `a1`) carries a name the ambient file generates. A call passes its arguments in order and names none of them.

- `a0` `f32``V``T`

## Return value

`f32``V``T`

## Description

Fragment stage only; `fwidth` on GLSL; the CPU oracle returns zero.

The CPU oracle has no texture memory and no neighbouring fragments. The call throws unless the module was compiled with `{ gpuStubs: true }`, which returns a placeholder.

## Targets

**WGSL**

`fwidthFine(a)`

**GLSL ES 3.00**

`fwidth(a)`

## See also

- [Functions](https://typeshade.dev/reference/functions/)
- [Builtin table](https://typeshade.dev/guide/language/builtins/#derivatives)
