<blockquote>
  <p>The second matrix translates the eye [...]</p>
</blockquote>

<p>You don't do that in a projection matrix. You do that with your view matrix:</p>

<ol>
<li>Model (/Object) Matrix transforms an object into World Space</li>
<li>View Matrix transforms all objects from world space to Eye (/Camera) Space (no projection so far!)</li>
<li>Projection Matrix transforms from Eye Space to Clip Space</li>
</ol>

<p>Therefore you don't do any matrix multiplications to get to a projection matrix. Those multiplications happen in the shader, where you do <span class="math-container">$Projection\cdot View \cdot Model$$^1$</span> Matrix (for example in the vertex shader to specify your position output).</p>

<p>Also, remember that a perspective projection changes angles (i.e. parallel lines won't be parallel anymore). As far as I can see that is missing in your derivation.</p>

<p><strong><em>Edit</em></strong></p>

<p>As to how you actually derive it, I'll largely use the explanation by<a href="http://ogldev.atspace.co.uk/www/tutorial12/tutorial12.html" rel="nofollow noreferrer">Etay Meiri</a>. It has some additional information and illustration, so you may want to check it, if something seems unclear.</p>

<p>First, your camera is (as mentioned earlier) positioned in the origin.
Now assume, you will only project onto a plane of distance <span class="math-container">$d$</span> and the plane you project onto is bounded by the aspect ration <span class="math-container">$ar$</span> (that is <span class="math-container">$ar = \frac{window\text{ }width}{window\text{ }height}$</span> in positive and negative <span class="math-container">$x$</span> direction and by <span class="math-container">$1$</span> in positive and negative <span class="math-container">$y$</span> direction.</p>

<p>You can now determine <span class="math-container">$d$</span> by your vertical field of view <span class="math-container">$\alpha$</span> (since looking from the side, your camera, the center at the top of your projection plane and the center of the bottom of your projection plane build a triangle and your vertical field of view is the angle at your camera):</p>

<p><span class="math-container">$\frac{1}{d} = \tan(\frac{\alpha}{2})\\
\implies d = \frac{1}{\tan(\frac{\alpha}{2})}$</span></p>

<p>Now you go about calculating projected points. Assume you have an arbitrary point <span class="math-container">$v = (v_x, v_y, v_z)$</span>, and you want to calculate the point on your plane <span class="math-container">$p = (p_x, p_y, d)$</span>. Looking at it from the side again, the triangle with your camera, your projection plane top center point and your projected point is similar to the triangle with your camera, your projection plane top center prolonged to have the same z coordinate, as your point <span class="math-container">$v$</span> and the point <span class="math-container">$v$</span>, i.e. they have the same angles<span class="math-container">$^2$</span>. Therefore, you can now calculate the projected <span class="math-container">$p_x$</span> and <span class="math-container">$p_y$</span> coordinate:</p>

<p><span class="math-container">$
\frac{p_y}{d} = \frac{v_y}{v_z} \implies p_y = \frac{v_y\cdot d}{v_z} = \frac{v_y}{v_z \cdot \tan(\frac{\alpha}{2})}\\
\frac{p_x}{d} = \frac{v_x}{v_z} \implies p_x = \frac{v_x\cdot d}{v_z} = \frac{v_x}{v_x \cdot \tan(\frac{\alpha}{2})}
$</span></p>

<p>To additionally take into account, that the projection plane ranges from <span class="math-container">$-ar$</span> to <span class="math-container">$ar$</span> in <span class="math-container">$x$</span> direction, you would add <span class="math-container">$ar$</span> to the denominator in order to make the projected <span class="math-container">$x$</span> range be <span class="math-container">$\left[-1, 1\right]$</span>:</p>

<p><span class="math-container">$
p_x = \frac{v_x}{ar \cdot v_x \cdot \tan(\frac{\alpha}{2})}
$</span></p>

<p>If you think about applying this to a matrix now, you need to take into account the division by <span class="math-container">$z$</span>, which is different for any point with differing <span class="math-container">$z$</span> value. Therefore, the division by z is deferred until after the projection matrix is applied (and is done without any code of you, i.e. for OpenGL you'd specify the <code>gl_Position</code> in Clip Space (<span class="math-container">$\implies$</span> after projection) and the division is done for you).</p>

<p>The depth test (Z-Test) still needs the <span class="math-container">$z$</span> value though, so it needs to be "safed" from the <span class="math-container">$z$</span> divide. Therefore you copy your <span class="math-container">$z$</span> value to the <span class="math-container">$w$</span> component (which is what you got right in your assumption) and end up with the following matrix:</p>

<p><span class="math-container">$\left(
\begin{array}{cccc}
\frac{1}{ar\cdot\tan(\frac{\alpha}{2})}&amp;0&amp;0\\
0&amp;\frac{1}{\tan(\frac{\alpha}{2})}&amp;0&amp;0\\
0&amp;0&amp;0&amp;0\\
0&amp;0&amp;1&amp;0
\end{array}
\right)$</span></p>

<p>The next step is to not project onto a plane, but into a <span class="math-container">$z$</span> range of <span class="math-container">$\left[-1, 1\right]$</span> (this range is for correct clipping, as is the same range when handling the <span class="math-container">$x$</span> and the <span class="math-container">$y$</span> coordinate). To be more specific, you don't want all points to end up in that range, but all points between your near and your far plane, so you map <span class="math-container">$[n, f]$</span> to <span class="math-container">$[-1, 1]$</span>.
The resulting range is <span class="math-container">$2$</span>, so you first scale your near-to-far range to <span class="math-container">$2$</span>. Then you move it to be <span class="math-container">$[-1, 1]$</span>:</p>

<p><span class="math-container">$
f(z) = A\cdot z + B
$</span></p>

<p>And now taking into account that we want to safe the <span class="math-container">$z$</span> value from <span class="math-container">$z$</span> divide, we get to</p>

<p><span class="math-container">$f(z) = A + \frac{B}{z}$</span></p>

<p>Mapping this scaling to <span class="math-container">$[-1, 1]$</span> is a little bit of leg work: you know that any point with <span class="math-container">$z = n$</span> (on your near plane) will be projected to <span class="math-container">$p_z = -1$</span> and any point with <span class="math-container">$z = f$</span> (on your far plane) will be projected to <span class="math-container">$p_z = 1$</span>. This leads to the following equation system:</p>

<p><span class="math-container">$
A + \frac{B}{n} = -1\\
A + \frac{B}{f} = 1
$</span></p>

<p>Solving this for <span class="math-container">$A$</span> and <span class="math-container">$B$</span> leads to<span class="math-container">$^3$</span>:</p>

<p><span class="math-container">$
A = \frac{-n-f}{n-f}\\
B = \frac{2fn}{n-f}
$</span></p>

<p>Your third row of the projection matrix must produced the (undivided) <span class="math-container">$p_z$</span> (projected) z value. Therefore, you can now choose the individual elements of said row <span class="math-container">$(\begin{array}{cccc}a&amp;b&amp;c&amp;d\end{array})$</span> such that the correct <span class="math-container">$z$</span> value is produced when multiplying with your point. The correct <span class="math-container">$p_z$</span> value is (as established earlier):
<span class="math-container">$p_z = A\cdot z + B$</span></p>

<p>Therefore this must be the right hand side of your multiplication. Assume your point to project is <span class="math-container">$(x, y, z, w)$</span>, then 
you must achieve the following:</p>

<p><span class="math-container">$
a \cdot x + b \cdot y + c \cdot z + d \cdot w = A \cdot z + B
$</span></p>

<p>Obviously, your point's <span class="math-container">$x$</span> and <span class="math-container">$y$</span> coordinate should not influence the projected <span class="math-container">$z$</span> coordiante, so you can set <span class="math-container">$a$</span> and <span class="math-container">$b$</span> to <span class="math-container">$0$</span>.</p>

<p><span class="math-container">$
c \cdot z + d \cdot w = A \cdot z + B
$</span></p>

<p>Since you know that <span class="math-container">$w$</span> for any point is <span class="math-container">$1$</span>, you're left with</p>

<p><span class="math-container">$
c \cdot z + d = A \cdot z + B
$</span></p>

<p>And thus, you have <span class="math-container">$c = A$</span> and <span class="math-container">$d = B$</span>.</p>

<p>Now your matrix is complete for projection</p>

<p><span class="math-container">$\left(
\begin{array}{cccc}
\frac{1}{ar\cdot\tan(\frac{\alpha}{2})}&amp;0&amp;0\\
0&amp;\frac{1}{\tan(\frac{\alpha}{2})}&amp;0&amp;0\\
0&amp;0&amp;\frac{-n-f}{n-f}&amp;\frac{2fn}{n-f}\\
0&amp;0&amp;1&amp;0
\end{array}
\right)$</span></p>

<p>Obviously, the tutorial works a little differently in projecting with the vertical field of view, so we can take a look at how you can additionally get to that (with the help of <a href="http://mathfor3dgameprogramming.com/" rel="nofollow noreferrer">Eric Lengyel</a>:</p>

<p>Instead of projecting onto a plane at <span class="math-container">$z = d$</span>, we will project onto the near plane, and thus get for a point <span class="math-container">$v = (v_x, v_y, v_z)$</span> the projected point <span class="math-container">$p = (p_x, p_y, n)$</span>:</p>

<p><span class="math-container">$
p_x = \frac{v_x \cdot n}{v_z}
$</span></p>

<p>Additionally, you want to map any point with <span class="math-container">$l\leq x \leq r$</span> to <span class="math-container">$\left[-1, 1\right]$</span>, as before.
Thus you get </p>

<p><span class="math-container">$f(x) = (x-l) \frac{2}{r-l}-1$</span></p>

<p>Combine those two and you achieve</p>

<p><span class="math-container">$p_x = \frac{2n}{r-l}\left(-\frac{v_x}{v_y}\right)- \frac{r+l}{r-l}$</span></p>

<p>Now put this (and the term for <span class="math-container">$y$</span>) into the matrix and you get to the first row, first column being  <span class="math-container">$\frac{2n}{r-l}$</span>, and the first row, third column being <span class="math-container">$\frac{r+l}{r-l}$</span>. Since you may assume <span class="math-container">$r$</span> and <span class="math-container">$l$</span> to be different, here you can see why those two matrices differ. <span class="math-container">$r$</span> and <span class="math-container">$l$</span> are guaranteed to be the same in the tutorial's matrix and therefore you get <span class="math-container">$r+l = ar-ar = 0$</span> in the denominator, making the third row first column (and second column accordingly) <span class="math-container">$0$</span>.</p>

<hr>

<p><span class="math-container">$^1$</span>Assuming you have Column-Major matrices like in OpenGL$</p>

<p><span class="math-container">$^2$</span>For the <span class="math-container">$x$</span> calculation, you will need to take a different point of your projection plane of course, but the idea is the same</p>

<p><span class="math-container">$^3$</span>The differences of the sign come from how you orient your camera: in your assumption it is along the negative <span class="math-container">$z$</span> axis, whereas in the tutorial it is along the positive <span class="math-container">$z$</span> axis</p>

CC BY-SA 3.0
2018-02-13T22:17:12.740Z
I'm not sure how can I derive this projection matrix. Can you explain it more clearly?
Manh Nguyen Huu
CC BY-SA 3.0
2018-02-14T10:24:33.613Z
I have added the complete derivation of a simpler version, plus the explanation on the differences to the matrix you wanted to achieve. hope that helps.
Tare
CC BY-SA 3.0
2018-02-14T15:32:27.753Z
Thank you very much, I understand more thoroughly now. 1 question though, so the third row, mapping [-1, 1], aren't there any matrices multiplication that can get to that row? What I mean is a combination of scaling, translating, shearing, etc
Manh Nguyen Huu
CC BY-SA 3.0
2018-02-15T08:04:16.830Z
Although I guess it's possible, there is no matrix multiplication that I know of that does this. I also don't see the reason why you would want to add another multiplication, that achieves nothing else than the single matrix but adds an overhead of calculations?
Tare
CC BY-SA 4.0
2018-09-01T14:56:48.167Z
I did a more in depth derivation of the perspective projection matrix here: https://dovo329.github.io/DeriveOpenGLPerspectiveProjectionMatrix/
Doug Voss
CC BY-SA 4.0
2019-08-02T03:20:11.753Z
`\frac{p_x}{d} = \frac{v_x}{v_x} \implies p_x = \frac{v_x\cdot d}{v_z} = \frac{v_x}{v_x \cdot \tan(\frac{\alpha}{2})}`. Probably you mean `\frac{v_x}{v_z}`?
Meowmere
CC BY-SA 4.0
2019-08-02T08:17:37.810Z
Well spotted. I fixed it
Tare
CC BY-SA 4.0
2018-02-13T07:57:56.177Z
2019-08-02T08:17:15.157Z
2019-08-02T08:17:15.157Z
Tare
<p>This has been haunting me for several days now. I want to find the component that makes up of this 4x4 perspective projection matrix, with $l$(left), $r$(right), $b$(bottom), $t$(top), $n$(near), $f$(far) defining the frustum.</p>

<p>$\left(
\begin{array}{cccc}
\frac{2n}{r-l}&amp;        0&amp;  \frac{r+l}{r-l}&amp;         0\\
0&amp; \frac{2n}{t-b}&amp;  \frac{t+b}{t-b}&amp;         0\\
0&amp;        0&amp; -\frac{f+n}{f-n}&amp;-\frac{2fn}{f-n}\\
0&amp;       0&amp;           -1&amp;         0
\end{array}
\right)$</p>

<p>Here's my approach so far. The first matrix component would just copy $z$ over to $w$ coordinate:</p>

<p>$\left(
\begin{array}{cccc}
    1&amp; 0&amp;  0&amp; 0\\
    0&amp; 1&amp;  0&amp; 0\\
    0&amp; 0&amp;  1&amp; 0\\
    0&amp; 0&amp; -1&amp; 0
\end{array}
\right)$</p>

<p>The second matrix translates the eye ($at = \left(0, 0, 0\right)$) to ($\frac{l+r}{2}$, $\frac{t+b}{2}$, $\frac{n+f}{2}$, the center of the frustum because canonical coordinate is just a cube of size $2$ with its centroid at the origin $\left(0, 0, 0\right)$</p>

<p>$\left(
\begin{array}{cccc}
    1&amp; 0&amp; 0&amp; \frac{l+r}{2}\\
    0&amp; 1&amp; 0&amp; \frac{b+t}{2}\\
    0&amp; 0&amp; 1&amp; \frac{n+f}{2}\\
    0&amp; 0&amp; 0&amp;       1
\end{array}
\right)$</p>

<p>The last matrix just scales the thing so that the frustum fits into the cube of size $2$.</p>

<p>$\left(
\begin{array}{cccc}
    \frac{2}{r-l}&amp;       0&amp;       0&amp; 0\\
          0&amp; \frac{2}{t-b}&amp;       0&amp; 0\\
          0&amp;       0&amp; \frac{2}{f-n}&amp; 0\\
          0&amp;       0&amp;       0&amp; 1 
\end{array}
\right)$</p>

<p>As you can see the multiplication of these 3 matrices isn't equal to the perspective projection matrix. What am I missing?</p>

<3d><matrix><projections><linear-algebra>
How to derive a perspective projection matrix from its components?
Manh Nguyen Huu
# How to derive a perspective projection matrix from its components?

(Asked by: username_0 on 2018-02-11)

This has been haunting me for several days now. I want to find the component that makes up of this 4x4 perspective projection matrix, with $l$(left), $r$(right), $b$(bottom), $t$(top), $n$(near), $f$(far) defining the frustum.

$\left(
\begin{array}{cccc}
\frac{2n}{r-l}& 0& \frac{r+l}{r-l}& 0\\
0& \frac{2n}{t-b}& \frac{t+b}{t-b}& 0\\
0& 0& -\frac{f+n}{f-n}&-\frac{2fn}{f-n}\\
0& 0& -1& 0
\end{array}
\right)$

Here's my approach so far. The first matrix component would just copy $z$ over to $w$ coordinate:

$\left(
\begin{array}{cccc}
1& 0& 0& 0\\
0& 1& 0& 0\\
0& 0& 1& 0\\
0& 0& -1& 0
\end{array}
\right)$

The second matrix translates the eye ($at = \left(0, 0, 0\right)$) to ($\frac{l+r}{2}$, $\frac{t+b}{2}$, $\frac{n+f}{2}$, the center of the frustum because canonical coordinate is just a cube of size $2$ with its centroid at the origin $\left(0, 0, 0\right)$

$\left(
\begin{array}{cccc}
1& 0& 0& \frac{l+r}{2}\\
0& 1& 0& \frac{b+t}{2}\\
0& 0& 1& \frac{n+f}{2}\\
0& 0& 0& 1
\end{array}
\right)$

The last matrix just scales the thing so that the frustum fits into the cube of size $2$.

$\left(
\begin{array}{cccc}
\frac{2}{r-l}& 0& 0& 0\\
0& \frac{2}{t-b}& 0& 0\\
0& 0& \frac{2}{f-n}& 0\\
0& 0& 0& 1
\end{array}
\right)$

As you can see the multiplication of these 3 matrices isn't equal to the perspective projection matrix. What am I missing?

**Tags:** 3d, matrix, projections, linear-algebra


---

## 1 answers

### Answer by username_1 on 2018-02-13. Score: 4 | Accepted answer

> The second matrix translates the eye [...]

You don't do that in a projection matrix. You do that with your view matrix:

1. Model (/Object) Matrix transforms an object into World Space
2. View Matrix transforms all objects from world space to Eye (/Camera) Space (no projection so far!)
3. Projection Matrix transforms from Eye Space to Clip Space

Therefore you don't do any matrix multiplications to get to a projection matrix. Those multiplications happen in the shader, where you do $Projection\cdot View \cdot Model$$^1$ Matrix (for example in the vertex shader to specify your position output).

Also, remember that a perspective projection changes angles (i.e. parallel lines won't be parallel anymore). As far as I can see that is missing in your derivation.

***Edit***

As to how you actually derive it, I'll largely use the explanation by[Etay Meiri](http://ogldev.atspace.co.uk/www/tutorial12/tutorial12.html). It has some additional information and illustration, so you may want to check it, if something seems unclear.

First, your camera is (as mentioned earlier) positioned in the origin.
Now assume, you will only project onto a plane of distance $d$ and the plane you project onto is bounded by the aspect ration $ar$ (that is $ar = \frac{window\text{ }width}{window\text{ }height}$ in positive and negative $x$ direction and by $1$ in positive and negative $y$ direction.

You can now determine $d$ by your vertical field of view $\alpha$ (since looking from the side, your camera, the center at the top of your projection plane and the center of the bottom of your projection plane build a triangle and your vertical field of view is the angle at your camera):

$\frac{1}{d} = \tan(\frac{\alpha}{2})\\
\implies d = \frac{1}{\tan(\frac{\alpha}{2})}$

Now you go about calculating projected points. Assume you have an arbitrary point $v = (v\_x, v\_y, v\_z)$, and you want to calculate the point on your plane $p = (p\_x, p\_y, d)$. Looking at it from the side again, the triangle with your camera, your projection plane top center point and your projected point is similar to the triangle with your camera, your projection plane top center prolonged to have the same z coordinate, as your point $v$ and the point $v$, i.e. they have the same angles$^2$. Therefore, you can now calculate the projected $p\_x$ and $p\_y$ coordinate:

$
\frac{p\_y}{d} = \frac{v\_y}{v\_z} \implies p\_y = \frac{v\_y\cdot d}{v\_z} = \frac{v\_y}{v\_z \cdot \tan(\frac{\alpha}{2})}\\
\frac{p\_x}{d} = \frac{v\_x}{v\_z} \implies p\_x = \frac{v\_x\cdot d}{v\_z} = \frac{v\_x}{v\_x \cdot \tan(\frac{\alpha}{2})}
$

To additionally take into account, that the projection plane ranges from $-ar$ to $ar$ in $x$ direction, you would add $ar$ to the denominator in order to make the projected $x$ range be $\left[-1, 1\right]$:

$
p\_x = \frac{v\_x}{ar \cdot v\_x \cdot \tan(\frac{\alpha}{2})}
$

If you think about applying this to a matrix now, you need to take into account the division by $z$, which is different for any point with differing $z$ value. Therefore, the division by z is deferred until after the projection matrix is applied (and is done without any code of you, i.e. for OpenGL you'd specify the `gl_Position` in Clip Space ($\implies$ after projection) and the division is done for you).

The depth test (Z-Test) still needs the $z$ value though, so it needs to be "safed" from the $z$ divide. Therefore you copy your $z$ value to the $w$ component (which is what you got right in your assumption) and end up with the following matrix:

$\left(
\begin{array}{cccc}
\frac{1}{ar\cdot\tan(\frac{\alpha}{2})}&0&0\\
0&\frac{1}{\tan(\frac{\alpha}{2})}&0&0\\
0&0&0&0\\
0&0&1&0
\end{array}
\right)$

The next step is to not project onto a plane, but into a $z$ range of $\left[-1, 1\right]$ (this range is for correct clipping, as is the same range when handling the $x$ and the $y$ coordinate). To be more specific, you don't want all points to end up in that range, but all points between your near and your far plane, so you map $[n, f]$ to $[-1, 1]$.
The resulting range is $2$, so you first scale your near-to-far range to $2$. Then you move it to be $[-1, 1]$:

$
f(z) = A\cdot z + B
$

And now taking into account that we want to safe the $z$ value from $z$ divide, we get to

$f(z) = A + \frac{B}{z}$

Mapping this scaling to $[-1, 1]$ is a little bit of leg work: you know that any point with $z = n$ (on your near plane) will be projected to $p\_z = -1$ and any point with $z = f$ (on your far plane) will be projected to $p\_z = 1$. This leads to the following equation system:

$
A + \frac{B}{n} = -1\\
A + \frac{B}{f} = 1
$

Solving this for $A$ and $B$ leads to$^3$:

$
A = \frac{-n-f}{n-f}\\
B = \frac{2fn}{n-f}
$

Your third row of the projection matrix must produced the (undivided) $p\_z$ (projected) z value. Therefore, you can now choose the individual elements of said row $(\begin{array}{cccc}a&b&c&d\end{array})$ such that the correct $z$ value is produced when multiplying with your point. The correct $p\_z$ value is (as established earlier):
$p\_z = A\cdot z + B$

Therefore this must be the right hand side of your multiplication. Assume your point to project is $(x, y, z, w)$, then
you must achieve the following:

$
a \cdot x + b \cdot y + c \cdot z + d \cdot w = A \cdot z + B
$

Obviously, your point's $x$ and $y$ coordinate should not influence the projected $z$ coordiante, so you can set $a$ and $b$ to $0$.

$
c \cdot z + d \cdot w = A \cdot z + B
$

Since you know that $w$ for any point is $1$, you're left with

$
c \cdot z + d = A \cdot z + B
$

And thus, you have $c = A$ and $d = B$.

Now your matrix is complete for projection

$\left(
\begin{array}{cccc}
\frac{1}{ar\cdot\tan(\frac{\alpha}{2})}&0&0\\
0&\frac{1}{\tan(\frac{\alpha}{2})}&0&0\\
0&0&\frac{-n-f}{n-f}&\frac{2fn}{n-f}\\
0&0&1&0
\end{array}
\right)$

Obviously, the tutorial works a little differently in projecting with the vertical field of view, so we can take a look at how you can additionally get to that (with the help of [Eric Lengyel](http://mathfor3dgameprogramming.com/):

Instead of projecting onto a plane at $z = d$, we will project onto the near plane, and thus get for a point $v = (v\_x, v\_y, v\_z)$ the projected point $p = (p\_x, p\_y, n)$:

$
p\_x = \frac{v\_x \cdot n}{v\_z}
$

Additionally, you want to map any point with $l\leq x \leq r$ to $\left[-1, 1\right]$, as before.
Thus you get

$f(x) = (x-l) \frac{2}{r-l}-1$

Combine those two and you achieve

$p\_x = \frac{2n}{r-l}\left(-\frac{v\_x}{v\_y}\right)- \frac{r+l}{r-l}$

Now put this (and the term for $y$) into the matrix and you get to the first row, first column being $\frac{2n}{r-l}$, and the first row, third column being $\frac{r+l}{r-l}$. Since you may assume $r$ and $l$ to be different, here you can see why those two matrices differ. $r$ and $l$ are guaranteed to be the same in the tutorial's matrix and therefore you get $r+l = ar-ar = 0$ in the denominator, making the third row first column (and second column accordingly) $0$.

---

$^1$Assuming you have Column-Major matrices like in OpenGL$

$^2$For the $x$ calculation, you will need to take a different point of your projection plane of course, but the idea is the same

$^3$The differences of the sign come from how you orient your camera: in your assumption it is along the negative $z$ axis, whereas in the tutorial it is along the positive $z$ axis

> **Comments:**
> **username_0**: I'm not sure how can I derive this projection matrix. Can you explain it more clearly?  
> **username_1**: I have added the complete derivation of a simpler version, plus the explanation on the differences to the matrix you wanted to achieve. hope that helps.  
> **username_0**: Thank you very much, I understand more thoroughly now. 1 question though, so the third row, mapping [-1, 1], aren't there any matrices multiplication that can get to that row? What I mean is a combination of scaling, translating, shearing, etc  
> **username_1**: Although I guess it's possible, there is no matrix multiplication that I know of that does this. I also don't see the reason why you would want to add another multiplication, that achieves nothing else than the single matrix but adds an overhead of calculations?  
> **username_2**: I did a more in depth derivation of the perspective projection matrix here: https://dovo329.github.io/DeriveOpenGLPerspectiveProjectionMatrix/  
> **username_3**: `\frac{p_x}{d} = \frac{v_x}{v_x} \implies p_x = \frac{v_x\cdot d}{v_z} = \frac{v_x}{v_x \cdot \tan(\frac{\alpha}{2})}`. Probably you mean `\frac{v_x}{v_z}`?  
> **username_1**: Well spotted. I fixed it  

---

