# What is the projection matrix of reverse (Byzantine) perspective?

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 = (static_cast<T>(2) * (near - M)) / (right - left);
result = (right + left) / (right - left);
result = (right + left) / (right - left) * M;

result = (static_cast<T>(2) * (near - M)) / (top - bottom);
result = (top + bottom) / (top - bottom);
result = (top + bottom) / (top - bottom) * M;

result = ((static_cast<T>(2) * M) - near - far) / (far - near);
result = static_cast<T>(2) * (M - far) * near / (far - near) + M;

result = static_cast<T>(-1);
result = static_cast<T>(-M);
return result;
}

• Please delete this. I reposted on Math forum and cannot delete here as a new user. – Peter May 16 at 10:56