Documentation / @ripl/3d / mat4Perspective
Function: mat4Perspective() ​
mat4Perspective(
fovRadians,aspect,near,far):Matrix4
Defined in: 3d/src/math/matrix.ts:187
Constructs a perspective projection matrix.
Depth maps to the WebGPU convention: the near plane projects to 0 and the far plane to 1, matching the 0 ≤ z ≤ w clip volume the GPU backend rasterises against. The CPU painter reads the projected depth only as a sort key, and it stays monotonic with distance.
Parameters ​
| Parameter | Type |
|---|---|
fovRadians | number |
aspect | number |
near | number |
far | number |