The main reason for the matrix is โโthe mapping of three-dimensional coordinates into a two-dimensional plane and smaller distant objects.
A much simpler matrix is โโenough for this (if your camera is at the origin and looks at the Z axis):
1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0
After multiplying by this matrix and then renormalizing the w coordinate, you have exactly that. Each point x,y,z,1 becomes x/z,y/z,0,1 .
However, there is no depth information (Z - 0 for all points), so the depth buffer / filter will not work. To do this, we can use the parameter a for the matrix so that the depth information remains available:
1 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0
Now the resulting point contains the reciprocal depth in the Z-coordinate. Each point x,y,z,1 becomes x/z,y/z,1/z,1 .
Additional parameters are the result of comparing the coordinates in the device field (-1,-1,-1) - (1,1,1) (a bounding box in which, if you are outside of it, the point will not be drawn), using the scale and transfer.