---
title: "vec3 in WGSL, GLSL and TypeShade: shader type reference"
description: "vec3 is vec3<f32> in WGSL and vec3 in GLSL ES 3.00. A three-component vector of f32."
url: https://typeshade.dev/reference/types/vec3/
language: en
---

# `vec3`

Type

A three-component vector of `f32`.

The signature, the sentence and any message are the compiler's own text at commit af54ddad5.

## Syntax

```ts
interface vec3 {
  readonly [vecTag]: readonly ['f32', 3]
  [index: number]: f32
  x: f32
  y: f32
  z: f32
  r: f32
  g: f32
  b: f32
  …
}
```

The `…` line stands for 234 more members, the swizzles. A swizzle reads two to four components as a new vector of the same element type. The components come in any order and may repeat, and their letters come from one set, `xyzw` or `rgba`.

## Examples

- [`path/palette/palette.shade.ts`](https://typeshade.dev/guide/examples/palette/)
- [`path/ray-tracer/ray-tracer.shade.ts`](https://typeshade.dev/guide/examples/ray-tracer/)
- [`gallery/capsule-corp-namek-class/capsule-corp-namek-class.shade.ts`](https://typeshade.dev/guide/examples/capsule-corp-namek-class/)
- [`gallery/hillshade-twin/hillshade-twin.shade.ts`](https://typeshade.dev/guide/examples/hillshade-twin/)
- [`gallery/julia-twin/julia-twin.shade.ts`](https://typeshade.dev/guide/examples/julia-twin/)
- [`gallery/kaleidoscope-twin/kaleidoscope-twin.shade.ts`](https://typeshade.dev/guide/examples/kaleidoscope-twin/)
- [`gallery/mandelbrot-twin/mandelbrot-twin.shade.ts`](https://typeshade.dev/guide/examples/mandelbrot-twin/)
- [`gallery/path-tracer/path-tracer.shade.ts`](https://typeshade.dev/guide/examples/path-tracer/)
- [`gallery/plasma-twin/plasma-twin.shade.ts`](https://typeshade.dev/guide/examples/plasma-twin/)
- [`gallery/rt-renderer-class/rt-renderer-class.shade.ts`](https://typeshade.dev/guide/examples/rt-renderer-class/)
- [`gallery/voronoi-twin/voronoi-twin.shade.ts`](https://typeshade.dev/guide/examples/voronoi-twin/)
- [`gallery/fp64-burning-ship-twin/fp64-burning-ship-twin.shade.ts`](https://typeshade.dev/guide/examples/fp64-burning-ship-twin/)
- [`gallery/fp64-checker-plane-twin/fp64-checker-plane-twin.shade.ts`](https://typeshade.dev/guide/examples/fp64-checker-plane-twin/)
- [`gallery/fp64-julia-twin/fp64-julia-twin.shade.ts`](https://typeshade.dev/guide/examples/fp64-julia-twin/)
- [`gallery/fp64-lane-stripes/fp64-lane-stripes.shade.ts`](https://typeshade.dev/guide/examples/fp64-lane-stripes/)
- [`gallery/fp64-newton-twin/fp64-newton-twin.shade.ts`](https://typeshade.dev/guide/examples/fp64-newton-twin/)
- [`gallery/array-literal-ramp/array-literal-ramp.shade.ts`](https://typeshade.dev/guide/examples/array-literal-ramp/)
- [`gallery/array-methods/array-methods.shade.ts`](https://typeshade.dev/guide/examples/array-methods/)
- [`gallery/bit-bump/bit-bump.shade.ts`](https://typeshade.dev/guide/examples/bit-bump/)
- [`gallery/bitfield-bands/bitfield-bands.shade.ts`](https://typeshade.dev/guide/examples/bitfield-bands/)
- [`gallery/block-scope/block-scope.shade.ts`](https://typeshade.dev/guide/examples/block-scope/)
- [`gallery/class-builder/class-builder.shade.ts`](https://typeshade.dev/guide/examples/class-builder/)
- [`gallery/closures/closures.shade.ts`](https://typeshade.dev/guide/examples/closures/)
- [`gallery/cube-array-gather/cube-array-gather.shade.ts`](https://typeshade.dev/guide/examples/cube-array-gather/)
- [`gallery/cube-env/cube-env.shade.ts`](https://typeshade.dev/guide/examples/cube-env/)
- [`gallery/cutout/cutout.shade.ts`](https://typeshade.dev/guide/examples/cutout/)
- [`gallery/default-args/default-args.shade.ts`](https://typeshade.dev/guide/examples/default-args/)
- [`gallery/generic-class/generic-class.shade.ts`](https://typeshade.dev/guide/examples/generic-class/)
- [`gallery/hello-camera/hello-camera.shade.ts`](https://typeshade.dev/guide/examples/hello-camera/)
- [`gallery/hello-uniform-struct/hello-uniform-struct.shade.ts`](https://typeshade.dev/guide/examples/hello-uniform-struct/)
- [`gallery/hello-vsin/hello-vsin.shade.ts`](https://typeshade.dev/guide/examples/hello-vsin/)
- [`gallery/mixin-surface/mixin-surface.shade.ts`](https://typeshade.dev/guide/examples/mixin-surface/)
- [`gallery/normal-matrix/normal-matrix.shade.ts`](https://typeshade.dev/guide/examples/normal-matrix/)
- [`gallery/null-values/null-values.shade.ts`](https://typeshade.dev/guide/examples/null-values/)
- [`gallery/packing-bitcast/packing-bitcast.shade.ts`](https://typeshade.dev/guide/examples/packing-bitcast/)
- [`gallery/palette-const/palette-const.shade.ts`](https://typeshade.dev/guide/examples/palette-const/)
- [`gallery/pick-composite/pick-composite.shade.ts`](https://typeshade.dev/guide/examples/pick-composite/)
- [`gallery/ray-class/ray-class.shade.ts`](https://typeshade.dev/guide/examples/ray-class/)
- [`gallery/shape-inheritance/shape-inheritance.shade.ts`](https://typeshade.dev/guide/examples/shape-inheritance/)
- [`gallery/textured-quad/textured-quad.shade.ts`](https://typeshade.dev/guide/examples/textured-quad/)

## See also

- [Types](https://typeshade.dev/reference/types/)
- [`vec3()` in `typeshade/core/ir`](https://typeshade.dev/api/vec3/)
