---
title: "lightVec3"
description: "A 3D light direction from a `direction()` vector and an elevation."
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#L588"
---

# lightVec3

A 3D light direction from a `direction()` vector and an elevation.

```ts
lightVec3(dir: Expr, z: number, hint: string = 'L'): Expr
```

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

`z` is negative for a light on the viewer's side of the surface (−0.6 raking to −0.9 frontal). Use it where a word wants a unit light vector. `keyLightAt` also gives the half vector for highlights.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `dir` | `Expr` |  |
| `z` | `number` |  |
| `hint` | `string` | Optional. Default `'L'`. |

## Example

```ts
const L = lightVec3(direction(u.lightAngle), -0.7)
```

## See also

- [`keyLightAt`](/docs/primitives/materials/keylightat) — A key light from an angle: the light direction `.L` and the half vector `.H` for highlights.
- [`anisoSpecular`](/docs/primitives/materials/anisospecular) — A highlight stretched along a grain, as on brushed metal or carbon fibre.
- [`lambert`](/docs/primitives/materials/lambert) — How much a light falls on a surface: 0 facing away, 1 facing it.

## Used by

[BrushedMetal](/docs/components/brushedmetal), [CarbonFiber](/docs/components/carbonfiber), [Satin](/docs/components/satin)