determinant
Returns the determinant of a matrix. Accepts mat2/mat3/mat4 and outputs a float.
Core Advantages
Exposes a key linear‑algebra quantity in one node to detect handedness/mirrored scaling and area/volume scale factors without manual algebra.
Common Uses
Detect mirrored scaling in model transforms (det < 0) to fix TBN/normal or tangent handedness
Estimate 2D/3D transform scaling (use |det| as area or volume scale)
Robust inversion tests in procedural geometry or UV transforms
How to adjust
No tweakable parameters. Control the output by changing the input matrix: use mat2 for 2D affine (det≈sx*sy), mat3/from mat4 for normals/handedness tests, or mat4 to detect reflections. Typical patterns: sign tests, abs(det), or using det as a blend weight. Beware numerical issues with non‑orthogonal or extreme scales; pre-process with transpose/inverse/normalize if needed.
Code Examples
1// Switch color by transform handedness via world matrix determinant
2const det = determinant( mat3( objectWorldMatrix() ) ); // take upper-left 3x3
3material.colorNode = det.lessThan( 0.0 ).cond( color(0xff4d4d), color(0x2e90ff) );