cf_m4_normal_matrix¶
Category: math
GitHub: cute_math3d.h
Returns the matrix for transforming normals: the inverse-transpose of model.
| Parameters | Description |
|---|---|
model |
The model (or model-view) matrix. |
Remarks¶
Normals must not be transformed by the model matrix directly when it contains non-uniform
scale -- doing so leaves them non-perpendicular to the surface. The translation column is
irrelevant to normals and is left as-is; upload the result as a mat4 and use its upper
3x3 in the shader. Metal only supports mat4 inside a uniform block, so a mat3 normal
matrix cannot be uploaded directly.