---
title: "mat3x2f: shader function examples, uses and input limits"
description: "mat3x2f builds a matrix with 3 columns and 2 rows. Each column describes the image of one input basis direction."
url: https://typeshade.dev/reference/functions/mat3x2f/
language: en
---

# `mat3x2f`

Function

`mat3x2f` builds a matrix with 3 columns and 2 rows. Each column describes the image of one input basis direction.

## Compare examples

Compare the zero matrix with distinct columns and a diagonal pattern. Read the displayed matrix across rows and the constructor down columns.

**Example 1`mat3x2f()`**

`0` `0` `0` `0` `0` `0`

Matrix displayed by rows. Constructor arguments run down each column.

**Result**

`[[0,0,0],[0,0,0]]`

**Example 2`mat3x2f(1., 2., 3., 4., 5., 6.)`**

`1` `3` `5` `2` `4` `6`

Matrix displayed by rows. Constructor arguments run down each column.

**Result**

`[[1,3,5],[2,4,6]]`

**Example 3`mat3x2f(1., 0., 0., 1., 0., 0.)`**

`1` `0` `0` `0` `1` `0`

Matrix displayed by rows. Constructor arguments run down each column.

**Result**

`[[1,0,0],[0,1,0]]`

The examples are calculation models and do not run GPU work. The reference below gives the complete call signatures. Decimal results are rounded for display. The stated assumptions determine each example; actual shader results follow the target precision and execution rules.

## When to use it

Use a matrix to represent a linear transformation. Reading it by columns makes the constructor order visible.

## Inputs and limits

Components are supplied in column-major order. An argument-free constructor makes a zero matrix. Rectangular matrices do not have a determinant.

For shader input rules and precision, consult [WGSL](https://www.w3.org/TR/WGSL/) and [GLSL ES 3.00](https://registry.khronos.org/OpenGL/specs/es/3.0/GLSL_ES_Specification_3.00.pdf).

## Related functions

- [`transpose`](https://typeshade.dev/reference/functions/transpose/)
- [`determinant`](https://typeshade.dev/reference/functions/determinant/)
- [`vec2`](https://typeshade.dev/reference/functions/vec2/)

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

Builds a `mat3x2f`, the same type as `mat3x2` under WGSL's predeclared alias, in the same four ways: from 3 `vec2` columns, from 6 components column by column, from a larger matrix by truncation, or with no arguments for the zero matrix (§40).

## Syntax

```ts
declare function mat3x2f(): mat3x2
declare function mat3x2f(c0: vec2, c1: vec2, c2: vec2): mat3x2
declare function mat3x2f(e0: number, e1: number, e2: number, e3: number, e4: number, e5: number): mat3x2
declare function mat3x2f(m: mat3x2): mat3x2
declare function mat3x2f(m: mat3x3): mat3x2
declare function mat3x2f(m: mat3x4): mat3x2
declare function mat3x2f(m: mat4x2): mat3x2
declare function mat3x2f(m: mat4x3): mat3x2
declare function mat3x2f(m: mat4x4): mat3x2
```

A `number` in a parameter or a return position is the scalar slot. The ambient file declares a GPU scalar as a branded number whose brand is optional, so a literal and any branded scalar both fill it.

`type f32 = number & { readonly [f32Tag]?: true }`

A `number` you write as a type is inferred from its uses, and `f32`, `i32` and `u32` fix a width; [the TypeScript constructs page](https://typeshade.dev/guide/language/from-typescript/) carries that row with the compiler's emit.

## Parameters

- `c0` optional `vec2`
- `e0` optional `number`
- `m` optional `mat3x2``mat3x3``mat3x4``mat4x2``mat4x3``mat4x4`
- `c1` optional `vec2`
- `e1` optional `number`
- `c2` optional `vec2`
- `e2` optional `number`
- `e3` optional `number`
- `e4` optional `number`
- `e5` optional `number`

## Return value

`mat3x2`

## See also

- [Functions](https://typeshade.dev/reference/functions/)
