---
title: "cross"
description: "The cross product of two 3D vectors."
group: "space"
groupTitle: "Shapes, frames & warps"
categoryId: "math"
categorySlug: "math"
categoryTitle: "Math"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/math.ts#L361"
---

# cross

The cross product of two 3D vectors.

```ts
cross(a: Val, b: Val): Expr
```

Import `math` from `shaders/std` and use `math.cross`.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `a` | `Val` |  |
| `b` | `Val` |  |

## Example

```ts
const normal = normalize(cross(tangentX, tangentY))
```

## See also

- [`dot`](/docs/primitives/math/dot) — The dot product of two vectors.
- [`normalize`](/docs/primitives/math/normalize) — The vector scaled to length 1.