---
title: "Light"
description: "Words for drawing light: glows, rays, beams, flares and halos, plus the frames they are drawn in."
group: "light"
groupTitle: "Noise, light & materials"
categoryId: "light"
categorySlug: "light"
wordCount: 40
curated: true
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/paint/light.ts"
editUrl: "https://github.com/shader-effects-inc/shaders/edit/main/packages/core/docs/std/light.md"
---

# Light

Words for drawing light: glows, rays, beams, flares and halos, plus the frames they are drawn
in. A **frame** is the coordinate system a light evaluates in. [`radialFrame`](/docs/primitives/light/radialframe) gives each pixel
its distance and angle from a center; [`beamFrame`](/docs/primitives/light/beamframe) gives its distance along and across a beam.
**Parts** such as [`glowPoint`](/docs/primitives/light/glowpoint), [`rayLobes`](/docs/primitives/light/raylobes) and [`featherMask`](/docs/primitives/light/feathermask) shape a light over a frame and
return a *field*, a 0–1 number per pixel. [`withFrame`](/docs/primitives/light/withframe) evaluates a part in a frame,
[`modulate`](/docs/primitives/light/modulate) multiplies parts (a mask over a pattern), and [`additive`](/docs/primitives/light/additive) sums finished lights.

A light field becomes color at the end of the recipe. [`coverageMix`](/docs/primitives/light/coveragemix) and [`coverageOver`](/docs/primitives/light/coverageover) color
a field over a background as a finished `paint:`. [`heatRamp`](/docs/primitives/light/heatramp) turns a heat field into
overexposed color, and [`screenGlow`](/docs/primitives/light/screenglow) shines it onto the layer inside as an `effect:`. Emitted
light drawn over transparency closes with `emissiveAlpha` from `compose`.

```ts
import {light} from 'shaders/std'
```

## Reach for it when

| When you need | Use |
|---|---|
| a soft round glow at a position | [`glowAt`](/docs/primitives/light/glowat) |
| a glow, rays or a halo around a center prop | [`radialFrame`](/docs/primitives/light/radialframe) + [`withFrame`](/docs/primitives/light/withframe) with [`glowPoint`](/docs/primitives/light/glowpoint), [`rayLobes`](/docs/primitives/light/raylobes), [`ringBand`](/docs/primitives/light/ringband) |
| a light that fades at a radius | [`featherMask`](/docs/primitives/light/feathermask) |
| light spilling from an emitter with a real falloff | [`emitterFalloff`](/docs/primitives/light/emitterfalloff) |
| volumetric rays or god rays | [`noiseRays`](/docs/primitives/light/noiserays) in a [`seamlessRadialFrame`](/docs/primitives/light/seamlessradialframe) |
| coloring a light field over a background | [`coverageMix`](/docs/primitives/light/coveragemix) or [`coverageOver`](/docs/primitives/light/coverageover) |
| a beam anchored at a point aimed at the canvas | [`beamFrame`](/docs/primitives/light/beamframe) with [`beamBloom`](/docs/primitives/light/beambloom), [`beamStreaks`](/docs/primitives/light/beamstreaks) |
| a beam between two points, tapered end to end | [`segmentProject`](/docs/primitives/light/segmentproject) + [`lightBeam`](/docs/primitives/light/lightbeam) |
| a camera lens flare | [`flareFrame`](/docs/primitives/light/flareframe) + the `flare*` parts, closed with [`flareComposite`](/docs/primitives/light/flarecomposite) |
| a shiny surface from a normal field | [`shine`](/docs/primitives/light/shine) |
| turning a heat field into overexposed color | [`heatRamp`](/docs/primitives/light/heatramp) |
| darkening the corners | [`vignetteMask`](/docs/primitives/light/vignettemask) |
| a glow that behaves like exposure over a child | [`screenGlow`](/docs/primitives/light/screenglow) |

## Example

```ts
import {defineShader, p, light, compose, math, transformColor, transformPosition} from 'shaders/std'

const {radialFrame, withFrame, modulate, glowPoint, softRayLobes, featherMask} = light

// A sun: soft rays spinning around a draggable center, feathered at a radius, drawn as emitted light.
export const Sun = defineShader({
  name: 'Sun',
  animatedTime: {speed: 'speed'},
  props: {
    center: {default: {x: 0.5, y: 0.5}, transform: transformPosition},
    color: {default: '#ffd27a', transform: transformColor},
    radius: {default: 0.5},
    rays: {default: 12},
    softness: {default: 0.6},
    speed: {default: 1},
  },
  paint: (params) => {
    const coverage = withFrame(
      radialFrame(p('center')),
      modulate(softRayLobes({count: p('rays'), softness: p('softness'), spin: 0.2}), glowPoint({sharpness: 6}), featherMask({radius: p('radius'), feather: 0.4})),
      'sun',
    )(params)
    const rgb = math.mul(params.uniforms.color.member('rgb'), coverage)
    return compose.emissiveAlpha(rgb)
  },
})
```

## Types

| Type | What it is |
|---|---|
| `HeatRamp` | What `heatRamp` returns: call its `taps(heat, params)` to color a heat field. |
| `LightPart` | A light shaped over a frame's coordinates. |
| `LightValue` | A light or a frame waiting for the shader's params. |

## Words

- [`glowAt`](/docs/primitives/light/glowat) — A soft round glow at a position on the canvas.
- [`glowSpot`](/docs/primitives/light/glowspot) — A soft oval glow over an offset you have already scaled, the core of a bloom or a glare.
- [`emitterFalloff`](/docs/primitives/light/emitterfalloff) — How light spilling from an emitter dims with distance, with a long realistic tail.
- [`radialFrame`](/docs/primitives/light/radialframe) — The frame for a burst, halo or sweep around a center prop.
- [`seamlessRadialFrame`](/docs/primitives/light/seamlessradialframe) — The frame `noiseRays` needs: a radial frame around a center prop with no visible seam.
- [`beamFrame`](/docs/primitives/light/beamframe) — The frame of a beam that starts at an anchor prop and points at the canvas center.
- [`withFrame`](/docs/primitives/light/withframe) — Evaluate a light part in a frame.
- [`modulate`](/docs/primitives/light/modulate) — Multiply light parts drawn in the same frame, such as a mask over a pattern.
- [`glowPoint`](/docs/primitives/light/glowpoint) — A soft glow at the center of a radial frame with no hard edge.
- [`featherMask`](/docs/primitives/light/feathermask) — A round mask that is solid inside a radius and fades out at its edge.
- [`rayLobes`](/docs/primitives/light/raylobes) — Soft rays fanning out from the center of a radial frame, turning with the layer's clock.
- [`softRayLobes`](/docs/primitives/light/softraylobes) — `rayLobes` with a softness slider instead of a sharpness.
- [`raySpikes`](/docs/primitives/light/rayspikes) — Thin star spikes with dark gaps between them, like light through a camera aperture.
- [`ringBand`](/docs/primitives/light/ringband) — Three thin colored rings around the center, the rainbow edge of a lens or a halo.
- [`noiseRays`](/docs/primitives/light/noiserays) — Volumetric god rays: shafts of light drifting outward from the center, moving on the layer's clock.
- [`rayBands`](/docs/primitives/light/raybands) — Bright bands that travel along a coordinate, for aurora curtains or shimmering rays.
- [`shine`](/docs/primitives/light/shine) — A specular highlight on any surface that gives you a normal.
- [`domeNormal`](/docs/primitives/light/domenormal) — The surface normals of a flat disc treated as a puffy dome, ready to light with `shine`.
- [`additive`](/docs/primitives/light/additive) — Adds lights together, since light from several sources simply sums.
- [`heatRamp`](/docs/primitives/light/heatramp) — The colors of overexposed light, from a dim fringe through a mid tone to a hot core.
- [`vignetteMask`](/docs/primitives/light/vignettemask) — Darkens the corners of the canvas.
- [`screenGlow`](/docs/primitives/light/screenglow) — An `effect` that shines emitted light onto the layer inside it, the way light hits film.
- [`coverageMix`](/docs/primitives/light/coveragemix) — Blends from a background color to a light color by a coverage field, as a finished paint.
- [`coverageOver`](/docs/primitives/light/coverageover) — Lays a light color over a background color by a coverage field, like a layer with an opacity mask, as a finished paint.
- [`slowDrift`](/docs/primitives/light/slowdrift) — The slow breathing and drifting signals that keep a light leak alive.
- [`beamBloom`](/docs/primitives/light/beambloom) — The soft pool of light at the start of a beam, with a wider faint shoulder around it.
- [`beamStreaks`](/docs/primitives/light/beamstreaks) — Two bright bands crossing a beam further along it, slowly drifting, like light bouncing inside a film camera.
- [`streakBand`](/docs/primitives/light/streakband) — One soft band across a single coordinate, peaking at `center`.
- [`lightBeam`](/docs/primitives/light/lightbeam) — The glow of a beam that can be thicker or softer at one end than the other.
- [`segmentProject`](/docs/primitives/light/segmentproject) — Where a pixel falls along a line from `a` to `b`, and how far it is from that line.
- [`flareFrame`](/docs/primitives/light/flareframe) — The shared frame of a camera lens flare, which every `flare*` part reads.
- [`lensGhost`](/docs/primitives/light/lensghost) — One ghost disc of a lens flare, the faint circles that line up across from the light.
- [`flareHalo`](/docs/primitives/light/flarehalo) — The rainbow halo ring of a lens flare, drawn across the canvas from the light.
- [`flareStarburst`](/docs/primitives/light/flarestarburst) — The star of thin spikes around the light in a lens flare.
- [`flareStreak`](/docs/primitives/light/flarestreak) — The horizontal widescreen streak through the light in a lens flare.
- [`flareGlare`](/docs/primitives/light/flareglare) — The broad warm-white wash around the light that lifts contrast near it.
- [`flareCore`](/docs/primitives/light/flarecore) — The bright point at the light itself: a hard pinpoint inside a small soft glow.
- [`flareComposite`](/docs/primitives/light/flarecomposite) — Closes a lens flare: turns the summed flare parts into the color to return from `paint`.
- [`dithered`](/docs/primitives/light/dithered) — Adds a trace of noise to a heat field so long soft ramps do not show bands.
- [`starGlint`](/docs/primitives/light/starglint) — A four-point star of light: a round core with a thin ray along each axis, like a glint off glitter or a star in a photograph.