Skip to content

Documentation / @ripl/3d / mat4NormalMatrix

Function: mat4NormalMatrix() ​

mat4NormalMatrix(m): Matrix4

Defined in: 3d/src/math/matrix.ts:315

Builds the normal matrix for a model matrix — the inverse transpose of its upper-3×3.

Transforming a normal by the model matrix itself is only correct under uniform scale; under non-uniform scale it shears the normal off the surface and the shading goes wrong. The translation column is dropped because a normal is a direction, not a position.

Parameters ​

ParameterTypeDescription
mMatrix4The model matrix.

Returns ​

Matrix4

The normal matrix, or the identity when m is singular.