---
title: "lightBeam"
description: "The glow of a beam that can be thicker or softer at one end than the other."
group: "light"
groupTitle: "Noise, light & materials"
categoryId: "light"
categorySlug: "light"
categoryTitle: "Light"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/paint/light.ts#L606"
---

# lightBeam

The glow of a beam that can be thicker or softer at one end than the other.

```ts
lightBeam(
  dist: Expr,
  t: Expr,
  thickness: {start: Expr; end: Expr},
  softness: {start: Expr; end: Expr},
): Expr
```

Import `light` from `shaders/std` and use `light.lightBeam`.

Give it the distance from the line and the position along it from `segmentProject`. Thickness and softness blend from `start` to `end` along the beam, in the distance unit. Returns `vec2(colorT, alpha)`: `alpha` is 1 inside the beam and fades to 0 outside, and `colorT` runs 0 at the core to 1 at the edge so you can shade the two differently.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `dist` | `Expr` |  |
| `t` | `Expr` |  |
| `thickness` | `{start: Expr; end: Expr}` |  |
| `softness` | `{start: Expr; end: Expr}` |  |

## Example

```ts
const beam = lightBeam(seg.member('y'), seg.member('x'), {start: p('startThickness'), end: p('endThickness')}, {start: p('startSoftness'), end: p('endSoftness')})
```

## See also

- [`segmentProject`](/docs/primitives/light/segmentproject) — Where a pixel falls along a line from `a` to `b`, and how far it is from that line.