I would like to construct a projection matrix for reverse perspective. I'm using OpenGL and tried to modify concepts from this excelent tutorial.
I came up with: $$ \begin{bmatrix} 2\frac{(near-M)}{right-left} & 0 & \frac{right + left}{right-left} & M\frac{right + left}{right-left}\\ 0 & 2\frac{(near-M)}{top-bottom} & \frac{top + bottom}{top-bottom} & M\frac{top + bottom}{top-bottom}\\ 0 & 0 & \frac{2M-near-far}{far-near} & \frac{2(M-far)*near}{far-near} + M\\ 0 & 0 & -1 & -M \end{bmatrix} $$ $$ \text{Variables define viewing frustum. }M \text{ is the tip; point } (0,0,-M) \text{ in eye space.}$$
To avoid ambiguity near point M I put far plane closer to the camera. To debug this, I inverted points from NDC [-1,1] cube and they seem to fit the desired frustum. Sadly my models don't render correctly when using this matrix. They don't show up when they clearly are in the viewing frustum. I verify this by rendering the scene from other cameras using regular perspective or orthographic projection.
To clarify, what kind of perspective I'm talking about, here are links:
Code in c++ using glm:
template <typename T>
auto frustum(T left, T right, T bottom, T top, T near, T M, T far) {
glm::tmat4x4<T, glm::defaultp> result(0);
result[0][0] = (static_cast<T>(2) * (near - M)) / (right - left);
result[2][0] = (right + left) / (right - left);
result[3][0] = (right + left) / (right - left) * M;
result[1][1] = (static_cast<T>(2) * (near - M)) / (top - bottom);
result[2][1] = (top + bottom) / (top - bottom);
result[3][1] = (top + bottom) / (top - bottom) * M;
result[2][2] = ((static_cast<T>(2) * M) - near - far) / (far - near);
result[3][2] = static_cast<T>(2) * (M - far) * near / (far - near) + M;
result[2][3] = static_cast<T>(-1);
result[3][3] = static_cast<T>(-M);
return result;
}