---
title: "keyLightAt"
description: "A key light from an angle: the light direction `.L` and the half vector `.H` for highlights."
group: "light"
groupTitle: "Noise, light & materials"
categoryId: "materials"
categorySlug: "materials"
categoryTitle: "Materials & surfaces"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/paint/materials.ts#L784"
---

# keyLightAt

A key light from an angle: the light direction `.L` and the half vector `.H` for highlights.

```ts
keyLightAt(dir: Expr, elevation: number, hint: string = 'kl'): Expr
```

Import `materials` from `shaders/std` and use `materials.keyLightAt`.

`dir` is a `direction()` vector (from `frames`). `elevation` is how far the light sits toward the viewer: −0.6 raking, −0.9 frontal. Read `.L` with `member('L')` for `lambert` and `.H` for a glint.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `dir` | `Expr` |  |
| `elevation` | `number` |  |
| `hint` | `string` | Optional. Default `'kl'`. |

## Example

```ts
const key = keyLightAt(direction(u.lightAngle), -0.7)
```

> **Tip.** Elevation is negative in this engine. A positive value lights the surface from behind.

## See also

- [`keyLightXY`](/docs/primitives/materials/keylightxy) — A key light from explicit x and y components, for a second or a crossed light.
- [`lightVec3`](/docs/primitives/materials/lightvec3) — A 3D light direction from a `direction()` vector and an elevation.
- [`lambert`](/docs/primitives/materials/lambert) — How much a light falls on a surface: 0 facing away, 1 facing it.
- [`dualLobeGlint`](/docs/primitives/materials/duallobeglint) — A highlight with a tight hot core and a wide dim halo.
- [`sharpGlint`](/docs/primitives/materials/sharpglint) — A highlight whose tightness follows a sharpness slider.

## Used by

[Frost](/docs/components/frost), [Goo](/docs/components/goo), [LiquidMetal](/docs/components/liquidmetal), [Nebula](/docs/components/nebula), [Plastic](/docs/components/plastic), [Water](/docs/components/water)